Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bsp][lpc55sxx]update: drv_soft_i2c #7506

Merged
merged 2 commits into from
May 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions bsp/lpc55sxx/Libraries/drivers/drv_i2c.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#include "fsl_i2c.h"
#include "fsl_i2c_dma.h"

#ifdef RT_USING_I2C
#ifdef BSP_USING_I2C

enum
{
Expand Down Expand Up @@ -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 */
10 changes: 5 additions & 5 deletions bsp/lpc55sxx/Libraries/drivers/drv_soft_i2c.c
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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 */
24 changes: 12 additions & 12 deletions bsp/lpc55sxx/Libraries/drivers/drv_soft_i2c.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand All @@ -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);

Expand Down
6 changes: 3 additions & 3 deletions bsp/lpc55sxx/lpc55s69_nxp_evk/board/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"
Expand All @@ -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
Expand Down