Skip to content

Commit 7bae1fe

Browse files
committed
Crash in Arduino Wire.begin
1 parent dc1df78 commit 7bae1fe

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

Diff for: src/DriverPins.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ struct PinsI2C : public I2CConfig {
182182
this->sda = sda;
183183
this->port = 0;
184184
this->frequency = frequency;
185-
this->p_wire = &wire;
185+
this->p_wire = wire;
186186
this->set_active = active;
187187
this->address = address;
188188
}

Diff for: src/Platforms/API_I2C_Arduino.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,11 @@
99

1010

1111
error_t i2c_bus_create(struct I2CConfig *config) {
12+
assert(config!=nullptr);
1213
I2CConfig &pins = *config;
1314
TwoWire *p_wire = (TwoWire*) pins.p_wire;
15+
assert(p_wire != nullptr);
16+
1417
// if no pins are defined, just call begin
1518
if (pins.scl == -1 || pins.sda == -1) {
1619
AD_LOGI("setting up I2C w/o pins");

0 commit comments

Comments
 (0)