Skip to content

Commit cbcb31c

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

File tree

2 files changed

+26
-18
lines changed

2 files changed

+26
-18
lines changed

variants/NUCLEO_G071RB/variant.cpp

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -87,12 +87,21 @@ const PinName digitalPin[] = {
8787
PA_4, //D55/A2
8888
PB_1, //D56/A3
8989
PB_11, //D57/A4
90-
PB_12, //D58/A5
91-
// Duplicated pins in order to be aligned with PinMap_ADC
92-
PA_7, //D59/A6 = D11
93-
PA_6, //D60/A7 = D12
94-
PB_2, //D61/A8 = D45
95-
PB_10 //D62/A9 = D48
90+
PB_12 //D58/A5
91+
};
92+
93+
// Analog (Ax) pin number array
94+
const uint32_t analogInPin[] = {
95+
53, //A0
96+
54, //A1
97+
55, //A2
98+
56, //A3
99+
57, //A4
100+
58, //A5
101+
11, //A6
102+
12, //A7
103+
45, //A8
104+
48 //A9
96105
};
97106

98107
#ifdef __cplusplus

variants/NUCLEO_G071RB/variant.h

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ extern "C" {
3838
#define PA9 8
3939
#define PC7 9
4040
#define PB0 10
41-
#define PA7 11 // A6
42-
#define PA6 12 // A7
41+
#define PA7 A6
42+
#define PA6 A7
4343
#define PA5 13 // LED
4444
#define PB9 14
4545
#define PB8 15
@@ -77,26 +77,25 @@ extern "C" {
7777
#define PA12 42
7878
#define PC1 43
7979
#define PC0 44
80-
#define PB2 45 // A8
80+
#define PB2 A8
8181
#define PB6 46
8282
#define PB15 47
83-
#define PB10 48 // A9
83+
#define PB10 A9
8484
#define PB13 49
8585
#define PA2 50
8686
#define PD8 51
8787
#define PD9 52
88-
#define PA0 53 // A0
89-
#define PA1 54 // A1
90-
#define PA4 55 // A2
91-
#define PB1 56 // A3
92-
#define PB11 57 // A4
93-
#define PB12 58 // A5
88+
#define PA0 A0
89+
#define PA1 A1
90+
#define PA4 A2
91+
#define PB1 A3
92+
#define PB11 A4
93+
#define PB12 A5
9494

9595
// This must be a literal
96-
#define NUM_DIGITAL_PINS 63
96+
#define NUM_DIGITAL_PINS 59
9797
// This must be a literal with a value less than or equal to to MAX_ANALOG_INPUTS
9898
#define NUM_ANALOG_INPUTS 10
99-
#define NUM_ANALOG_FIRST 53
10099

101100
// On-board LED pin number
102101
#define LED_BUILTIN 13

0 commit comments

Comments
 (0)