no-OS
All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
ltc3350.h
Go to the documentation of this file.
1/***************************************************************************/
34
35#ifndef __LTC3350_H__
36#define __LTC3350_H__
37
38#include <stdint.h>
39#include <string.h>
40#include "no_os_util.h"
41#include "no_os_i2c.h"
42
43/* LTC3350 Register Map */
44#define LTC3350_AD_CLR_ALARMS 0x00
45#define LTC3350_AD_MSK_ALARMS 0x01
46#define LTC3350_AD_MSK_MON_STATUS 0x02
47#define LTC3350_AD_CAP_ESR_PER 0x04
48#define LTC3350_AD_VCAPFB_DAC 0x05
49#define LTC3350_AD_VSHUNT 0x06
50#define LTC3350_AD_CAP_UV_LVL 0x07
51#define LTC3350_AD_CAP_OV_LVL 0x08
52#define LTC3350_AD_GPI_UV_LVL 0x09
53#define LTC3350_AD_GPI_OV_LVL 0x0A
54#define LTC3350_AD_VIN_UV_LVL 0x0B
55#define LTC3350_AD_VIN_OV_LVL 0x0C
56#define LTC3350_AD_VCAP_UV_LVL 0x0D
57#define LTC3350_AD_VCAP_OV_LVL 0x0E
58#define LTC3350_AD_VOUT_UV_LVL 0x0F
59#define LTC3350_AD_VOUT_OV_LVL 0x10
60#define LTC3350_AD_IIN_OC_LVL 0x11
61#define LTC3350_AD_ICHG_UC_LVL 0x12
62#define LTC3350_AD_DTEMP_COLD_LVL 0x13
63#define LTC3350_AD_DTEMP_HOT_LVL 0x14
64#define LTC3350_AD_ESR_HI_LVL 0x15
65#define LTC3350_AD_CAP_LO_LVL 0x16
66#define LTC3350_AD_CTL_REG 0x17
67#define LTC3350_AD_NUM_CAPS 0x1A
68#define LTC3350_AD_CHRG_STATUS 0x1B
69#define LTC3350_AD_MON_STATUS 0x1C
70#define LTC3350_AD_ALARM_REG 0x1D
71#define LTC3350_AD_MEAS_CAP 0x1E
72#define LTC3350_AD_MEAS_ESR 0x1F
73#define LTC3350_AD_MEAS_VCAP1 0x20
74#define LTC3350_AD_MEAS_VCAP2 0x21
75#define LTC3350_AD_MEAS_VCAP3 0x22
76#define LTC3350_AD_MEAS_VCAP4 0x23
77#define LTC3350_AD_MEAS_GPI 0x24
78#define LTC3350_AD_MEAS_VIN 0x25
79#define LTC3350_AD_MEAS_VCAP 0x26
80#define LTC3350_AD_MEAS_VOUT 0x27
81#define LTC3350_AD_MEAS_IIN 0x28
82#define LTC3350_AD_MEAS_ICHG 0x29
83#define LTC3350_AD_MEAS_DTEMP 0x2A
84
90#ifndef LTC3350_USE_MEASUREMENTS
91#define LTC3350_USE_MEASUREMENTS 1
92#endif
93
99#ifndef LTC3350_USE_ALARMS
100#define LTC3350_USE_ALARMS 0
101#endif
102
103/*LTC3350 alarms*/
122
123/*LTC3350 alarms_mask*/
142
151
160
163int ltc3350_init(struct ltc3350_dev **device,
166int ltc3350_remove(struct ltc3350_dev *dev);
167
170int ltc3350_read_device_data(struct ltc3350_dev *dev, uint8_t base_address,
171 uint16_t *read_data);
173int ltc3350_write_device_data(struct ltc3350_dev *dev, uint8_t base_address,
174 uint16_t write_data);
175
177
178/* LTC3350_USE_MEASUREMENTS == 1 */
179
180#if LTC3350_USE_MEASUREMENTS
181
183int ltc3350_get_num_caps(struct ltc3350_dev *dev, uint8_t *num_caps);
184
186int ltc3350_get_esr(struct ltc3350_dev *dev, uint16_t *value);
188int ltc3350_get_vcap(struct ltc3350_dev *dev, uint8_t n_cap, uint16_t *value);
189
190#endif
191
192/* LTC3350_USE_ALARMS == 0 */
193
194#if LTC3350_USE_ALARMS
195
197int ltc3350_set_alarm(struct ltc3350_dev *dev, enum ltc3350_enum_alarms alarm,
198 uint16_t alarm_threshold);
200int ltc3350_mute_alarm(struct ltc3350_dev *dev, enum ltc3350_enum_alarms alarm);
202int ltc3350_get_alarm_status_mask(struct ltc3350_dev *dev,
203 uint16_t *alarm_mask);
205int ltc3350_clear_alarm_status_mask(struct ltc3350_dev *dev);
206
207#endif
208
209#endif /* __LTC3350_H__ */
struct ad7616_init_param init_param
Definition ad7616_sdz.c:107
int ltc3350_read_device_data(struct ltc3350_dev *dev, uint8_t base_address, uint16_t *read_data)
Reads data from the device (I2C).
Definition ltc3350.c:106
ltc3350_enum_alarms_mask
Definition ltc3350.h:124
@ LTC3350_VIN_OV_LVL_BIT
Definition ltc3350.h:130
@ LTC3350_CAP_UV_LVL_B_BIT
Definition ltc3350.h:125
@ LTC3350_VOUT_UV_LVL_BIT
Definition ltc3350.h:133
@ LTC3350_VIN_UV_LVL_BIT
Definition ltc3350.h:129
@ LTC3350_VCAP_UV_LVL_BIT
Definition ltc3350.h:131
@ LTC3350_DTEMP_COLD_LVL_BIT
Definition ltc3350.h:137
@ LTC3350_CAP_LO_LVL_BIT
Definition ltc3350.h:140
@ LTC3350_ICHG_UC_LVL_BIT
Definition ltc3350.h:136
@ LTC3350_VCAP_OV_LVL_BIT
Definition ltc3350.h:132
@ LTC3350_GPI_UV_LVL_BIT
Definition ltc3350.h:127
@ LTC3350_GPI_OV_LVL_BIT
Definition ltc3350.h:128
@ LTC3350_VOUT_OV_LVL_BIT
Definition ltc3350.h:134
@ LTC3350_ESR_HI_LVL_BIT
Definition ltc3350.h:139
@ LTC3350_IIN_OC_LVL_BIT
Definition ltc3350.h:135
@ LTC3350_CAP_OV_LVL_BIT
Definition ltc3350.h:126
@ LTC3350_DTEMP_HOT_LVL_BIT
Definition ltc3350.h:138
int ltc3350_write_device_data(struct ltc3350_dev *dev, uint8_t base_address, uint16_t write_data)
Writes data to the device (I2C)
Definition ltc3350.c:134
ltc3350_enum_alarms
Definition ltc3350.h:104
@ LTC3350_VOUT_OV_LVL
Definition ltc3350.h:114
@ LTC3350_DTEMP_COLD_LVL
Definition ltc3350.h:117
@ LTC3350_CAP_LO_LVL
Definition ltc3350.h:120
@ LTC3350_VIN_OV_LVL
Definition ltc3350.h:110
@ LTC3350_GPI_OV_LVL
Definition ltc3350.h:108
@ LTC3350_CAP_OV_LVL
Definition ltc3350.h:106
@ LTC3350_VCAP_OV_LVL
Definition ltc3350.h:112
@ LTC3350_ESR_HI_LVL
Definition ltc3350.h:119
@ LTC3350_VCAP_UV_LVL
Definition ltc3350.h:111
@ LTC3350_VIN_UV_LVL
Definition ltc3350.h:109
@ LTC3350_CAP_UV_LVL
Definition ltc3350.h:105
@ LTC3350_DTEMP_HOT_LVL
Definition ltc3350.h:118
@ LTC3350_ICHG_UC_LVL
Definition ltc3350.h:116
@ LTC3350_GPI_UV_LVL
Definition ltc3350.h:107
@ LTC3350_VOUT_UV_LVL
Definition ltc3350.h:113
@ LTC3350_IIN_OC_LVL
Definition ltc3350.h:115
int ltc3350_remove(struct ltc3350_dev *dev)
Free the resources allocated by ltc3350_init().
Definition ltc3350.c:84
int ltc3350_init(struct ltc3350_dev **device, struct ltc3350_init_param *init_param)
Initializes the communication peripheral and checks if the LTC3350 part is present.
Definition ltc3350.c:56
Header file of I2C Interface.
Header file of utility functions.
#define NO_OS_BIT(x)
Definition no_os_util.h:39
Definition ad9361_util.h:63
LTC3350 Device structure.
Definition ltc3350.h:156
struct no_os_i2c_desc * i2c_desc
Definition ltc3350.h:158
Structure holding the parameters for LTC3350 device initialization.
Definition ltc3350.h:147
struct no_os_i2c_init_param i2c_init
Definition ltc3350.h:149
Structure holding I2C address descriptor.
Definition no_os_i2c.h:89
Structure holding the parameters for I2C initialization.
Definition no_os_i2c.h:52