Skip to content

Commit 27c126a

Browse files
committed
[DEMO_F030F4] Avoid duplicated analog pins
Signed-off-by: Frederic Pillon <[email protected]>
1 parent 20db180 commit 27c126a

File tree

2 files changed

+23
-22
lines changed

2 files changed

+23
-22
lines changed

variants/DEMO_F030F4/variant.cpp

+13-11
Original file line numberDiff line numberDiff line change
@@ -57,17 +57,19 @@ const PinName digitalPin[] = {
5757
// These two are only available on boards without a crystal:
5858
PF_0,
5959
PF_1,
60-
// Duplicated pins in order to be aligned with PinMap_ADC
61-
// A0 have to be greater than NUM_ANALOG_INPUTS
62-
PA_0, //D15/A0 ~ D0
63-
PA_1, //D16/A1 ~ D1
64-
PA_2, //D17/A2 ~ D2
65-
PA_3, //D18/A3 ~ D3
66-
PA_4, //D19/A4 ~ D4
67-
PA_5, //D20/A5 ~ D5
68-
PA_6, //D21/A6 ~ D6
69-
PA_7, //D22/A7 ~ D7
70-
PB_1 //D23/A8 ~ D8
60+
};
61+
62+
// Analog (Ax) pin number array
63+
const uint32_t analogInPin[] = {
64+
0, //A0
65+
1, //A1
66+
2, //A2
67+
3, //A3
68+
4, //A4
69+
5, //A5
70+
6, //A6
71+
7, //A7
72+
8 //A8
7173
};
7274

7375
#ifdef __cplusplus

variants/DEMO_F030F4/variant.h

+10-11
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,16 @@ extern "C" {
4040

4141
// USB connector on the top, MCU side
4242
// Left Side
43-
#define PA0 0 //D0/A0
44-
#define PA1 1 //D1/A1
45-
#define PA2 2 //D2/A2 - TX
46-
#define PA3 3 //D3/A3 - RX
47-
#define PA4 4 //D4/A4 - LED
43+
#define PA0 A0 //D0/A0
44+
#define PA1 A1 //D1/A1
45+
#define PA2 A2 //D2/A2 - TX
46+
#define PA3 A3 //D3/A3 - RX
47+
#define PA4 A4 //D4/A4 - LED
4848
// Right side
49-
#define PA5 5 //D5/A5 - SCK
50-
#define PA6 6 //D6/A6 - MISO
51-
#define PA7 7 //D7/A7 - MOSI
52-
#define PB1 8 //D8/A8 - SS
49+
#define PA5 A5 //D5/A5 - SCK
50+
#define PA6 A6 //D6/A6 - MISO
51+
#define PA7 A7 //D7/A7 - MOSI
52+
#define PB1 A8 //D8/A8 - SS
5353
#define PA9 9 //D9 - SCL (TX UART header)
5454
#define PA10 10 //D10 - SDA (RX UART header)
5555
#define PA13 11 //D11 - SWDIO
@@ -59,10 +59,9 @@ extern "C" {
5959
#define PF1 14
6060

6161
// This must be a literal with the same value as PEND
62-
#define NUM_DIGITAL_PINS 24
62+
#define NUM_DIGITAL_PINS 15
6363
// This must be a literal with a value less than or equal to MAX_ANALOG_INPUTS
6464
#define NUM_ANALOG_INPUTS 9
65-
#define NUM_ANALOG_FIRST 15
6665

6766
// On-board LED pin number
6867
#define LED_BUILTIN PA4

0 commit comments

Comments
 (0)