Skip to content

Commit c917963

Browse files
committed
Fix pin names and lower pin order issue
The pin numbering gets off as the lower level pin numbers 2 of them are deleted as such that the pins after that are off by 2 from the different documents pin names enum maps to digital pin number WIP
1 parent 2ccb910 commit c917963

File tree

3 files changed

+170
-5
lines changed

3 files changed

+170
-5
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
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+
11+
typedef enum {
12+
PH_15=0,
13+
PK_1 = 1,
14+
PJ_11 = 2,
15+
PG_7 = 3,
16+
PC_7 = 4,
17+
PC_6 = 5,
18+
PA_8 = 6,
19+
PI_0 = 7,
20+
PC_3 = 8,
21+
PI_1 = 9,
22+
PC_2 = 10,
23+
PH_8 = 11,
24+
PH_7 = 12,
25+
PA_10 = 13,
26+
PA1_9 = 14,
27+
PZ_0 = 15,
28+
PZ_1 = 16,
29+
PZ_2 = 17,
30+
PZ_3 = 18,
31+
PZ_4 = 19,
32+
PZ_5 = 20,
33+
// PC_2 = 21,
34+
// PC_3 = 22,
35+
PA_4 = 23,
36+
PA_6 = 24,
37+
PK_5 = 25,
38+
PK_6 = 26,
39+
PK_7 = 27,
40+
PA_0 = 28,
41+
PA_11 = 29,
42+
PA_12 = 30,
43+
PA_13 = 31,
44+
PA_14 = 32,
45+
PB_2 = 33,
46+
PB_3 = 34,
47+
PB_4 = 35,
48+
PB_6 = 36,
49+
PB_7 = 37,
50+
PB_8 = 38,
51+
PB_9 = 39,
52+
PB_14 = 40,
53+
PB_15 = 41,
54+
PC_13 = 42,
55+
PC_15 = 43,
56+
PD_3 = 44,
57+
PD_4 = 45,
58+
PD_5 = 46,
59+
PD_6 = 47,
60+
PD_7 = 48,
61+
PE_2 = 49,
62+
PE_3 = 50,
63+
PG_3 = 51,
64+
PG_9 = 52,
65+
PG_10 = 53,
66+
PG_14 = 54,
67+
PH_6 = 55,
68+
PH_9 = 56,
69+
PH_10 = 57,
70+
PH_11 = 58,
71+
PH_12 = 59,
72+
PH_13 = 60,
73+
PH_14 = 61,
74+
PI_2 = 62,
75+
PI_3 = 63,
76+
PI_4 = 64,
77+
PI_5 = 65,
78+
PI_6 = 66,
79+
PI_7 = 67,
80+
PI_8 = 68,
81+
PI_9 = 69,
82+
PI_10 = 70,
83+
PI_13 = 71,
84+
PI_14 = 72,
85+
PI_15 = 73,
86+
PJ_6 = 74,
87+
PJ_7 = 75,
88+
PJ_8 = 76,
89+
PJ_9 = 77,
90+
PJ_10 = 78,
91+
92+
/**** ADC internal channels ****/
93+
94+
ADC_TEMP = 0xF0, // Internal pin virtual value
95+
ADC_VREF = 0xF1, // Internal pin virtual value
96+
ADC_VBAT = 0xF2, // Internal pin virtual value
97+
98+
//Led mappings
99+
LED_RED = PK_5, //Red
100+
LED_GREEN = PK_6, //Green
101+
LED_BLUE = PK_7, //Blue
102+
// Not connected
103+
NC = (int)0xFFFFFFFF
104+
} PinName;
105+
106+
inline pin_size_t PinNameToIndex(PinName pn) {return (pin_size_t)pn;}
107+
inline PinName digitalPinToPinName(pin_size_t pin) {return (PinName)pin;}
108+
109+
#endif

variants/arduino_portenta_h7_stm32h747xx_m7/arduino_portenta_h7_stm32h747xx_m7.overlay

+60-5
Original file line numberDiff line numberDiff line change
@@ -314,14 +314,69 @@
314314
<&gpioz 3 GPIO_ACTIVE_LOW>, /* A3 ADC3_INP1 */
315315
<&gpioz 4 GPIO_ACTIVE_LOW>, /* A4 hack for duplicate PC_2 */
316316
<&gpioz 5 GPIO_ACTIVE_LOW>, /* A5 hack for duplicate PC_3 */
317-
/* <&gpioc 2 GPIO_ACTIVE_LOW>, A4 _ALT0? ADC1_INP12 */
318-
/* <&gpioc 3 GPIO_ACTIVE_LOW>, A5 _ALT0? ADC1_INP13 */
317+
<&gpioz 12 GPIO_ACTIVE_LOW>, /* PC2 A4 _ALT0? ADC1_INP12 */
318+
<&gpioz 13 GPIO_ACTIVE_LOW>, /* PC3 A5 _ALT0? ADC1_INP13 */
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)