feat: Allow users to configure new/legacy I2C driver for SCCB hardware

This commit is contained in:
William Emfinger
2025-05-20 11:38:15 -05:00
parent 4467667b71
commit 0fe33c0346
2 changed files with 15 additions and 1 deletions

View File

@ -85,7 +85,7 @@ if(IDF_TARGET STREQUAL "esp32" OR IDF_TARGET STREQUAL "esp32s2" OR IDF_TARGET ST
# include the SCCB I2C driver # include the SCCB I2C driver
# this uses either the legacy I2C API or the newwer version from IDF v5.4 # this uses either the legacy I2C API or the newwer version from IDF v5.4
# as this features a method to obtain the I2C driver from a port number # as this features a method to obtain the I2C driver from a port number
if (idf_version VERSION_GREATER_EQUAL "5.4") if (idf_version VERSION_GREATER_EQUAL "5.4" AND NOT CONFIG_SCCB_HARDWARE_I2C_DRIVER_LEGACY)
list(APPEND srcs driver/sccb-ng.c) list(APPEND srcs driver/sccb-ng.c)
else() else()
list(APPEND srcs driver/sccb.c) list(APPEND srcs driver/sccb.c)

14
Kconfig
View File

@ -124,6 +124,20 @@ menu "Camera configuration"
Enable this option if you want to use the MEGA CCM. Enable this option if you want to use the MEGA CCM.
Disable this option to save memory. Disable this option to save memory.
choice SCCB_HARDWARE_I2C_DRIVER_SELECTION
prompt "I2C driver selection for SCCB"
default SCCB_HARDWARE_I2C_DRIVER_NEW
help
Select the I2C driver to use for SCCB communication.
NOTE: new driver is only supported for ESP-IDF >= 5.4.
config SCCB_HARDWARE_I2C_DRIVER_LEGACY
bool "Legacy I2C driver"
config SCCB_HARDWARE_I2C_DRIVER_NEW
bool "New I2C driver"
endchoice
choice SCCB_HARDWARE_I2C_PORT choice SCCB_HARDWARE_I2C_PORT
bool "I2C peripheral to use for SCCB" bool "I2C peripheral to use for SCCB"
default SCCB_HARDWARE_I2C_PORT1 default SCCB_HARDWARE_I2C_PORT1