summaryrefslogtreecommitdiff
path: root/atmel-samd/main.c
diff options
context:
space:
mode:
authorScott Shawcroft <scott.shawcroft@gmail.com>2017-04-12 15:24:50 -0700
committerScott Shawcroft <scott.shawcroft@gmail.com>2017-04-12 15:24:50 -0700
commit4a4f29b8f95aa67f63397ae4efe78c6994398ccf (patch)
tree8ff1fc64edcfca06e5dc6d79a84c259197046cd3 /atmel-samd/main.c
parent8505de1ced9e567867f2530cee241b28f3456b60 (diff)
atmel-samd: Rework status LED implementation
* Track status pin use by user code separately so it can take over the pins and then give them back. * Switch to hardware SPI for APA102 on Gemma and Trinket. * Merge microcontroller/types.h into microcontroller/Pin.h to better match approach going forwards.
Diffstat (limited to 'atmel-samd/main.c')
-rw-r--r--atmel-samd/main.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/atmel-samd/main.c b/atmel-samd/main.c
index 4eb810b21..29806e8e4 100644
--- a/atmel-samd/main.c
+++ b/atmel-samd/main.c
@@ -117,6 +117,7 @@ static char *stack_top;
static char heap[16384];
void reset_mp(void) {
+ reset_status_led();
new_status_color(0x8f008f);
autoreset_stop();
autoreset_enable();
@@ -175,10 +176,11 @@ void reset_samd21(void) {
pulsein_reset();
pulseout_reset();
- // Wait for the DAC to sync.
+ // Wait for the DAC to sync then reset.
while (DAC->STATUS.reg & DAC_STATUS_SYNCBUSY) {}
DAC->CTRLA.reg |= DAC_CTRLA_SWRST;
+ // Reset pins
struct system_pinmux_config config;
system_pinmux_get_config_defaults(&config);
config.powersave = true;
@@ -279,6 +281,7 @@ bool start_mp(void) {
maybe_run("main.py", &result) ||
maybe_run("main.txt", &result);
}
+ reset_status_led();
if (result.return_code & PYEXEC_FORCED_EXIT) {
return reset_next_character;