Skip to content

Commit e66adea

Browse files
committed
[VIDOR][PMIC] Check return value of Wire.startTransmission
1 parent bc51bc5 commit e66adea

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

variants/mkrvidor/variant.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,10 @@ static inline void enable_battery_charging() {
177177
pinPeripheral(PIN_WIRE_SDA, g_APinDescription[PIN_WIRE_SDA].ulPinType);
178178
pinPeripheral(PIN_WIRE_SCL, g_APinDescription[PIN_WIRE_SCL].ulPinType);
179179

180-
PERIPH_WIRE.startTransmissionWIRE( PMIC_ADDRESS, WIRE_WRITE_FLAG );
180+
bool ret = PERIPH_WIRE.startTransmissionWIRE( PMIC_ADDRESS, WIRE_WRITE_FLAG );
181+
if (!ret) {
182+
return;
183+
}
181184
PERIPH_WIRE.sendDataMasterWIRE(PMIC_REG01);
182185
PERIPH_WIRE.sendDataMasterWIRE(0x1B); // Charge Battery + Minimum System Voltage 3.5V
183186
PERIPH_WIRE.prepareCommandBitsWire(WIRE_MASTER_ACT_STOP);

0 commit comments

Comments
 (0)