We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 512e67b commit 7bf1e36Copy full SHA for 7bf1e36
libraries/Wire/src/Wire.cpp
@@ -8,12 +8,16 @@
8
arduino::MbedI2C::MbedI2C(int sda, int scl) : _sda(sda), _scl(scl), usedTxBuffer(0) {}
9
10
void arduino::MbedI2C::begin() {
11
- master = new mbed::I2C((PinName)_sda, (PinName)_scl);
+ if(!master){
12
+ master = new mbed::I2C((PinName)_sda, (PinName)_scl);
13
+ }
14
}
15
16
void arduino::MbedI2C::begin(uint8_t slaveAddr) {
17
#ifdef DEVICE_I2CSLAVE
- slave = new mbed::I2CSlave((PinName)_sda, (PinName)_scl);
18
+ if(!slave){
19
+ slave = new mbed::I2CSlave((PinName)_sda, (PinName)_scl);
20
21
slave->address(slaveAddr << 1);
22
slave_th.start(mbed::callback(this, &arduino::MbedI2C::receiveThd));
23
#endif
0 commit comments