From 65669de0e3112d696f9c3661b92367b81e93788b Mon Sep 17 00:00:00 2001 From: xiaoxiaolisunny Date: Sun, 12 Jun 2022 22:46:21 +0800 Subject: [PATCH] =?UTF-8?q?[bsp][hc32]=E6=B7=BB=E5=8A=A0HC32F460=E7=B3=BB?= =?UTF-8?q?=E5=88=97=E6=A8=A1=E6=8B=9FI2C=E5=A4=96=E8=AE=BE=E9=A9=B1?= =?UTF-8?q?=E5=8A=A8=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bsp/hc32/ev_hc32f460_lqfp100_v2/board/Kconfig | 35 +++++++++++++++++++ .../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 -- GitLab