Add Wire:setPins(sda, scl)

Fixes: https://github.com/espressif/arduino-esp32/issues/3779
This commit is contained in:
me-no-dev
2020-07-19 02:21:15 +03:00
parent b92c58d74b
commit 4d98cea085
2 changed files with 15 additions and 0 deletions

View File

@ -58,6 +58,17 @@ TwoWire::~TwoWire()
}
}
bool TwoWire::setPins(int sdaPin, int sclPin)
{
if(i2c) {
log_e("can not set pins if begin was already called");
return false;
}
sda = sdaPin;
scl = sclPin;
return true;
}
bool TwoWire::begin(int sdaPin, int sclPin, uint32_t frequency)
{
if(sdaPin < 0) { // default param passed