[bsp][hc32]添加HC32F460系列模拟I2C外设驱动支持

This commit is contained in:
xiaoxiaolisunny 2022-06-12 22:46:21 +08:00 committed by guo
parent f6ce2eb897
commit 65669de0e3
2 changed files with 45 additions and 10 deletions

View File

@ -89,6 +89,41 @@ menu "On-chip Peripheral Drivers"
default n default n
endif endif
menuconfig BSP_USING_RTC
bool "Enable RTC"
select RT_USING_RTC
default n
if BSP_USING_RTC
choice
prompt "Select clock source"
default BSP_RTC_USING_LRC
config BSP_RTC_USING_XTAL32
bool "RTC USING XTAL32"
config BSP_RTC_USING_LRC
bool "RTC USING LRC"
endchoice
endif
menuconfig BSP_USING_I2C2
bool "Enable I2C2 BUS (software simulation)"
default n
select RT_USING_I2C
select RT_USING_I2C_BITOPS
select RT_USING_PIN
if BSP_USING_I2C2
config BSP_I2C2_SCL_PIN
int "i2c2 scl pin number"
range 1 100
default 48
config BSP_I2C2_SDA_PIN
int "I2C2 sda pin number"
range 1 100
default 49
endif
endmenu endmenu
menu "Board extended module Drivers" menu "Board extended module Drivers"

View File

@ -52,8 +52,8 @@ struct hc32_i2c
#ifdef BSP_USING_I2C2 #ifdef BSP_USING_I2C2
#define I2C2_BUS_CONFIG \ #define I2C2_BUS_CONFIG \
{ \ { \
.scl = BSP_I2C2_SCL_PIN, \ .scl_pin = BSP_I2C2_SCL_PIN, \
.sda = BSP_I2C2_SDA_PIN, \ .sda_pin = BSP_I2C2_SDA_PIN, \
.bus_name = "i2c2", \ .bus_name = "i2c2", \
} }
#endif #endif
@ -61,8 +61,8 @@ struct hc32_i2c
#ifdef BSP_USING_I2C3 #ifdef BSP_USING_I2C3
#define I2C3_BUS_CONFIG \ #define I2C3_BUS_CONFIG \
{ \ { \
.scl = BSP_I2C3_SCL_PIN, \ .scl_pin = BSP_I2C3_SCL_PIN, \
.sda = BSP_I2C3_SDA_PIN, \ .sda_pin = BSP_I2C3_SDA_PIN, \
.bus_name = "i2c3", \ .bus_name = "i2c3", \
} }
#endif #endif
@ -70,8 +70,8 @@ struct hc32_i2c
#ifdef BSP_USING_I2C4 #ifdef BSP_USING_I2C4
#define I2C4_BUS_CONFIG \ #define I2C4_BUS_CONFIG \
{ \ { \
.scl = BSP_I2C4_SCL_PIN, \ .scl_pin = BSP_I2C4_SCL_PIN, \
.sda = BSP_I2C4_SDA_PIN, \ .sda_pin = BSP_I2C4_SDA_PIN, \
.bus_name = "i2c4", \ .bus_name = "i2c4", \
} }
#endif #endif
@ -79,8 +79,8 @@ struct hc32_i2c
#ifdef BSP_USING_I2C5 #ifdef BSP_USING_I2C5
#define I2C5_BUS_CONFIG \ #define I2C5_BUS_CONFIG \
{ \ { \
.scl = BSP_I2C5_SCL_PIN, \ .scl_pin = BSP_I2C5_SCL_PIN, \
.sda = BSP_I2C5_SDA_PIN, \ .sda_pin = BSP_I2C5_SDA_PIN, \
.bus_name = "i2c5", \ .bus_name = "i2c5", \
} }
#endif #endif
@ -88,8 +88,8 @@ struct hc32_i2c
#ifdef BSP_USING_I2C6 #ifdef BSP_USING_I2C6
#define I2C6_BUS_CONFIG \ #define I2C6_BUS_CONFIG \
{ \ { \
.scl = BSP_I2C6_SCL_PIN, \ .scl_pin = BSP_I2C6_SCL_PIN, \
.sda = BSP_I2C6_SDA_PIN, \ .sda_pin = BSP_I2C6_SDA_PIN, \
.bus_name = "i2c6", \ .bus_name = "i2c6", \
} }
#endif #endif