diff options
| author | xiaoxiaolisunny <[email protected]> | 2022-06-12 22:46:21 +0800 |
|---|---|---|
| committer | guo <[email protected]> | 2022-06-13 11:33:48 +0800 |
| commit | 65669de0e3112d696f9c3661b92367b81e93788b (patch) | |
| tree | 9f62445dfced0fdb5dc41ba8fd3a30beb4478fb1 /bsp | |
| parent | f6ce2eb897dfb4534960e8f71b88153daef5140b (diff) | |
[bsp][hc32]添加HC32F460系列模拟I2C外设驱动支持
Diffstat (limited to 'bsp')
| -rw-r--r-- | bsp/hc32/ev_hc32f460_lqfp100_v2/board/Kconfig | 35 | ||||
| -rw-r--r-- | bsp/hc32/libraries/hc32_drivers/drv_soft_i2c.h | 20 |
2 files changed, 45 insertions, 10 deletions
diff --git a/bsp/hc32/ev_hc32f460_lqfp100_v2/board/Kconfig b/bsp/hc32/ev_hc32f460_lqfp100_v2/board/Kconfig index 5a9f8be13d..05bc2ed675 100644 --- a/bsp/hc32/ev_hc32f460_lqfp100_v2/board/Kconfig +++ b/bsp/hc32/ev_hc32f460_lqfp100_v2/board/Kconfig @@ -89,6 +89,41 @@ menu "On-chip Peripheral Drivers" default n 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 menu "Board extended module Drivers" diff --git a/bsp/hc32/libraries/hc32_drivers/drv_soft_i2c.h b/bsp/hc32/libraries/hc32_drivers/drv_soft_i2c.h index 07d607ae9a..08fbb9443a 100644 --- a/bsp/hc32/libraries/hc32_drivers/drv_soft_i2c.h +++ b/bsp/hc32/libraries/hc32_drivers/drv_soft_i2c.h @@ -52,8 +52,8 @@ struct hc32_i2c #ifdef BSP_USING_I2C2 #define I2C2_BUS_CONFIG \ { \ - .scl = BSP_I2C2_SCL_PIN, \ - .sda = BSP_I2C2_SDA_PIN, \ + .scl_pin = BSP_I2C2_SCL_PIN, \ + .sda_pin = BSP_I2C2_SDA_PIN, \ .bus_name = "i2c2", \ } #endif @@ -61,8 +61,8 @@ struct hc32_i2c #ifdef BSP_USING_I2C3 #define I2C3_BUS_CONFIG \ { \ - .scl = BSP_I2C3_SCL_PIN, \ - .sda = BSP_I2C3_SDA_PIN, \ + .scl_pin = BSP_I2C3_SCL_PIN, \ + .sda_pin = BSP_I2C3_SDA_PIN, \ .bus_name = "i2c3", \ } #endif @@ -70,8 +70,8 @@ struct hc32_i2c #ifdef BSP_USING_I2C4 #define I2C4_BUS_CONFIG \ { \ - .scl = BSP_I2C4_SCL_PIN, \ - .sda = BSP_I2C4_SDA_PIN, \ + .scl_pin = BSP_I2C4_SCL_PIN, \ + .sda_pin = BSP_I2C4_SDA_PIN, \ .bus_name = "i2c4", \ } #endif @@ -79,8 +79,8 @@ struct hc32_i2c #ifdef BSP_USING_I2C5 #define I2C5_BUS_CONFIG \ { \ - .scl = BSP_I2C5_SCL_PIN, \ - .sda = BSP_I2C5_SDA_PIN, \ + .scl_pin = BSP_I2C5_SCL_PIN, \ + .sda_pin = BSP_I2C5_SDA_PIN, \ .bus_name = "i2c5", \ } #endif @@ -88,8 +88,8 @@ struct hc32_i2c #ifdef BSP_USING_I2C6 #define I2C6_BUS_CONFIG \ { \ - .scl = BSP_I2C6_SCL_PIN, \ - .sda = BSP_I2C6_SDA_PIN, \ + .scl_pin = BSP_I2C6_SCL_PIN, \ + .sda_pin = BSP_I2C6_SDA_PIN, \ .bus_name = "i2c6", \ } #endif |
