adafruit / Adafruit_INA219

INA219 Current Sensor
Other
204 stars 145 forks source link

Error in BADC register bits #14

Closed hansinator closed 6 years ago

hansinator commented 8 years ago

I believe you have got an error in the following register bit defines:

define INA219_CONFIG_BADCRES_9BIT (0x0080) // 9-bit bus res = 0..511

#define INA219_CONFIG_BADCRES_10BIT            (0x0100)  // 10-bit bus res = 0..1023
#define INA219_CONFIG_BADCRES_11BIT            (0x0200)  // 11-bit bus res = 0..2047

According to the datasheet, 9 bit resolution needs to be 0x0000. 10 bit should be 0x0080 and 11 bit should be 0x0100. The value you define for 11 bit (0x0200) actually selects 9 bit resolution.

deanm1278 commented 6 years ago

you're right! fixed!