21 #ifndef SELKIELoggerI2C_INA219
22 #define SELKIELoggerI2C_INA219
43 #define INA219_REG_CONFIG 0x00
46 #define INA219_REG_SHUNT 0x01
49 #define INA219_REG_BUS 0x02
52 #define INA219_REG_POWER 0x03
55 #define INA219_REG_CURRENT 0x04
58 #define INA219_REG_CALIBRATION 0x05
78 #define INA219_CONFIG_DEF 0x3DDF
83 #define INA219_CONFIG_RESET 0x8000
92 #define I2C_INA219_DEFAULTS \
93 { .scale = 1.0, .offset = 0.0, .min = -INFINITY, .max = INFINITY }
float i2c_ina219_read_shuntVoltage(const int busHandle, const int devAddr, const void *opts)
Get voltage across the shunt resistor in millivolts.
bool i2c_ina219_configure(const int busHandle, const int devAddr)
Send configuration command to the specified device.
float i2c_ina219_read_current(const int busHandle, const int devAddr, const void *opts)
Get current flow through shunt resistor in amps.
float i2c_ina219_read_busVoltage(const int busHandle, const int devAddr, const void *opts)
Get bus voltage (at V- terminal) in volts.
uint16_t i2c_ina219_read_configuration(const int busHandle, const int devAddr)
Read configuration from device.
float i2c_ina219_read_power(const int busHandle, const int devAddr, const void *opts)
Get power consumption in watts.
float offset
Add this amount to received value.
float min
If not NaN, smallest value considered valid.
float max
If not NaN, largest value considered valid.
float scale
Scale received value by this quantity.