Skip to content

Commit

Permalink
Expand comment to make it clearer that "A0" and "A1" refer to the INA219
Browse files Browse the repository at this point in the history
  • Loading branch information
SkUrRiEr committed Feb 11, 2022
1 parent 20ede7d commit 41ce68a
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions Adafruit_INA219.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,18 @@
#include <Adafruit_I2CDevice.h>
#include <Wire.h>

/** I2C address calculations 0 == GND, 1 == V+ **/
/* 0x1000ABCD
* A and B are controlled by A1: GND = 00, V+ = 01, SDA = 10, SCL = 11
* C and D are controlled by A0: GND = 00, V+ = 01, SDA = 10, SCL = 11
* SDA and SCL options aren't implemented. */
/** calculated I2C address: 0 = GND, 1 = V+ **/
/* The address is controlled by the A0 and A1 inputs on the INA219:
*
* Calculated address: b100ABCD
* A0 controls C and D: GND = 00, V+ = 01, SDA = 10, SCL = 11
* A1 controls A and B: GND = 00, V+ = 01, SDA = 10, SCL = 11
*
* E.g. if A0 is tied to ground and A1 is tied to V+,
* the resulting address is b1000100 = 0x44
*
* SDA and SCL options aren't implemented.
*/
#define INA219_CALC_ADDRESS(INA_ADDR0, INA_ADDR1) \
(0x40 | (INA_ADDR0 != 0 ? 0x01 : 0x00) | (INA_ADDR1 != 0 ? 0x04 : 0x00))

Expand Down

0 comments on commit 41ce68a

Please sign in to comment.