I2C: allow any GPIO on 8266 (experimental)

as it turns out, also on 8266 any pin can be assigned to I2C. Only SPI pins are fixed, and GPIO16 should not be used as it does not support interrupts.
This commit is contained in:
Frank
2023-01-15 22:13:46 +01:00
parent 12cd6a2738
commit a320068bbe
4 changed files with 17 additions and 21 deletions

View File

@@ -532,10 +532,10 @@ void handleSettingsSet(AsyncWebServerRequest *request, byte subPage)
}
#ifdef ESP8266
// cannot change pins on ESP8266
// cannot change pins on ESP8266 --> actually we can
// WLEDMM: HW_PIN_xx could be set to -1 --> use pins as defined by the framework! SDA = 4, SCL = 5
if (hw_sda_pin >= 0 && hw_sda_pin != 4) hw_sda_pin = 4;
if (hw_scl_pin >= 0 && hw_scl_pin != 5) hw_scl_pin = 5;
//if (hw_sda_pin >= 0 && hw_sda_pin != 4) hw_sda_pin = 4;
//if (hw_scl_pin >= 0 && hw_scl_pin != 5) hw_scl_pin = 5;
#endif
PinManagerPinType i2c[2] = { { hw_sda_pin, true }, { hw_scl_pin, true } };
if (hw_sda_pin >= 0 && hw_scl_pin >= 0 && pinManager.allocateMultiplePins(i2c, 2, PinOwner::HW_I2C)) {