46#define MAX_INA220_COUNT 12
47#define INA220_UPDATE_RATE 100
62#define INA220_CONFIG 0x00
70#define INA220_SHUNT_VOLTAGE 0x01
78#define INA220_BUS_VOLTAGE 0x02
87#define INA220_POWER 0x03
96#define INA220_CURRENT 0x04
105#define INA220_CALIBRATION 0x05
114#define INA220_REGISTERS 6
117#define INA220_16V_SCALE_RANGE 0x00
118#define INA220_32V_SCALE_RANGE 0x01
121#define INA220_PGA_GAIN_40MV 0x00
122#define INA220_PGA_GAIN_80MV 0x01
123#define INA220_PGA_GAIN_160MV 0x02
124#define INA220_PGA_GAIN_320MV 0x03
127#define INA220_RES_SAMPLES_9BIT 0x0
128#define INA220_RES_SAMPLES_10BIT 0x1
129#define INA220_RES_SAMPLES_11BIT 0x2
130#define INA220_RES_SAMPLES_12BIT 0x3
132#define INA220_RES_SAMPLES_2SMP 0x9
133#define INA220_RES_SAMPLES_4SMP 0xA
134#define INA220_RES_SAMPLES_8SMP 0xB
135#define INA220_RES_SAMPLES_16SMP 0xC
136#define INA220_RES_SAMPLES_32SMP 0xD
137#define INA220_RES_SAMPLES_64SMP 0xE
138#define INA220_RES_SAMPLES_128SMP 0xF
141#define INA220_MODE_POWER_DOWN 0x0
142#define INA220_MODE_SHUNT_TRIG 0x1
143#define INA220_MODE_BUS_TRIG 0x2
144#define INA220_MODE_SHUNT_BUS_TRIG 0x3
145#define INA220_MODE_ADC_OFF 0x4
146#define INA220_MODE_SHUNT_CONT 0x5
147#define INA220_MODE_BUS_CONT 0x6
148#define INA220_MODE_SHUNT_BUS_CONT 0x7
151#define INA220_CONVERSION_RATE 15
152#define INA220_MAX_DELAY 69
154#define INA220_RSHUNT_DEFAULT 10000
160 uint16_t shunt_adc_resolution:4;
161 uint16_t bus_adc_resolution:4;
163 uint16_t bus_voltage_range:1;
#define INA220_REGISTERS
INA220 Register Count.
Definition ina220.h:114
Bool ina220_calibrate(ina220_data_t *data)
Definition ina220.c:162
uint8_t ina220_config(ina220_data_t *data)
Definition ina220.c:111
Bool ina220_readvalue(ina220_data_t *data, uint8_t reg, uint16_t *read)
Definition ina220.c:136
void vTaskINA220(void *Parameters)
Definition ina220.c:64
void ina220_readall(ina220_data_t *data)
Definition ina220.c:154
TaskHandle_t vTaskINA220_Handle
Definition ina220.c:45
void ina220_init(void)
Definition ina220.c:179
Port layer (includes all portable functions headers)
uint16_t power_lsb
Definition ina220.h:187
uint8_t registers
Definition ina220.h:183
uint16_t calibration_reg
Definition ina220.h:182
uint16_t bus_voltage_lsb
Definition ina220.h:186
uint8_t bus_voltage_shift
Definition ina220.h:185
ina220_config_reg_t config_reg_default
Definition ina220.h:180
uint32_t calibration_factor
Definition ina220.h:181
uint8_t shunt_div
Definition ina220.h:184
uint32_t rshunt
Definition ina220.h:193
const ina220_config_t * config
Definition ina220.h:192
ina220_config_reg_t curr_reg_config
Definition ina220.h:194
sensor_t * sensor
Definition ina220.h:191
uint16_t mode
Definition ina220.h:173
uint16_t shunt_adc_resolution
Definition ina220.h:172
uint16_t cfg_word
Definition ina220.h:176
uint16_t bus_adc_resolution
Definition ina220.h:171
uint16_t pga_gain
Definition ina220.h:170
uint16_t reset
Definition ina220.h:167
uint16_t bus_voltage_range
Definition ina220.h:169
uint16_t reserved
Definition ina220.h:168