Skip to content

Commit a7e210d

Browse files
1ridicGuozhanxin
authored andcommitted
[bsp][pico] Optimize Kconfig configuration
Fix SPI and I2C configuration menu. Add UART enablement option. Limit the pin selection for UART and I2C according to the datasheet.
1 parent dee82b8 commit a7e210d

File tree

1 file changed

+207
-52
lines changed
  • bsp/raspberry-pico/libraries

1 file changed

+207
-52
lines changed

bsp/raspberry-pico/libraries/Kconfig

Lines changed: 207 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,83 @@ menu "On-chip Peripheral Drivers"
2929
select RT_USING_PIN
3030
default y
3131

32-
config BSP_USING_UART
32+
menuconfig BSP_USING_UART
3333
bool "Enable UART"
34-
select RT_USING_UART
34+
select RT_USING_SERIAL
3535
default y
36+
if BSP_USING_UART
37+
config BSP_USING_UART0
38+
bool "Enable UART0"
39+
default y
40+
if BSP_USING_UART0
41+
choice
42+
prompt "uart0 tx pin number (GP)"
43+
depends on BSP_USING_UART0
44+
default BSP_UART0_TX_PIN_0
45+
config BSP_UART0_TX_PIN_0
46+
bool "0"
47+
config BSP_UART0_TX_PIN_12
48+
bool "12"
49+
config BSP_UART0_TX_PIN_16
50+
bool "16"
51+
endchoice
52+
config BSP_UART0_TX_PIN
53+
int
54+
default 0 if BSP_UART0_TX_PIN_0
55+
default 12 if BSP_UART0_TX_PIN_12
56+
default 16 if BSP_UART0_TX_PIN_16
57+
58+
choice
59+
prompt "uart0 rx pin number (GP)"
60+
depends on BSP_USING_UART0
61+
default BSP_UART0_RX_PIN_1
62+
config BSP_UART0_RX_PIN_1
63+
bool "1"
64+
config BSP_UART0_RX_PIN_13
65+
bool "13"
66+
config BSP_UART0_RX_PIN_17
67+
bool "17"
68+
endchoice
69+
config BSP_UART0_RX_PIN
70+
int
71+
default 1 if BSP_UART0_RX_PIN_1
72+
default 13 if BSP_UART0_RX_PIN_13
73+
default 17 if BSP_UART0_RX_PIN_17
74+
endif
75+
76+
config BSP_USING_UART1
77+
bool "Enable UART1"
78+
default n
79+
if BSP_USING_UART1
80+
choice
81+
prompt "uart1 tx pin number (GP)"
82+
depends on BSP_USING_UART1
83+
default BSP_UART1_TX_PIN_4
84+
config BSP_UART1_TX_PIN_4
85+
bool "4"
86+
config BSP_UART1_TX_PIN_8
87+
bool "8"
88+
endchoice
89+
config BSP_UART1_TX_PIN
90+
int
91+
default 4 if BSP_UART1_TX_PIN_4
92+
default 8 if BSP_UART1_TX_PIN_8
93+
94+
choice
95+
prompt "uart1 rx pin number (GP)"
96+
depends on BSP_USING_UART1
97+
default BSP_UART1_RX_PIN_5
98+
config BSP_UART1_RX_PIN_5
99+
bool "5"
100+
config BSP_UART1_RX_PIN_9
101+
bool "9"
102+
endchoice
103+
config BSP_UART1_RX_PIN
104+
int
105+
default 5 if BSP_UART1_RX_PIN_5
106+
default 9 if BSP_UART1_RX_PIN_9
107+
endif
108+
endif
36109

37110
menuconfig BSP_USING_SOFT_I2C
38111
bool "Enable I2C BUS (software simulation)"
@@ -121,58 +194,140 @@ menu "On-chip Peripheral Drivers"
121194
default n
122195

123196
menuconfig BSP_USING_SPI
124-
config BSP_USING_SPI
125-
bool "Enable SPI"
126-
select RT_USING_SPI
127-
default n
128-
129-
if BSP_USING_SPI
130-
config BSP_USING_SPI0
131-
bool "Enable SPI0"
132-
default n
133-
134-
config BSP_USING_SPI1
135-
bool "Enable SPI1"
136-
default n
137-
endif
197+
bool "Enable SPI"
198+
select RT_USING_SPI
199+
default n
200+
201+
if BSP_USING_SPI
202+
config BSP_USING_SPI0
203+
bool "Enable SPI0"
204+
default n
205+
206+
config BSP_USING_SPI1
207+
bool "Enable SPI1"
208+
default n
209+
endif
138210

139211
menuconfig BSP_USING_I2C
140-
config BSP_USING_I2C
141-
bool "Enable I2C"
142-
select RT_USING_I2C
143-
select RT_USING_I2C_BITOPS
144-
select RT_USING_PIN
145-
default n
146-
147-
if BSP_USING_I2C
148-
config BSP_USING_I2C0
149-
bool "Enable I2C0"
150-
default n
151-
if BSP_USING_I2C0
152-
config BSP_I2C0_SCL_PIN
153-
int "i2c0 scl pin number (GP)"
154-
range 0 28
155-
default 21
156-
config BSP_I2C0_SDA_PIN
157-
int "I2C0 sda pin number (GP)"
158-
range 0 28
159-
default 20
160-
endif
161-
162-
config BSP_USING_I2C1
163-
bool "Enable I2C1"
164-
default n
165-
if BSP_USING_I2C1
166-
config BSP_I2C1_SCL_PIN
167-
int "i2c1 scl pin number (GP)"
168-
range 0 28
169-
default 19
170-
config BSP_I2C1_SDA_PIN
171-
int "I2C1 sda pin number (GP)"
172-
range 0 28
173-
default 18
174-
endif
175-
endif
212+
bool "Enable I2C"
213+
select RT_USING_I2C
214+
select RT_USING_I2C_BITOPS
215+
select RT_USING_PIN
216+
default n
217+
218+
if BSP_USING_I2C
219+
config BSP_USING_I2C0
220+
bool "Enable I2C0"
221+
default n
222+
if BSP_USING_I2C0
223+
choice
224+
prompt "i2c0 scl pin number (GP)"
225+
depends on BSP_USING_I2C0
226+
default BSP_I2C0_SCL_PIN_21
227+
config BSP_I2C0_SCL_PIN_1
228+
bool "1"
229+
config BSP_I2C0_SCL_PIN_5
230+
bool "5"
231+
config BSP_I2C0_SCL_PIN_9
232+
bool "9"
233+
config BSP_I2C0_SCL_PIN_13
234+
bool "13"
235+
config BSP_I2C0_SCL_PIN_17
236+
bool "17"
237+
config BSP_I2C0_SCL_PIN_21
238+
bool "21"
239+
endchoice
240+
config BSP_I2C0_SCL_PIN
241+
int
242+
default 1 if BSP_I2C0_SCL_PIN_1
243+
default 5 if BSP_I2C0_SCL_PIN_5
244+
default 9 if BSP_I2C0_SCL_PIN_9
245+
default 13 if BSP_I2C0_SCL_PIN_13
246+
default 17 if BSP_I2C0_SCL_PIN_17
247+
default 21 if BSP_I2C0_SCL_PIN_21
248+
249+
choice
250+
prompt "i2c0 sda pin number (GP)"
251+
depends on BSP_USING_I2C0
252+
default BSP_I2C0_SDA_PIN_20
253+
config BSP_I2C0_SDA_PIN_0
254+
bool "0"
255+
config BSP_I2C0_SDA_PIN_4
256+
bool "4"
257+
config BSP_I2C0_SDA_PIN_8
258+
bool "8"
259+
config BSP_I2C0_SDA_PIN_12
260+
bool "12"
261+
config BSP_I2C0_SDA_PIN_16
262+
bool "16"
263+
config BSP_I2C0_SDA_PIN_20
264+
bool "20"
265+
endchoice
266+
config BSP_I2C0_SDA_PIN
267+
int
268+
default 0 if BSP_I2C0_SDA_PIN_0
269+
default 4 if BSP_I2C0_SDA_PIN_4
270+
default 8 if BSP_I2C0_SDA_PIN_8
271+
default 12 if BSP_I2C0_SDA_PIN_12
272+
default 16 if BSP_I2C0_SDA_PIN_16
273+
default 20 if BSP_I2C0_SDA_PIN_20
274+
endif
275+
276+
config BSP_USING_I2C1
277+
bool "Enable I2C1"
278+
default n
279+
if BSP_USING_I2C1
280+
choice
281+
prompt "i2c1 scl pin number (GP)"
282+
depends on BSP_USING_I2C1
283+
config BSP_I2C1_SCL_PIN_3
284+
bool "3"
285+
config BSP_I2C1_SCL_PIN_7
286+
bool "7"
287+
config BSP_I2C1_SCL_PIN_11
288+
bool "11"
289+
config BSP_I2C1_SCL_PIN_15
290+
bool "15"
291+
config BSP_I2C1_SCL_PIN_19
292+
bool "19"
293+
config BSP_I2C1_SCL_PIN_27
294+
bool "27"
295+
endchoice
296+
config BSP_I2C1_SCL_PIN
297+
int
298+
default 3 if BSP_I2C1_SCL_PIN_3
299+
default 7 if BSP_I2C1_SCL_PIN_7
300+
default 11 if BSP_I2C1_SCL_PIN_11
301+
default 15 if BSP_I2C1_SCL_PIN_15
302+
default 19 if BSP_I2C1_SCL_PIN_19
303+
default 27 if BSP_I2C1_SCL_PIN_27
304+
305+
choice
306+
prompt "i2c1 sda pin number (GP)"
307+
depends on BSP_USING_I2C1
308+
config BSP_I2C1_SDA_PIN_2
309+
bool "2"
310+
config BSP_I2C1_SDA_PIN_6
311+
bool "6"
312+
config BSP_I2C1_SDA_PIN_10
313+
bool "10"
314+
config BSP_I2C1_SDA_PIN_14
315+
bool "14"
316+
config BSP_I2C1_SDA_PIN_18
317+
bool "18"
318+
config BSP_I2C1_SDA_PIN_26
319+
bool "26"
320+
endchoice
321+
config BSP_I2C1_SDA_PIN
322+
int
323+
default 2 if BSP_I2C1_SDA_PIN_2
324+
default 6 if BSP_I2C1_SDA_PIN_6
325+
default 10 if BSP_I2C1_SDA_PIN_10
326+
default 14 if BSP_I2C1_SDA_PIN_14
327+
default 18 if BSP_I2C1_SDA_PIN_18
328+
default 26 if BSP_I2C1_SDA_PIN_26
329+
endif
330+
endif
176331
endmenu
177332

178333
endmenu

0 commit comments

Comments
 (0)