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