From 4a4f29b8f95aa67f63397ae4efe78c6994398ccf Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Wed, 12 Apr 2017 15:24:50 -0700 Subject: 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. --- atmel-samd/main.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'atmel-samd/main.c') 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; -- cgit v1.2.3