mirror of
https://github.com/arendst/Tasmota.git
synced 2025-04-27 00:07:17 +00:00
allow webcam to reuse and share I2C bus 2
This commit is contained in:
parent
314dbf5e6b
commit
1378d57377
@ -191,7 +191,8 @@ bool WcPinUsed(void) {
|
|||||||
}
|
}
|
||||||
if (!PinUsed(GPIO_WEBCAM_XCLK) || !PinUsed(GPIO_WEBCAM_PCLK) ||
|
if (!PinUsed(GPIO_WEBCAM_XCLK) || !PinUsed(GPIO_WEBCAM_PCLK) ||
|
||||||
!PinUsed(GPIO_WEBCAM_VSYNC) || !PinUsed(GPIO_WEBCAM_HREF) ||
|
!PinUsed(GPIO_WEBCAM_VSYNC) || !PinUsed(GPIO_WEBCAM_HREF) ||
|
||||||
!PinUsed(GPIO_WEBCAM_SIOD) || !PinUsed(GPIO_WEBCAM_SIOC)) {
|
((!PinUsed(GPIO_WEBCAM_SIOD) || !PinUsed(GPIO_WEBCAM_SIOC)) && !TasmotaGlobal.i2c_enabled_2) // preferred option is to reuse and share I2Cbus 2
|
||||||
|
) {
|
||||||
pin_used = false;
|
pin_used = false;
|
||||||
}
|
}
|
||||||
return pin_used;
|
return pin_used;
|
||||||
@ -341,8 +342,14 @@ uint32_t WcSetup(int32_t fsiz) {
|
|||||||
config.pin_pclk = Pin(GPIO_WEBCAM_PCLK); // PCLK_GPIO_NUM;
|
config.pin_pclk = Pin(GPIO_WEBCAM_PCLK); // PCLK_GPIO_NUM;
|
||||||
config.pin_vsync = Pin(GPIO_WEBCAM_VSYNC); // VSYNC_GPIO_NUM;
|
config.pin_vsync = Pin(GPIO_WEBCAM_VSYNC); // VSYNC_GPIO_NUM;
|
||||||
config.pin_href = Pin(GPIO_WEBCAM_HREF); // HREF_GPIO_NUM;
|
config.pin_href = Pin(GPIO_WEBCAM_HREF); // HREF_GPIO_NUM;
|
||||||
config.pin_sscb_sda = Pin(GPIO_WEBCAM_SIOD); // SIOD_GPIO_NUM;
|
config.pin_sccb_sda = Pin(GPIO_WEBCAM_SIOD); // SIOD_GPIO_NUM; - unset to use shared I2C bus 2
|
||||||
config.pin_sscb_scl = Pin(GPIO_WEBCAM_SIOC); // SIOC_GPIO_NUM;
|
config.pin_sccb_scl = Pin(GPIO_WEBCAM_SIOC); // SIOC_GPIO_NUM;
|
||||||
|
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"));
|
||||||
|
}
|
||||||
|
}
|
||||||
config.pin_pwdn = Pin(GPIO_WEBCAM_PWDN); // PWDN_GPIO_NUM;
|
config.pin_pwdn = Pin(GPIO_WEBCAM_PWDN); // PWDN_GPIO_NUM;
|
||||||
config.pin_reset = Pin(GPIO_WEBCAM_RESET); // RESET_GPIO_NUM;
|
config.pin_reset = Pin(GPIO_WEBCAM_RESET); // RESET_GPIO_NUM;
|
||||||
AddLog(LOG_LEVEL_DEBUG, PSTR("CAM: Template pin config"));
|
AddLog(LOG_LEVEL_DEBUG, PSTR("CAM: Template pin config"));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user