update Kconfig to remove the need of some of the ifdef stuff in the sccb.c file and show the setting only when hardware is selected

This commit is contained in:
apiesse
2020-03-06 09:20:47 +01:00
parent a6e2ac208e
commit c38999847b
2 changed files with 11 additions and 13 deletions

15
Kconfig
View File

@ -21,16 +21,21 @@ config OV3660_SUPPORT
Enable this option if you want to use the OV3360. Enable this option if you want to use the OV3360.
Disable this option to safe memory. Disable this option to safe memory.
choice SCCB_HARDWARE_I2C config SCCB_HARDWARE_I2C
bool "Use hardware I2C0/I2C1 for SCCB" bool "Use hardware I2C for SCCB"
default SCCB_HARDWARE_I2C1 default y
help help
Enable this option if you want to use hardware I2C to control the camera. Enable this option if you want to use hardware I2C to control the camera.
Disable this option to use software I2C. Disable this option to use software I2C.
config SCCB_HARDWARE_I2C0 choice SCCB_HARDWARE_I2C_PORT
bool "I2C peripheral to use for SCCB"
depends on SCCB_HARDWARE_I2C
default SCCB_HARDWARE_I2C1
config SCCB_HARDWARE_I2C_PORT0
bool "I2C0" bool "I2C0"
config SCCB_HARDWARE_I2C1 config SCCB_HARDWARE_I2C_PORT1
bool "I2C1" bool "I2C1"
endchoice endchoice

View File

@ -19,13 +19,6 @@
static const char* TAG = "sccb"; static const char* TAG = "sccb";
#endif #endif
#ifdef CONFIG_SCCB_HARDWARE_I2C0
#define CONFIG_SCCB_HARDWARE_I2C
#endif
#ifdef CONFIG_SCCB_HARDWARE_I2C1
#define CONFIG_SCCB_HARDWARE_I2C
#endif
#define LITTLETOBIG(x) ((x<<8)|(x>>8)) #define LITTLETOBIG(x) ((x<<8)|(x>>8))
#ifdef CONFIG_SCCB_HARDWARE_I2C #ifdef CONFIG_SCCB_HARDWARE_I2C
@ -38,7 +31,7 @@ static const char* TAG = "sccb";
#define ACK_CHECK_DIS 0x0 /*!< I2C master will not check ack from slave */ #define ACK_CHECK_DIS 0x0 /*!< I2C master will not check ack from slave */
#define ACK_VAL 0x0 /*!< I2C ack value */ #define ACK_VAL 0x0 /*!< I2C ack value */
#define NACK_VAL 0x1 /*!< I2C nack value */ #define NACK_VAL 0x1 /*!< I2C nack value */
#if CONFIG_SCCB_HARDWARE_I2C1 #if CONFIG_SCCB_HARDWARE_I2C_PORT1
const int SCCB_I2C_PORT = 1; const int SCCB_I2C_PORT = 1;
#else #else
const int SCCB_I2C_PORT = 0; const int SCCB_I2C_PORT = 0;