Skip to content

Commit 772990a

Browse files
jhmaloneysandeepmistry
authored andcommitted
Add connector pins 16 and 17 as analog inputs A6 and A7
Update pin map comments in variant.cpp Swap microphone (P0.03) with unused pin (P0.23) in the pin map to make it easier to prevent digital pin access to the microphone pin. (The microphone pin should never be used as a digital output since that could damage the microphone amplifier). P0.03 is now g_ADigitalPinMap[28]. Since PIN_A0 now points to that entry, and the microphone is only accessed by reading analog pin A0. This change should be transparent to any existing code.
1 parent 0ccd430 commit 772990a

File tree

2 files changed

+17
-13
lines changed

2 files changed

+17
-13
lines changed

variants/CalliopeMini/variant.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@
2121

2222
const uint32_t g_ADigitalPinMap[] = {
2323
// 0 - 19 (available on expension connector)
24-
0, // A0 - left pad
25-
1, // A1 - bottom left pad; analog input
26-
2, // A2 - bottom right pad; analog input
27-
22, // A3 - right pad; SPI SCLK
28-
4, // LED row 1; analog input
29-
5, // LED row 2; analog input
30-
6, // LED row 3; analog input
24+
0, // left pad (not analog)
25+
1, // bottom left pad; A1
26+
2, // bottom right pad; A2
27+
22, // right pad; SPI SCLK (not analog)
28+
4, // LED row 1; A3
29+
5, // LED row 2; A4
30+
6, // LED row 3; A5
3131
7, // LED row 4
3232
8, // LED row 5
3333
9, // LED row 6
@@ -37,23 +37,23 @@ const uint32_t g_ADigitalPinMap[] = {
3737
13, // LED column 1
3838
14, // LED column 2
3939
15, // LED column 3
40-
26, // serial RX; SPI MISO
41-
27, // serial TX; SPI MOSI
40+
26, // serial RX; SPI MISO, A6
41+
27, // serial TX; SPI MOSI, A7
4242
20, // SDA
4343
19, // SCL
4444

4545
// 20-25 (internal; not available on external connector)
4646
17, // button A
47-
3, // microphone (shown as c21 on Calliope pinout)
47+
23, // unassigned
4848
16, // button B
4949
28, // motor driver enable
5050
29, // motor driver in1
51-
30, // motor driver in2
51+
30, // motor driver in2
5252

5353
// 26-30
5454
18, // neopixel
5555
21, // accelerometer chip interrupt
56-
23, // unassigned
56+
3, // microphone; A0
5757
24, // usb serial TX
5858
25, // usb serial RX
5959
};

variants/CalliopeMini/variant.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,19 +50,23 @@ extern "C"
5050

5151
// Analog pins
5252

53-
#define PIN_A0 (21) // microphone (note: pad 0 is not an analog input!)
53+
#define PIN_A0 (28) // microphone (note: pad 0 is not an analog input!)
5454
#define PIN_A1 (1) // pad 1
5555
#define PIN_A2 (2) // pad 2
5656
#define PIN_A3 (4) // connector pin 4
5757
#define PIN_A4 (5) // connector pin 5
5858
#define PIN_A5 (6) // connector pin 6
59+
#define PIN_A6 (16) // connector pin 16
60+
#define PIN_A7 (17) // connector pin 17
5961

6062
static const uint8_t A0 = PIN_A0;
6163
static const uint8_t A1 = PIN_A1;
6264
static const uint8_t A2 = PIN_A2;
6365
static const uint8_t A3 = PIN_A3;
6466
static const uint8_t A4 = PIN_A4;
6567
static const uint8_t A5 = PIN_A5;
68+
static const uint8_t A6 = PIN_A6;
69+
static const uint8_t A7 = PIN_A7;
6670
#define ADC_RESOLUTION 10
6771

6872
// Serial interface

0 commit comments

Comments
 (0)