Skip to content

Commit e57915e

Browse files
committed
[HY_TinySTM103T] Avoid duplicated analog pins
Signed-off-by: Frederic Pillon <frederic.pillon@st.com>
1 parent 95dd5e7 commit e57915e

File tree

2 files changed

+27
-25
lines changed

2 files changed

+27
-25
lines changed

variants/HY_TinySTM103T/variant.cpp

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -65,19 +65,22 @@ const PinName digitalPin[] = {
6565
PA_9,
6666
PA_10,
6767
PA_11,
68-
PA_12,
68+
PA_12
6969
//GND
70-
//defines so that analog pins align to arduino mappings
71-
PA_0, //A0
72-
PA_1,
73-
PA_2,
74-
PA_3,
75-
PA_4,
76-
PA_5,
77-
PA_6,
78-
PA_7,
79-
PB_0,
80-
PB_1, //A9
70+
};
71+
72+
// Analog (Ax) pin number array
73+
const uint32_t analogInPin[] = {
74+
2, //A0
75+
1, //A1
76+
0, //A2
77+
11, //A3
78+
12, //A4
79+
13, //A5
80+
14, //A6
81+
15, //A7
82+
16, //A8
83+
17 //A9
8184
};
8285

8386
#ifdef __cplusplus

variants/HY_TinySTM103T/variant.h

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ extern "C" {
4040

4141
// Right side
4242

43-
#define PA2 0
44-
#define PA1 1 // LED
45-
#define PA0 2
43+
#define PA2 A2
44+
#define PA1 A1 // LED
45+
#define PA0 A0
4646
#define PA14 3
4747
#define PA13 4
4848
#define PB7 5
@@ -52,25 +52,24 @@ extern "C" {
5252
#define PB3 9
5353
#define PA15 10
5454
// Left side
55-
#define PA3 11
56-
#define PA4 12
57-
#define PA5 13
58-
#define PA6 14
59-
#define PA7 15
60-
#define PB0 16
61-
#define PB1 17
62-
#define PB2 18//BOOT1
55+
#define PA3 A3
56+
#define PA4 A4
57+
#define PA5 A5
58+
#define PA6 A6
59+
#define PA7 A7
60+
#define PB0 A8
61+
#define PB1 A9
62+
#define PB2 18 //BOOT1
6363
#define PA8 19
6464
#define PA9 20
6565
#define PA10 21
6666
#define PA11 22
6767
#define PA12 23
6868

6969
// This must be a literal
70-
#define NUM_DIGITAL_PINS 34
70+
#define NUM_DIGITAL_PINS 24
7171
// This must be a literal with a value less than or equal to to MAX_ANALOG_INPUTS
7272
#define NUM_ANALOG_INPUTS 10
73-
#define NUM_ANALOG_FIRST 24
7473

7574
// On-board LED pin number
7675
#define LED_BUILTIN PA1

0 commit comments

Comments
 (0)