8000 atmel-samd: Ensure pin state for first script run because we don't · pcurry/circuitpython@35a5d44 · GitHub
[go: up one dir, main page]

Skip to content

Commit 35a5d44

Browse files
committed
atmel-samd: Ensure pin state for first script run because we don't
know the post-bootloader state. Also, color the status LED purple for ValueErrors which are used to indicate a pin in use.
1 parent 6c858c7 commit 35a5d44

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

atmel-samd/main.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,8 @@ bool start_mp(void) {
305305
new_status_color(NAME_ERROR);
306306
} else if (mp_obj_is_subclass_fast(result.exception_type, &mp_type_OSError)) {
307307
new_status_color(OS_ERROR);
308+
} else if (mp_obj_is_subclass_fast(result.exception_type, &mp_type_ValueError)) {
309+
new_status_color(VALUE_ERROR);
308310
} else {
309311
new_status_color(OTHER_ERROR);
310312
}
@@ -424,7 +426,6 @@ int main(int argc, char **argv) {
424426
// stack so the GC can account for objects that may be referenced by the
425427
// stack between here and where gc_collect is called.
426428
stack_top = (char*)&stack_dummy;
427-
reset_mp();
428429

429430
// Initialise the local flash filesystem after the gc in case we need to
430431
// grab memory from it. Create it if needed, mount in on /flash, and set it
@@ -454,9 +455,9 @@ int main(int argc, char **argv) {
454455
if (exit_code == PYEXEC_FORCED_EXIT) {
455456
if (!first_run) {
456457
mp_hal_stdout_tx_str("soft reboot\r\n");
457-
reset_samd21();
458-
reset_mp();
459458
}
459+
reset_samd21();
460+
reset_mp();
460461
first_run = false;
461462
skip_repl = start_mp();
462463
} else if (exit_code != 0) {

atmel-samd/rgb_led_colors.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,5 @@
2929
#define SYNTAX_ERROR CYAN
3030
#define NAME_ERROR WHITE
3131
#define OS_ERROR ORANGE
32+
#define VALUE_ERROR PURPLE
3233
#define OTHER_ERROR YELLOW

0 commit comments

Comments
 (0)
0