mirror of https://github.com/arendst/Tasmota.git
Enable I2c on webcam
This commit is contained in:
parent
0bf27e70fe
commit
7cad4f95b6
|
@ -205,7 +205,7 @@
|
|||
#define USE_SPI
|
||||
#define USE_SDCARD
|
||||
|
||||
#undef USE_I2C
|
||||
#define USE_I2C
|
||||
#undef USE_HOME_ASSISTANT
|
||||
#define USE_TASMOTA_DISCOVERY // Enable Tasmota Discovery support (+2k code)
|
||||
#undef USE_DOMOTICZ
|
||||
|
|
|
@ -2221,11 +2221,19 @@ void GpioInit(void)
|
|||
TasmotaGlobal.i2c_enabled = (PinUsed(GPIO_I2C_SCL) && PinUsed(GPIO_I2C_SDA));
|
||||
if (TasmotaGlobal.i2c_enabled) {
|
||||
TasmotaGlobal.i2c_enabled = I2cBegin(Pin(GPIO_I2C_SDA), Pin(GPIO_I2C_SCL));
|
||||
#ifdef ESP32
|
||||
if (TasmotaGlobal.i2c_enabled) {
|
||||
AddLog(LOG_LEVEL_DEBUG, PSTR("I2C: Pins bus1 SCL %d, SDA %d"), Pin(GPIO_I2C_SCL), Pin(GPIO_I2C_SDA));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#ifdef ESP32
|
||||
TasmotaGlobal.i2c_enabled_2 = (PinUsed(GPIO_I2C_SCL, 1) && PinUsed(GPIO_I2C_SDA, 1));
|
||||
if (TasmotaGlobal.i2c_enabled_2) {
|
||||
TasmotaGlobal.i2c_enabled_2 = I2c2Begin(Pin(GPIO_I2C_SDA, 1), Pin(GPIO_I2C_SCL, 1));
|
||||
if (TasmotaGlobal.i2c_enabled_2) {
|
||||
AddLog(LOG_LEVEL_DEBUG, PSTR("I2C: Pins bus2 SCL %d, SDA %d"), Pin(GPIO_I2C_SCL, 1), Pin(GPIO_I2C_SDA, 1));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif // USE_I2C
|
||||
|
|
|
@ -347,7 +347,7 @@ uint32_t WcSetup(int32_t fsiz) {
|
|||
if(TasmotaGlobal.i2c_enabled_2){ // configure SIOD and SIOC as SDA,2 and SCL,2
|
||||
config.sccb_i2c_port = 1; // reuse initialized bus 2, can be shared now
|
||||
if(config.pin_sccb_sda < 0){ // GPIO_WEBCAM_SIOD must not be set to really make it happen
|
||||
AddLog(LOG_LEVEL_INFO, PSTR("CAM: use I2C bus 2"));
|
||||
AddLog(LOG_LEVEL_INFO, PSTR("CAM: Use I2C bus2"));
|
||||
}
|
||||
}
|
||||
config.pin_pwdn = Pin(GPIO_WEBCAM_PWDN); // PWDN_GPIO_NUM;
|
||||
|
|
Loading…
Reference in New Issue