File tree Expand file tree Collapse file tree 3 files changed +5
-4
lines changed
libraries/Nicla_System/src Expand file tree Collapse file tree 3 files changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ class BQ25120A
26
26
BQ25120A () {};
27
27
28
28
uint8_t getStatus ();
29
- void writeByte (uint8_t address, uint8_t subAddress, uint8_t data);
29
+ bool writeByte (uint8_t address, uint8_t subAddress, uint8_t data);
30
30
uint8_t readByte (uint8_t address, uint8_t subAddress);
31
31
32
32
};
Original file line number Diff line number Diff line change @@ -99,7 +99,7 @@ bool nicla::enterShipMode()
99
99
100
100
uint8_t status_reg = _pmic.getStatus ();
101
101
status_reg |= 0x20 ;
102
- _pmic.writeByte (BQ25120A_ADDRESS, BQ25120A_STATUS, status_reg);
102
+ return _pmic.writeByte (BQ25120A_ADDRESS, BQ25120A_STATUS, status_reg);
103
103
}
104
104
105
105
uint8_t nicla::readLDOreg ()
Original file line number Diff line number Diff line change @@ -12,16 +12,17 @@ uint8_t BQ25120A::getStatus()
12
12
return c;
13
13
}
14
14
15
- void BQ25120A::writeByte (uint8_t address, uint8_t subAddress, uint8_t data)
15
+ bool BQ25120A::writeByte (uint8_t address, uint8_t subAddress, uint8_t data)
16
16
{
17
17
cd = 1 ;
18
18
nicla::i2c_mutex.lock ();
19
19
Wire1.beginTransmission (address);
20
20
Wire1.write (subAddress);
21
21
Wire1.write (data);
22
- Wire1.endTransmission ();
22
+ uint8_t result = Wire1.endTransmission ();
23
23
nicla::i2c_mutex.unlock ();
24
24
cd = 0 ;
25
+ return result == 0 ;
25
26
}
26
27
27
28
uint8_t BQ25120A::readByte (uint8_t address, uint8_t subAddress)
You can’t perform that action at this time.
0 commit comments