Skip to content

Commit 46c6c45

Browse files
authored
Merge pull request #7 from caternuson/iss5
Move Chip Revision Register Check
2 parents 08bdc83 + 7326788 commit 46c6c45

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

Adafruit_NAU7802.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,14 @@ bool Adafruit_NAU7802::begin(TwoWire *theWire) {
5050
return false;
5151
}
5252

53+
// define the main power control register
54+
_pu_ctrl_reg = new Adafruit_I2CRegister(i2c_dev, NAU7802_PU_CTRL);
55+
56+
if (!reset())
57+
return false;
58+
if (!enable(true))
59+
return false;
60+
5361
/* Check for NAU7802 revision register (0x1F), low nibble should be 0xF. */
5462
Adafruit_I2CRegister rev_reg =
5563
Adafruit_I2CRegister(i2c_dev, NAU7802_REVISION_ID);
@@ -58,13 +66,6 @@ bool Adafruit_NAU7802::begin(TwoWire *theWire) {
5866
return false;
5967
}
6068

61-
// define the main power control register
62-
_pu_ctrl_reg = new Adafruit_I2CRegister(i2c_dev, NAU7802_PU_CTRL);
63-
64-
if (!reset())
65-
return false;
66-
if (!enable(true))
67-
return false;
6869
if (!setLDO(NAU7802_3V0))
6970
return false;
7071
if (!setGain(NAU7802_GAIN_128))

0 commit comments

Comments
 (0)