Skip to content

Commit c39bbf3

Browse files
committed
[NUCLEO_F302R8] Avoid duplicated analog pins
Signed-off-by: Frederic Pillon <frederic.pillon@st.com>
1 parent 6fb9c0e commit c39bbf3

File tree

2 files changed

+24
-16
lines changed

2 files changed

+24
-16
lines changed

variants/NUCLEO_F302R8/variant.cpp

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -80,14 +80,23 @@ const PinName digitalPin[] = {
8080
PA_4, //D48/A2
8181
PB_0, //D49/A3
8282
PC_1, //D50/A4
83-
PC_0, //D51/A5
84-
// Duplicated pins in order to be aligned with PinMap_ADC
85-
PC_2, //D52/A6 = D28
86-
PC_3, //D53/A7 = D29
87-
PB_11, //D54/A8 = D39
88-
PB_1, //D55/A9 = D41
89-
PA_7, //D56/A10 = D42
90-
PA_6, //D57/A11 = D43
83+
PC_0 //D51/A5
84+
};
85+
86+
// Analog (Ax) pin number array
87+
const uint32_t analogInPin[] = {
88+
46, //A0
89+
47, //A1
90+
48, //A2
91+
49, //A3
92+
50, //A4
93+
51, //A5
94+
28, //A6
95+
29, //A7
96+
39, //A8
97+
41, //A9
98+
42, //A10
99+
43 //A11
91100
};
92101

93102
#ifdef __cplusplus

variants/NUCLEO_F302R8/variant.h

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ extern "C" {
5757
#define PC15 25
5858
#define PF0 26
5959
#define PF1 27
60-
#define PC2 28 // A6
61-
#define PC3 29 // A7
60+
#define PC2 A6
61+
#define PC3 A7
6262
// CN7 Right Side
6363
#define PC11 30
6464
#define PD2 31
@@ -71,11 +71,11 @@ extern "C" {
7171
#define PA12 36
7272
#define PA11 37
7373
#define PB12 38
74-
#define PB11 39 // A8
74+
#define PB11 A8
7575
#define PB2 40
76-
#define PB1 41 // A9
77-
#define PA7 42 // A10
78-
#define PA6 43 // A11
76+
#define PB1 A9
77+
#define PA7 A10
78+
#define PA6 A11
7979
#define PA5 44
8080
#define PC4 45
8181
#define PA0 46 // A0
@@ -86,10 +86,9 @@ extern "C" {
8686
#define PC0 51 // A5
8787

8888
// This must be a literal
89-
#define NUM_DIGITAL_PINS 58
89+
#define NUM_DIGITAL_PINS 52
9090
// This must be a literal with a value less than or equal to to MAX_ANALOG_INPUTS
9191
#define NUM_ANALOG_INPUTS 12
92-
#define NUM_ANALOG_FIRST 46
9392

9493
// On-board LED pin number
9594
#define LED_BUILTIN 13

0 commit comments

Comments
 (0)