[bsp][lpc55sxx]update: drv_soft_i2c, fix macro (#7506)
Co-authored-by: Man, Jianting (Meco) <920369182@qq.com>
This commit is contained in:
parent
0e4a3142a8
commit
5e188b8ca8
|
@ -17,7 +17,7 @@
|
||||||
#include "fsl_i2c.h"
|
#include "fsl_i2c.h"
|
||||||
#include "fsl_i2c_dma.h"
|
#include "fsl_i2c_dma.h"
|
||||||
|
|
||||||
#ifdef RT_USING_I2C
|
#ifdef BSP_USING_I2C
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
|
@ -184,4 +184,4 @@ int rt_hw_i2c_init(void)
|
||||||
}
|
}
|
||||||
INIT_DEVICE_EXPORT(rt_hw_i2c_init);
|
INIT_DEVICE_EXPORT(rt_hw_i2c_init);
|
||||||
|
|
||||||
#endif /* RT_USING_I2C */
|
#endif /* BSP_USING_I2C */
|
||||||
|
|
|
@ -11,13 +11,13 @@
|
||||||
#include <board.h>
|
#include <board.h>
|
||||||
#include "drv_soft_i2c.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>
|
#include <drv_log.h>
|
||||||
|
|
||||||
#if !defined(BSP_USING_I2C1) && !defined(BSP_USING_I2C2) && !defined(BSP_USING_I2C3) && !defined(BSP_USING_I2C4)
|
#if !defined(BSP_USING_SOFT_I2C1) && !defined(BSP_USING_SOFT_I2C2)
|
||||||
#error "Please define at least one BSP_USING_I2Cx"
|
#error "Please define at least one BSP_USING_SOFT_I2Cx"
|
||||||
/* this driver can be disabled at menuconfig -> RT-Thread Components -> Device Drivers */
|
/* this driver can be disabled at menuconfig -> RT-Thread Components -> Device Drivers */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -210,4 +210,4 @@ int rt_hw_i2c_init(void)
|
||||||
}
|
}
|
||||||
INIT_BOARD_EXPORT(rt_hw_i2c_init);
|
INIT_BOARD_EXPORT(rt_hw_i2c_init);
|
||||||
|
|
||||||
#endif /* RT_USING_I2C */
|
#endif /* BSP_USING_SOFT_I2C */
|
||||||
|
|
|
@ -16,16 +16,6 @@
|
||||||
#include <rtdevice.h>
|
#include <rtdevice.h>
|
||||||
#include <drv_pin.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 */
|
/* lpc55s69 config class */
|
||||||
struct lpc55s69_soft_i2c_config
|
struct lpc55s69_soft_i2c_config
|
||||||
{
|
{
|
||||||
|
@ -41,22 +31,32 @@ struct lpc55s69_i2c
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef BSP_USING_SOFT_I2C1
|
#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 \
|
#define SOFT_I2C1_BUS_CONFIG \
|
||||||
{ \
|
{ \
|
||||||
.scl = BSP_SOFT_I2C1_SCL_PIN, \
|
.scl = BSP_SOFT_I2C1_SCL_PIN, \
|
||||||
.sda = BSP_SOFT_I2C1_SDA_PIN, \
|
.sda = BSP_SOFT_I2C1_SDA_PIN, \
|
||||||
.bus_name = "i2c1", \
|
.bus_name = "i2c1", \
|
||||||
}
|
}
|
||||||
#endif
|
#endif /*BSP_USING_SOFT_I2C1*/
|
||||||
|
|
||||||
#ifdef BSP_USING_SOFT_I2C2
|
#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 \
|
#define SOFT_I2C2_BUS_CONFIG \
|
||||||
{ \
|
{ \
|
||||||
.scl = BSP_SOFT_I2C2_SCL_PIN, \
|
.scl = BSP_SOFT_I2C2_SCL_PIN, \
|
||||||
.sda = BSP_SOFT_I2C2_SDA_PIN, \
|
.sda = BSP_SOFT_I2C2_SDA_PIN, \
|
||||||
.bus_name = "i2c2", \
|
.bus_name = "i2c2", \
|
||||||
}
|
}
|
||||||
#endif /*BSP_USING_I2C2*/
|
#endif /*BSP_USING_SOFT_I2C2*/
|
||||||
|
|
||||||
int rt_hw_i2c_init(void);
|
int rt_hw_i2c_init(void);
|
||||||
|
|
||||||
|
|
|
@ -85,7 +85,7 @@ menu "On-chip Peripheral Drivers"
|
||||||
if BSP_USING_I2C
|
if BSP_USING_I2C
|
||||||
config BSP_USING_I2C1
|
config BSP_USING_I2C1
|
||||||
bool "Enable Flexcomm1 I2C"
|
bool "Enable Flexcomm1 I2C"
|
||||||
default y
|
default n
|
||||||
|
|
||||||
if BSP_USING_I2C1
|
if BSP_USING_I2C1
|
||||||
choice
|
choice
|
||||||
|
@ -102,7 +102,7 @@ menu "On-chip Peripheral Drivers"
|
||||||
|
|
||||||
config BSP_USING_I2C4
|
config BSP_USING_I2C4
|
||||||
bool "Enable Flexcomm4 I2C"
|
bool "Enable Flexcomm4 I2C"
|
||||||
default y
|
default n
|
||||||
if BSP_USING_I2C4
|
if BSP_USING_I2C4
|
||||||
choice
|
choice
|
||||||
prompt "Select I2C4 badurate"
|
prompt "Select I2C4 badurate"
|
||||||
|
@ -118,7 +118,7 @@ menu "On-chip Peripheral Drivers"
|
||||||
endif
|
endif
|
||||||
|
|
||||||
menuconfig BSP_USING_SOFT_I2C
|
menuconfig BSP_USING_SOFT_I2C
|
||||||
bool "Enable I2C Bus"
|
bool "Enable software I2C bus"
|
||||||
select RT_USING_I2C
|
select RT_USING_I2C
|
||||||
select RT_USING_I2C_BITOPS
|
select RT_USING_I2C_BITOPS
|
||||||
select RT_USING_PIN
|
select RT_USING_PIN
|
||||||
|
|
Loading…
Reference in New Issue