summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Shawcroft <scott.shawcroft@gmail.com>2017-03-27 20:12:30 +0100
committerScott Shawcroft <scott.shawcroft@gmail.com>2017-03-27 20:12:30 +0100
commitf5caf8687086d1b3cf3a3b5f6d6218682beca5c2 (patch)
tree75898ecb24f369503a50bc97a8c47fca7db7c1d7
parentbe1ed7aae46d93c136bb18eacdd22143cd52c1da (diff)
atmel-samd: Add message for when auto reset is off. Fixes #112
-rw-r--r--atmel-samd/autoreset.c4
-rw-r--r--atmel-samd/autoreset.h1
-rw-r--r--atmel-samd/main.c10
3 files changed, 12 insertions, 3 deletions
diff --git a/atmel-samd/autoreset.c b/atmel-samd/autoreset.c
index 3f6681938..b048a32d2 100644
--- a/atmel-samd/autoreset.c
+++ b/atmel-samd/autoreset.c
@@ -54,6 +54,10 @@ void autoreset_disable() {
autoreset_enabled = false;
}
+inline bool autoreset_is_enabled() {
+ return autoreset_enabled;
+}
+
void autoreset_start() {
autoreset_delay_ms = AUTORESET_DELAY_MS;
}
diff --git a/atmel-samd/autoreset.h b/atmel-samd/autoreset.h
index 5719aaa2f..02e3ec18a 100644
--- a/atmel-samd/autoreset.h
+++ b/atmel-samd/autoreset.h
@@ -37,5 +37,6 @@ void autoreset_start(void);
void autoreset_stop(void);
void autoreset_enable(void);
void autoreset_disable(void);
+bool autoreset_is_enabled(void);
#endif // __MICROPY_INCLUDED_ATMEL_SAMD_AUTORESET_H__
diff --git a/atmel-samd/main.c b/atmel-samd/main.c
index 47edc2537..8c22b6a6c 100644
--- a/atmel-samd/main.c
+++ b/atmel-samd/main.c
@@ -259,7 +259,7 @@ bool start_mp(void) {
#ifdef AUTORESET_DELAY_MS
if (cdc_enabled_at_start) {
mp_hal_stdout_tx_str("\r\n");
- mp_hal_stdout_tx_str("Auto-soft reset is on. Simply save files over USB to run them.\r\n");
+ mp_hal_stdout_tx_str("Auto-soft reset is on. Simply save files over USB to run them or enter REPL to disable.\r\n");
}
#endif
@@ -330,10 +330,14 @@ bool start_mp(void) {
if (!cdc_enabled_before && mp_cdc_enabled) {
if (cdc_enabled_at_start) {
mp_hal_stdout_tx_str("\r\n\r\n");
+ }
+
+ if (!cdc_enabled_at_start && autoreset_is_enabled()) {
+ mp_hal_stdout_tx_str("Auto-soft reset is on. Simply save files over USB to run them or enter REPL to disable.\r\n");
} else {
- mp_hal_stdout_tx_str("Auto-soft reset is on. Simply save files over USB to run them.\r\n");
+ mp_hal_stdout_tx_str("Auto-soft reset is off.\r\n");
}
- mp_hal_stdout_tx_str("Press any key to enter the REPL and disable auto-reset. Use CTRL-D to soft reset.\r\n");
+ mp_hal_stdout_tx_str("Press any key to enter the REPL. Use CTRL-D to soft reset.\r\n");
}
if (cdc_enabled_before && !mp_cdc_enabled) {
cdc_enabled_at_start = false;