Skip to content

Commit fe884b5

Browse files
committed
pin names enum maps to digital pin number
WIP
1 parent 2ccb910 commit fe884b5

File tree

3 files changed

+265
-3
lines changed

3 files changed

+265
-3
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,206 @@
1+
/*
2+
* Copyright (c) 2024 Arduino SA
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#ifndef ZEPHYR_PINNAMES_H
8+
#define ZEPHYR_PINNAMES_H
9+
10+
#ifdef __cplusplus
11+
extern "C" {
12+
#endif
13+
14+
#define DUAL_PAD 0x800
15+
16+
typedef enum {
17+
PH_15=0,
18+
PK_1 = 1,
19+
PJ_11 = 2,
20+
PG_7 = 3,
21+
PC_7 = 4,
22+
PC_6 = 5,
23+
PA_8 = 6,
24+
PI_0 = 7,
25+
PC_3 = 8,
26+
PI_1 = 9,
27+
PC_2 = 10,
28+
PH_8 = 11,
29+
PH_7 = 12,
30+
PA_10 = 13,
31+
PA1_9 = 14,
32+
PZ_0 = 15,
33+
PZ_1 = 16,
34+
PZ_2 = 17,
35+
PZ_3 = 18,
36+
PZ_4 = 19,
37+
PZ_5 = 20,
38+
// PC_2 = 21,
39+
// PC_3 = 22,
40+
PA_4 = 23,
41+
PA_6 = 24,
42+
PK_5 = 25,
43+
PK_6 = 26,
44+
PK_7 = 27,
45+
PA_0 = 28,
46+
PA_11 = 29,
47+
PA_12 = 30,
48+
PA_13 = 31,
49+
PA_14 = 32,
50+
PB_2 = 33,
51+
PB_3 = 34,
52+
PB_4 = 35,
53+
PB_6 = 36,
54+
PB_7 = 37,
55+
PB_8 = 38,
56+
PB_9 = 39,
57+
PB_14 = 40,
58+
PB_15 = 41,
59+
PC_13 = 42,
60+
PC_15 = 43,
61+
PD_3 = 44,
62+
PD_4 = 45,
63+
PD_5 = 46,
64+
PD_6 = 47,
65+
PD_7 = 48,
66+
PE_2 = 49,
67+
PE_3 = 50,
68+
PG_3 = 51,
69+
PG_9 = 52,
70+
PG_10 = 53,
71+
PG_14 = 54,
72+
PH_6 = 55,
73+
PH_9 = 56,
74+
PH_10 = 57,
75+
PH_11 = 58,
76+
PH_12 = 59,
77+
PH_13 = 60,
78+
PH_14 = 61,
79+
PI_2 = 62,
80+
PI_3 = 63,
81+
PI_4 = 64,
82+
PI_5 = 65,
83+
PI_6 = 66,
84+
PI_7 = 67,
85+
PI_8 = 68,
86+
PI_9 = 69,
87+
PI_10 = 70,
88+
PI_13 = 71,
89+
PI_14 = 72,
90+
PI_15 = 73,
91+
PJ_6 = 74,
92+
PJ_7 = 75,
93+
PJ_8 = 76,
94+
PJ_9 = 77,
95+
PJ_10 = 78,
96+
97+
WL_REG_ON = PJ_1,
98+
WL_HOST_WAKE = PJ_5,
99+
WL_SDIO_0 = PC_8,
100+
WL_SDIO_1 = PC_9,
101+
WL_SDIO_2 = PC_10,
102+
WL_SDIO_3 = PC_11,
103+
WL_SDIO_CMD = PD_2,
104+
WL_SDIO_CLK = PC_12,
105+
106+
/**** ADC internal channels ****/
107+
108+
ADC_TEMP = 0xF0, // Internal pin virtual value
109+
ADC_VREF = 0xF1, // Internal pin virtual value
110+
ADC_VBAT = 0xF2, // Internal pin virtual value
111+
112+
//Led mappings
113+
LED_RED = PK_5, //Red
114+
LED_GREEN = PK_6, //Green
115+
LED_BLUE = PK_7, //Blue
116+
117+
CYBSP_BT_UART_RX = PF_6,
118+
CYBSP_BT_UART_TX = PA_15,
119+
CYBSP_BT_UART_RTS = PF_8,
120+
CYBSP_BT_UART_CTS = PF_9,
121+
122+
CYBSP_BT_POWER = PJ_12,
123+
CYBSP_BT_HOST_WAKE = PJ_13,
124+
CYBSP_BT_DEVICE_WAKE = PJ_14,
125+
126+
/**** QSPI FLASH pins ****/
127+
QSPI_FLASH1_IO0 = PD_11,
128+
QSPI_FLASH1_IO1 = PD_12,
129+
QSPI_FLASH1_IO2 = PF_7,
130+
QSPI_FLASH1_IO3 = PD_13,
131+
QSPI_FLASH1_SCK = PF_10,
132+
QSPI_FLASH1_CSN = PG_6,
133+
134+
/**** USB FS pins ****/
135+
USB_OTG_FS_DM = PA_11,
136+
USB_OTG_FS_DP = PA_12,
137+
USB_OTG_FS_ID = PA_10,
138+
USB_OTG_FS_SOF = PA_8,
139+
USB_OTG_FS_VBUS = PA_9,
140+
141+
/**** USB HS pins ****/
142+
USB_OTG_HS_DM = PB_14,
143+
USB_OTG_HS_DP = PB_15,
144+
USB_OTG_HS_ID = PB_12,
145+
USB_OTG_HS_SOF = PA_4,
146+
USB_OTG_HS_ULPI_CK = PA_5,
147+
USB_OTG_HS_ULPI_D0 = PA_3,
148+
USB_OTG_HS_ULPI_D1 = PB_0,
149+
USB_OTG_HS_ULPI_D2 = PB_1,
150+
USB_OTG_HS_ULPI_D3 = PB_10,
151+
USB_OTG_HS_ULPI_D4 = PB_11,
152+
USB_OTG_HS_ULPI_D5 = PB_12,
153+
USB_OTG_HS_ULPI_D6 = PB_13,
154+
USB_OTG_HS_ULPI_D7 = PB_5,
155+
USB_OTG_HS_ULPI_DIR = PC_2,
156+
USB_OTG_HS_ULPI_NXT = PC_3,
157+
USB_OTG_HS_ULPI_STP = PC_0,
158+
USB_OTG_HS_VBUS = PB_13,
159+
160+
/**** ETHERNET pins ****/
161+
ETH_MDC = PC_1,
162+
ETH_MDIO = PA_2,
163+
ETH_CRS_DV = PA_7,
164+
ETH_REF_CLK = PA_1,
165+
ETH_RXD0 = PC_4,
166+
ETH_RXD1 = PC_5,
167+
ETH_RX_CLK = PA_1,
168+
ETH_TXD0 = PG_13,
169+
ETH_TXD1 = PG_12,
170+
ETH_TX_EN = PG_11,
171+
172+
/**** OSCILLATOR pins ****/
173+
RCC_OSC32_IN = PC_14,
174+
RCC_OSC32_OUT = PC_15,
175+
RCC_OSC_IN = PH_0,
176+
RCC_OSC_OUT = PH_1,
177+
178+
/**** DEBUG pins ****/
179+
SYS_JTCK_SWCLK = PA_14,
180+
SYS_JTDI = PA_15,
181+
SYS_JTDO_SWO = PB_3,
182+
SYS_JTMS_SWDIO = PA_13,
183+
SYS_JTRST = PB_4,
184+
SYS_PVD_IN = PB_7,
185+
SYS_TRACECLK = PE_2,
186+
SYS_TRACED0 = PE_3,
187+
SYS_TRACED0_ALT0 = PC_1,
188+
SYS_TRACED0_ALT1 = PG_13,
189+
SYS_TRACED1 = PE_4,
190+
SYS_TRACED1_ALT0 = PC_8,
191+
SYS_TRACED1_ALT1 = PG_14,
192+
SYS_TRACED2 = PE_5,
193+
SYS_TRACED2_ALT0 = PD_2,
194+
SYS_TRACED3 = PE_6,
195+
SYS_TRACED3_ALT0 = PC_12,
196+
SYS_TRGIO = PC_7,
197+
SYS_WKUP0 = PA_0,
198+
SYS_WKUP1 = PA_2,
199+
SYS_WKUP2 = PC_13,
200+
SYS_WKUP5 = PC_1,
201+
202+
// Not connected
203+
NC = (int)0xFFFFFFFF
204+
} PinName;
205+
206+
#endif

variants/arduino_portenta_h7_stm32h747xx_m7/arduino_portenta_h7_stm32h747xx_m7.overlay

+58-3
Original file line numberDiff line numberDiff line change
@@ -319,9 +319,64 @@
319319
<&gpioa 4 GPIO_ACTIVE_LOW>, /* A6 ADC1_INP18 */
320320
<&gpioa 6 GPIO_ACTIVE_LOW>, /* A7 ADC1_INP7 */
321321

322-
<&gpiok 5 GPIO_ACTIVE_LOW>, /* LEDR */
323-
<&gpiok 6 GPIO_ACTIVE_LOW>, /* LEDG */
324-
<&gpiok 7 GPIO_ACTIVE_LOW>; /* LEDB */
322+
323+
<&gpiok 5 GPIO_ACTIVE_LOW>, // LEDR
324+
<&gpiok 6 GPIO_ACTIVE_LOW>, // LEDG
325+
<&gpiok 7 GPIO_ACTIVE_LOW>, // LEDB
326+
327+
<&gpioa 0 GPIO_ACTIVE_LOW>,
328+
<&gpioa 11 GPIO_ACTIVE_LOW>,
329+
<&gpioa 12 GPIO_ACTIVE_LOW>,
330+
<&gpioa 13 GPIO_ACTIVE_LOW>,
331+
<&gpioa 14 GPIO_ACTIVE_LOW>,
332+
<&gpiob 2 GPIO_ACTIVE_LOW>,
333+
<&gpiob 3 GPIO_ACTIVE_LOW>,
334+
<&gpiob 4 GPIO_ACTIVE_LOW>,
335+
<&gpiob 6 GPIO_ACTIVE_LOW>,
336+
<&gpiob 7 GPIO_ACTIVE_LOW>,
337+
<&gpiob 8 GPIO_ACTIVE_LOW>,
338+
<&gpiob 9 GPIO_ACTIVE_LOW>,
339+
<&gpiob 14 GPIO_ACTIVE_LOW>,
340+
<&gpiob 15 GPIO_ACTIVE_LOW>,
341+
<&gpioc 13 GPIO_ACTIVE_LOW>,
342+
<&gpioc 15 GPIO_ACTIVE_LOW>,
343+
<&gpiod 3 GPIO_ACTIVE_LOW>,
344+
<&gpiod 4 GPIO_ACTIVE_LOW>,
345+
<&gpiod 5 GPIO_ACTIVE_LOW>,
346+
<&gpiod 6 GPIO_ACTIVE_LOW>,
347+
<&gpiod 7 GPIO_ACTIVE_LOW>,
348+
<&gpioe 2 GPIO_ACTIVE_LOW>,
349+
<&gpioe 3 GPIO_ACTIVE_LOW>,
350+
<&gpiog 3 GPIO_ACTIVE_LOW>,
351+
<&gpiog 9 GPIO_ACTIVE_LOW>,
352+
<&gpiog 10 GPIO_ACTIVE_LOW>,
353+
<&gpiog 14 GPIO_ACTIVE_LOW>,
354+
<&gpioh 6 GPIO_ACTIVE_LOW>,
355+
<&gpioh 9 GPIO_ACTIVE_LOW>,
356+
<&gpioh 10 GPIO_ACTIVE_LOW>,
357+
<&gpioh 11 GPIO_ACTIVE_LOW>,
358+
<&gpioh 12 GPIO_ACTIVE_LOW>,
359+
<&gpioh 13 GPIO_ACTIVE_LOW>,
360+
<&gpioh 14 GPIO_ACTIVE_LOW>,
361+
<&gpioi 2 GPIO_ACTIVE_LOW>,
362+
<&gpioi 3 GPIO_ACTIVE_LOW>,
363+
<&gpioi 4 GPIO_ACTIVE_LOW>,
364+
<&gpioi 5 GPIO_ACTIVE_LOW>,
365+
<&gpioi 6 GPIO_ACTIVE_LOW>,
366+
<&gpioi 7 GPIO_ACTIVE_LOW>,
367+
<&gpioi 8 GPIO_ACTIVE_LOW>,
368+
<&gpioi 9 GPIO_ACTIVE_LOW>,
369+
<&gpioi 10 GPIO_ACTIVE_LOW>,
370+
<&gpioi 13 GPIO_ACTIVE_LOW>,
371+
<&gpioi 14 GPIO_ACTIVE_LOW>,
372+
<&gpioi 15 GPIO_ACTIVE_LOW>,
373+
<&gpioj 6 GPIO_ACTIVE_LOW>,
374+
<&gpioj 7 GPIO_ACTIVE_LOW>,
375+
<&gpioj 8 GPIO_ACTIVE_LOW>,
376+
<&gpioj 9 GPIO_ACTIVE_LOW>,
377+
<&gpioj 10 GPIO_ACTIVE_LOW>;
378+
379+
325380

326381
builtin-led-gpios = <&gpiok 5 GPIO_ACTIVE_LOW>,
327382
<&gpiok 6 GPIO_ACTIVE_LOW>,

variants/arduino_portenta_h7_stm32h747xx_m7/variant.h

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
* SPDX-License-Identifier: Apache-2.0
55
*/
66
#include "pure_analog_pins.h"
7+
#include "PinNames.h"
78

89
// TODO: correctly handle these legacy defines
910
#define MOSI 0

0 commit comments

Comments
 (0)