Skip to content

Commit

Permalink
https://github.com/adafruit/Adafruit_INA228/issues/7
Browse files Browse the repository at this point in the history
  • Loading branch information
ladyada committed May 21, 2024
1 parent 3287142 commit 492d438
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions Adafruit_INA228.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ Adafruit_INA228::Adafruit_INA228(void) {}
* The Wire object to be used for I2C connections.
* @return True if initialization was successful, otherwise false.
*/
bool Adafruit_INA228::begin(uint8_t i2c_address, TwoWire *theWire) {
bool Adafruit_INA228::begin(uint8_t i2c_address, TwoWire *theWire, bool skipReset) {
i2c_dev = new Adafruit_I2CDevice(i2c_address, theWire);

if (!i2c_dev->begin()) {
Expand All @@ -74,8 +74,10 @@ bool Adafruit_INA228::begin(uint8_t i2c_address, TwoWire *theWire) {
Diag_Alert =
new Adafruit_I2CRegister(i2c_dev, INA228_REG_DIAGALRT, 2, MSBFIRST);

reset();
delay(2); // delay 2ms to give time for first measurement to finish
if (!skipReset) {
reset();
delay(2); // delay 2ms to give time for first measurement to finish
}
return true;
}
/**************************************************************************/
Expand Down
2 changes: 1 addition & 1 deletion Adafruit_INA228.h
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ class Adafruit_INA228 {
public:
Adafruit_INA228();
bool begin(uint8_t i2c_addr = INA228_I2CADDR_DEFAULT,
TwoWire *theWire = &Wire);
TwoWire *theWire = &Wire, bool skipReset = false);
void reset(void);

void setShunt(float shunt_res = 0.1, float max_current = 3.2);
Expand Down

0 comments on commit 492d438

Please sign in to comment.