Skip to content

Commit 6350b27

Browse files
committed
[NUCLEO_L4R5ZI] Avoid duplicated analog pins
Signed-off-by: Frederic Pillon <[email protected]>
1 parent cbcb31c commit 6350b27

File tree

2 files changed

+41
-30
lines changed

2 files changed

+41
-30
lines changed

variants/NUCLEO_L4R5ZI/variant.cpp

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -159,20 +159,32 @@ const PinName digitalPin[] = {
159159
PC_5, //D112/A5
160160
PB_1, //D113/A6
161161
PC_2, //D114/A7
162-
PA_1, //D115/A8
163-
// Duplicated pins in order to be aligned with PinMapADC
164-
PA_7, //D116/A9 = D11
165-
PA_6, //D117/A10 = D12
166-
PA_5, //D118/A11 = D13
167-
PA_4, //D119/A12 = D20
168-
PA_2, //D120/A13 = D26
169-
PB_0, //D121/A14 = D29
170-
PA_0, //D122/A15 = D32
162+
PA_1 //D115/A8
171163
#ifdef ARDUINO_NUCLEO_L4R5ZI
172-
PG_15 //D123
164+
, PG_15 //D116
173165
#endif
174166
};
175167

168+
// Analog (Ax) pin number array
169+
const uint32_t analogInPin[] = {
170+
107, //A0
171+
108, //A1
172+
109, //A2
173+
110, //A3
174+
111, //A4
175+
112, //A5
176+
113, //A6
177+
114, //A7
178+
115, //A8
179+
11, //A9
180+
12, //A10
181+
13, //A11
182+
20, //A12
183+
26, //A13
184+
29, //A14
185+
32 //A15
186+
};
187+
176188
#ifdef __cplusplus
177189
}
178190
#endif

variants/NUCLEO_L4R5ZI/variant.h

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -52,28 +52,28 @@ extern "C" {
5252
#define PF12 8
5353
#define PD15 9
5454
#define PD14 10
55-
#define PA7 11 // A9
56-
#define PA6 12 // A10
57-
#define PA5 13 // A11
55+
#define PA7 A9
56+
#define PA6 A10
57+
#define PA5 A11
5858
#define PB9 14
5959
#define PB8 15
6060
#define PC6 16
6161
#define PB15 17
6262
#define PB13 18
6363
#define PB12 19
64-
#define PA4 20 // A12
64+
#define PA4 A12
6565
#define PB4 21
6666
#define PB5 22
6767
#define PB3 23
6868
// 24 is PA4 (20)
6969
// 25 is PB4 (21)
70-
#define PA2 26 // A13
70+
#define PA2 A13
7171
#define PB10 27
7272
#define PE15 28
73-
#define PB0 29 // A14
73+
#define PB0 A14
7474
#define PE12 30
7575
#define PE14 31
76-
#define PA0 32 // A15
76+
#define PA0 A15
7777
// 32 is PB0 (29)
7878
#define PE0 34
7979
#ifdef ARDUINO_NUCLEO_L4R5ZI
@@ -153,18 +153,18 @@ extern "C" {
153153
#define PH0 105
154154
#define PH1 106
155155
// Analog pins
156-
#define PA3 107 // A0
157-
#define PC0 108 // A1
158-
#define PC3 109 // A2
159-
#define PC1 110 // A3
160-
#define PC4 111 // A4
161-
#define PC5 112 // A5
162-
#define PB1 113 // A6
163-
#define PC2 114 // A7
164-
#define PA1 115 // A8
156+
#define PA3 A0
157+
#define PC0 A1
158+
#define PC3 A2
159+
#define PC1 A3
160+
#define PC4 A4
161+
#define PC5 A5
162+
#define PB1 A6
163+
#define PC2 A7
164+
#define PA1 A8
165165
// 116 to 122 reserved fot A9 to A15
166166
#ifdef ARDUINO_NUCLEO_L4R5ZI
167-
#define PG15 123
167+
#define PG15 116
168168
#endif
169169
// PA13 and PA14 are shared with SWD signals connected to ST-LINK/V2-1.
170170
// If ST-LINK part is not cut, it is not recommended to use them as I/O pins.
@@ -173,13 +173,12 @@ extern "C" {
173173

174174
// This must be a literal
175175
#ifdef ARDUINO_NUCLEO_L4R5ZI
176-
#define NUM_DIGITAL_PINS 124
176+
#define NUM_DIGITAL_PINS 117
177177
#else
178-
#define NUM_DIGITAL_PINS 123
178+
#define NUM_DIGITAL_PINS 116
179179
#endif
180180
// This must be a literal with a value less than or equal to to MAX_ANALOG_INPUTS
181181
#define NUM_ANALOG_INPUTS 16
182-
#define NUM_ANALOG_FIRST 107
183182

184183
// On-board LED pin number
185184
#define LED_BUILTIN PC7

0 commit comments

Comments
 (0)