@@ -79,8 +79,63 @@ menu "On-chip Peripheral Drivers"
7979 bool "Enable PWM16"
8080 default n
8181 endif
82+ menuconfig BSP_USING_HW_I2C
83+ bool "Enable Hardware I2C"
84+ default n
85+ select RT_USING_I2C
86+ if BSP_USING_HW_I2C
87+ config BSP_USING_HW_I2C0
88+ bool "Enable Hardware I2C0"
89+ default n
8290
91+ # config i2c0 pins
92+ choice
93+ prompt "Select I2C0 pins"
94+ depends on BSP_USING_HW_I2C0
95+ config BSP_HW_I2C0_PIN_PA2_PA3
96+ bool "SCL=PA2, SDA=PA3"
97+ config BSP_HW_I2C0_PIN_PA15_PC8
98+ bool "SCL=PA15, SDA=PC8"
99+ config BSP_HW_I2C0_PIN_PB0_PB1
100+ bool "SCL=PB0, SDA=PB1"
101+ config BSP_HW_I2C0_PIN_PB15_PA8
102+ bool "SCL=PB15, SDA=PA8"
103+ endchoice
104+
105+ # config i2c0 clock
106+ config BSP_HW_I2C0_CLK
107+ int "I2C0 clock frequency(KHz)"
108+ default 100
109+ depends on BSP_USING_HW_I2C0
110+ range 10 1000
111+
112+ config BSP_USING_HW_I2C1
113+ bool "Enable Hardware I2C1"
114+ default n
83115
116+ # config i2c1 pins
117+ choice
118+ prompt "Select I2C1 pins"
119+ depends on BSP_USING_HW_I2C1
120+ config BSP_HW_I2C1_PIN_PA6_PA7
121+ bool "SCL=PA6, SDA=PA7"
122+ config BSP_HW_I2C1_PIN_PA13_PA14
123+ bool "SCL=PA13, SDA=PA14"
124+ config BSP_HW_I2C1_PIN_PA15_PC8
125+ bool "SCL=PA15, SDA=PC8"
126+ config BSP_HW_I2C1_PIN_PB12_PB13
127+ bool "SCL=PB12, SDA=PB13"
128+ config BSP_HW_I2C1_PIN_PB15_PA8
129+ bool "SCL=PB15, SDA=PA8"
130+ endchoice
131+
132+ # config i2c1 clock
133+ config BSP_HW_I2C1_CLK
134+ int "I2C1 clock frequency(KHz)"
135+ default 100
136+ depends on BSP_USING_HW_I2C1
137+ range 10 1000
138+ endif
84139
85140 source "$(BSP_DIR)/../libraries/gd32_drivers/Kconfig"
86141
0 commit comments