Skip to content

Commit fd46643

Browse files
committed
[MAPLEMINI_F103CB] Avoid duplicated analog pins
Signed-off-by: Frederic Pillon <[email protected]>
1 parent fe7d272 commit fd46643

File tree

2 files changed

+24
-23
lines changed

2 files changed

+24
-23
lines changed

variants/MAPLEMINI_F103CB/variant.cpp

+14-12
Original file line numberDiff line numberDiff line change
@@ -72,18 +72,20 @@ const PinName digitalPin[] = {
7272
// Other
7373
PB_8, //D32 - BOOT0 - User buttons
7474
PB_1, //D33 - LED
75-
PB_9, //D34 - USB DISC
76-
// Duplicated pins to avoid issue with analogRead
77-
// A0 have to be greater than NUM_ANALOG_INPUTS
78-
PB_0, //D35/A0 = D3
79-
PA_7, //D36/A1 = D4
80-
PA_6, //D37/A2 = D5
81-
PA_5, //D38/A3 = D6
82-
PA_4, //D39/A4 = D7
83-
PA_3, //D40/A5 = D8
84-
PA_2, //D41/A6 = D9
85-
PA_1, //D42/A7 = D10
86-
PA_0 //D43/A8 = D11
75+
PB_9 //D34 - USB DISC
76+
};
77+
78+
// Analog (Ax) pin number array
79+
const uint32_t analogInPin[] = {
80+
3, //A0
81+
4, //A1
82+
5, //A2
83+
6, //A3
84+
7, //A4
85+
8, //A5
86+
9, //A6
87+
10, //A7
88+
11 //A8
8789
};
8890

8991
#ifdef __cplusplus

variants/MAPLEMINI_F103CB/variant.h

+10-11
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,15 @@ extern "C" {
4242
#define PB11 0
4343
#define PB10 1
4444
#define PB2 2
45-
#define PB0 3 // A0
46-
#define PA7 4 // A1
47-
#define PA6 5 // A2
48-
#define PA5 6 // A3
49-
#define PA4 7 // A4
50-
#define PA3 8 // A5
51-
#define PA2 9 // A6
52-
#define PA1 10 // A7
53-
#define PA0 11 // A8
45+
#define PB0 A0
46+
#define PA7 A1
47+
#define PA6 A2
48+
#define PA5 A3
49+
#define PA4 A4
50+
#define PA3 A5
51+
#define PA2 A6
52+
#define PA1 A7
53+
#define PA0 A8
5454
#define PC15 12
5555
#define PC14 13
5656
#define PC13 14
@@ -78,10 +78,9 @@ extern "C" {
7878
#define PB9 34 // USB DISC
7979

8080
// This must be a literal
81-
#define NUM_DIGITAL_PINS 44
81+
#define NUM_DIGITAL_PINS 35
8282
// This must be a literal with a value less than or equal to to MAX_ANALOG_INPUTS
8383
#define NUM_ANALOG_INPUTS 9
84-
#define NUM_ANALOG_FIRST 35
8584

8685
// On-board LED pin number
8786
#define LED_BUILTIN PB1

0 commit comments

Comments
 (0)