aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Halbert <halbert@halwitz.org>2017-10-15 16:55:41 -0400
committerScott Shawcroft <scott@tannewt.org>2017-10-15 16:57:37 -0700
commitcfd1809b2bddb4c44adfd4ac187697dfa8e8cc2b (patch)
treef5a0c5394e358dd544340261627be854f0e26b07
parent922006dd59323e6019e8fbfe1938e0c30121999c (diff)
Suppress A0 (PA02) as a TouchIn-capable pin on CPX.
-rw-r--r--atmel-samd/boards/circuitplayground_express/mpconfigboard.h3
-rw-r--r--atmel-samd/samd21_pins.c8
2 files changed, 10 insertions, 1 deletions
diff --git a/atmel-samd/boards/circuitplayground_express/mpconfigboard.h b/atmel-samd/boards/circuitplayground_express/mpconfigboard.h
index f9ff05084..2665f300d 100644
--- a/atmel-samd/boards/circuitplayground_express/mpconfigboard.h
+++ b/atmel-samd/boards/circuitplayground_express/mpconfigboard.h
@@ -3,6 +3,9 @@
#define MICROPY_HW_BOARD_NAME "Adafruit CircuitPlayground Express"
#define MICROPY_HW_MCU_NAME "samd21g18"
+// Don't allow touch on A0 (PA02), because it's connected to the speaker.
+#define PA02_NO_TOUCH (true)
+
// Salae reads 12mhz which is the limit even though we set it to the safer 8mhz.
#define SPI_FLASH_BAUDRATE (8000000)
diff --git a/atmel-samd/samd21_pins.c b/atmel-samd/samd21_pins.c
index cd66b41ee..b9fb17948 100644
--- a/atmel-samd/samd21_pins.c
+++ b/atmel-samd/samd21_pins.c
@@ -84,7 +84,13 @@ PIN(PA01, EXTINT_CHANNEL(1), NO_ADC, NO_TOUCH,
SERCOM(SERCOM1, 1));
#endif
#ifdef PIN_PA02
-PIN(PA02, EXTINT_CHANNEL(2), ADC_INPUT(ADC_POSITIVE_INPUT_PIN0), TOUCH(0),
+// Touch is not allowed on A0 (PA02) on Circuit Playground Express.
+PIN(PA02, EXTINT_CHANNEL(2), ADC_INPUT(ADC_POSITIVE_INPUT_PIN0),
+ #ifdef PA02_NO_TOUCH
+ NO_TOUCH,
+ #else
+ TOUCH(0),
+ #endif
NO_TIMER,
NO_TIMER,
NO_SERCOM,