Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions libraries/Wire/Wire.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ void arduino::MbedI2C::begin() {
master = new mbed::I2C(_sda, _scl);
}

void arduino::MbedI2C::begin(int sda, int scl) {
_sda = digitalPinToPinName(sda);
_scl = digitalPinToPinName(scl);
master = new mbed::I2C(_sda, _scl);
}

void arduino::MbedI2C::begin(uint8_t slaveAddr) {
#ifdef DEVICE_I2CSLAVE
slave = new mbed::I2CSlave((PinName)_sda, (PinName)_scl);
Expand Down
1 change: 1 addition & 0 deletions libraries/Wire/Wire.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class MbedI2C : public HardwareI2C
MbedI2C(int sda, int scl);
MbedI2C(PinName sda, PinName scl);
virtual void begin();
virtual void begin(int sda, int scl);
#ifndef DEVICE_I2CSLAVE
virtual void __attribute__ ((error("I2C Slave mode is not supported"))) begin(uint8_t address);
#else
Expand Down