Kaynağa Gözat

[bsp][lpc55sxx]update: drv_soft_i2c, fix macro (#7506)

Co-authored-by: Man, Jianting (Meco) <920369182@qq.com>
Shicheng Chu 2 yıl önce
ebeveyn
işleme
5e188b8ca8

+ 2 - 2
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 */

+ 5 - 5
bsp/lpc55sxx/Libraries/drivers/drv_soft_i2c.c

@@ -11,13 +11,13 @@
 #include <board.h>
 #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 <drv_log.h>
 
-#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 */

+ 12 - 12
bsp/lpc55sxx/Libraries/drivers/drv_soft_i2c.h

@@ -16,16 +16,6 @@
 #include <rtdevice.h>
 #include <drv_pin.h>
 
-/* 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);
 

+ 3 - 3
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