diff --git a/bsp/lpc55sxx/Libraries/drivers/drv_i2c.c b/bsp/lpc55sxx/Libraries/drivers/drv_i2c.c index 4359e2b0773..2a2e314024b 100644 --- a/bsp/lpc55sxx/Libraries/drivers/drv_i2c.c +++ b/bsp/lpc55sxx/Libraries/drivers/drv_i2c.c @@ -17,7 +17,7 @@ #include "fsl_i2c.h" #include "fsl_i2c_dma.h" -#ifdef RT_USING_I2C +#ifdef BSP_USING_I2C enum { @@ -184,4 +184,4 @@ int rt_hw_i2c_init(void) } INIT_DEVICE_EXPORT(rt_hw_i2c_init); -#endif /* RT_USING_I2C */ +#endif /* BSP_USING_I2C */ diff --git a/bsp/lpc55sxx/Libraries/drivers/drv_soft_i2c.c b/bsp/lpc55sxx/Libraries/drivers/drv_soft_i2c.c index 2feeeb2269c..fdd04610906 100644 --- a/bsp/lpc55sxx/Libraries/drivers/drv_soft_i2c.c +++ b/bsp/lpc55sxx/Libraries/drivers/drv_soft_i2c.c @@ -11,13 +11,13 @@ #include #include "drv_soft_i2c.h" -#ifdef RT_USING_I2C +#ifdef BSP_USING_SOFT_I2C -#define LOG_TAG "drv.i2c" +#define LOG_TAG "drv.soft_i2c" #include -#if !defined(BSP_USING_I2C1) && !defined(BSP_USING_I2C2) && !defined(BSP_USING_I2C3) && !defined(BSP_USING_I2C4) -#error "Please define at least one BSP_USING_I2Cx" +#if !defined(BSP_USING_SOFT_I2C1) && !defined(BSP_USING_SOFT_I2C2) +#error "Please define at least one BSP_USING_SOFT_I2Cx" /* this driver can be disabled at menuconfig -> RT-Thread Components -> Device Drivers */ #endif @@ -210,4 +210,4 @@ int rt_hw_i2c_init(void) } INIT_BOARD_EXPORT(rt_hw_i2c_init); -#endif /* RT_USING_I2C */ +#endif /* BSP_USING_SOFT_I2C */ diff --git a/bsp/lpc55sxx/Libraries/drivers/drv_soft_i2c.h b/bsp/lpc55sxx/Libraries/drivers/drv_soft_i2c.h index f3c6677ae00..f3b52cd128f 100644 --- a/bsp/lpc55sxx/Libraries/drivers/drv_soft_i2c.h +++ b/bsp/lpc55sxx/Libraries/drivers/drv_soft_i2c.h @@ -16,16 +16,6 @@ #include #include -/* Notice: PIO0_15(scl) --> 22; PIO1_8(sda) --> 24 */ - -#define BSP_SOFT_I2C1_SCL_PIN GET_PINS(0,15) -#define BSP_SOFT_I2C1_SCL_PIN GET_PINS(1,8) - -/* Notice: PIO0_18(scl) --> 56; PIO1_10(sda) --> 40 */ - -#define BSP_SOFT_I2C2_SCL_PIN GET_PINS(0,18) -#define BSP_SOFT_I2C2_SDA_PIN GET_PINS(1,10) - /* lpc55s69 config class */ struct lpc55s69_soft_i2c_config { @@ -41,22 +31,32 @@ struct lpc55s69_i2c }; #ifdef BSP_USING_SOFT_I2C1 +/* Notice: PIO0_15(scl) --> 22; PIO1_8(sda) --> 24 */ + +#define BSP_SOFT_I2C1_SCL_PIN GET_PINS(0,15) +#define BSP_SOFT_I2C1_SDA_PIN GET_PINS(1,8) + #define SOFT_I2C1_BUS_CONFIG \ { \ .scl = BSP_SOFT_I2C1_SCL_PIN, \ .sda = BSP_SOFT_I2C1_SDA_PIN, \ .bus_name = "i2c1", \ } -#endif +#endif /*BSP_USING_SOFT_I2C1*/ #ifdef BSP_USING_SOFT_I2C2 +/* Notice: PIO0_18(scl) --> 56; PIO1_10(sda) --> 40 */ + +#define BSP_SOFT_I2C2_SCL_PIN GET_PINS(0,18) +#define BSP_SOFT_I2C2_SDA_PIN GET_PINS(1,10) + #define SOFT_I2C2_BUS_CONFIG \ { \ .scl = BSP_SOFT_I2C2_SCL_PIN, \ .sda = BSP_SOFT_I2C2_SDA_PIN, \ .bus_name = "i2c2", \ } -#endif /*BSP_USING_I2C2*/ +#endif /*BSP_USING_SOFT_I2C2*/ int rt_hw_i2c_init(void); diff --git a/bsp/lpc55sxx/lpc55s69_nxp_evk/board/Kconfig b/bsp/lpc55sxx/lpc55s69_nxp_evk/board/Kconfig index 1ac210313fe..760efb8d792 100644 --- a/bsp/lpc55sxx/lpc55s69_nxp_evk/board/Kconfig +++ b/bsp/lpc55sxx/lpc55s69_nxp_evk/board/Kconfig @@ -85,7 +85,7 @@ menu "On-chip Peripheral Drivers" if BSP_USING_I2C config BSP_USING_I2C1 bool "Enable Flexcomm1 I2C" - default y + default n if BSP_USING_I2C1 choice @@ -102,7 +102,7 @@ menu "On-chip Peripheral Drivers" config BSP_USING_I2C4 bool "Enable Flexcomm4 I2C" - default y + default n if BSP_USING_I2C4 choice prompt "Select I2C4 badurate" @@ -118,7 +118,7 @@ menu "On-chip Peripheral Drivers" endif menuconfig BSP_USING_SOFT_I2C - bool "Enable I2C Bus" + bool "Enable software I2C bus" select RT_USING_I2C select RT_USING_I2C_BITOPS select RT_USING_PIN