aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Shawcroft <scott.shawcroft@gmail.com>2017-05-12 16:45:38 -0700
committerScott Shawcroft <scott.shawcroft@gmail.com>2017-05-12 16:45:38 -0700
commit7672bf773637b008f4e5a334bcbd0a91c5ac95b2 (patch)
treeba3cd8749cb93b83d922b4bcaa5996847ccee9ad
parente0f931afd3268229a291c5c8a2bef12bde697da3 (diff)
atmel-samd: Rename auto-reset to auto-reload to reduce confusion with physical reset buttons.
-rw-r--r--atmel-samd/Makefile2
-rw-r--r--atmel-samd/access_vfs.c4
-rw-r--r--atmel-samd/autoreload.c (renamed from atmel-samd/autoreset.c)40
-rw-r--r--atmel-samd/autoreload.h (renamed from atmel-samd/autoreset.h)20
-rw-r--r--atmel-samd/bindings/samd/__init__.c28
-rw-r--r--atmel-samd/boards/arduino_zero/mpconfigboard.h2
-rw-r--r--atmel-samd/boards/circuitplayground_express/mpconfigboard.h2
-rw-r--r--atmel-samd/boards/feather_m0_adalogger/mpconfigboard.h2
-rw-r--r--atmel-samd/boards/feather_m0_basic/mpconfigboard.h2
-rw-r--r--atmel-samd/boards/feather_m0_express/mpconfigboard.h2
-rw-r--r--atmel-samd/boards/gemma_m0/mpconfigboard.h2
-rw-r--r--atmel-samd/boards/metro_m0_express/mpconfigboard.h2
-rw-r--r--atmel-samd/boards/trinket_m0/mpconfigboard.h2
-rw-r--r--atmel-samd/main.c30
-rw-r--r--atmel-samd/mpconfigport.h2
-rw-r--r--atmel-samd/mphalport.c10
-rw-r--r--atmel-samd/tick.c6
-rw-r--r--atmel-samd/tick.h2
18 files changed, 73 insertions, 87 deletions
diff --git a/atmel-samd/Makefile b/atmel-samd/Makefile
index 806948105..f4fcbf9a3 100644
--- a/atmel-samd/Makefile
+++ b/atmel-samd/Makefile
@@ -180,7 +180,7 @@ SRC_ASF = $(addprefix asf/sam0/,\
SRC_C = \
access_vfs.c \
- autoreset.c \
+ autoreload.c \
builtin_open.c \
fatfs_port.c \
main.c \
diff --git a/atmel-samd/access_vfs.c b/atmel-samd/access_vfs.c
index 7af19857a..ecdc94e44 100644
--- a/atmel-samd/access_vfs.c
+++ b/atmel-samd/access_vfs.c
@@ -27,7 +27,7 @@
#include <string.h>
#include "access_vfs.h"
-#include "autoreset.h"
+#include "autoreload.h"
#include "asf/common/services/usb/class/msc/device/udi_msc.h"
#include "extmod/fsusermount.h"
@@ -184,6 +184,6 @@ Ctrl_status vfs_usb_write_10(uint32_t addr, volatile uint16_t nb_sector)
}
}
}
- autoreset_start();
+ autoreload_start();
return CTRL_GOOD;
}
diff --git a/atmel-samd/autoreset.c b/atmel-samd/autoreload.c
index b048a32d2..5d1a512ed 100644
--- a/atmel-samd/autoreset.c
+++ b/atmel-samd/autoreload.c
@@ -24,44 +24,44 @@
* THE SOFTWARE.
*/
-#include "autoreset.h"
+#include "autoreload.h"
#include "asf/sam0/drivers/tc/tc_interrupt.h"
#include "lib/utils/interrupt_char.h"
#include "py/mphal.h"
-volatile uint32_t autoreset_delay_ms = 0;
-bool autoreset_enabled = false;
-volatile bool reset_next_character = false;
+volatile uint32_t autoreload_delay_ms = 0;
+bool autoreload_enabled = false;
+volatile bool reload_next_character = false;
-inline void autoreset_tick() {
- if (autoreset_delay_ms == 0) {
+inline void autoreload_tick() {
+ if (autoreload_delay_ms == 0) {
return;
}
- if (autoreset_delay_ms == 1 && autoreset_enabled && !reset_next_character) {
+ if (autoreload_delay_ms == 1 && autoreload_enabled && !reload_next_character) {
mp_keyboard_interrupt();
- reset_next_character = true;
+ reload_next_character = true;
}
- autoreset_delay_ms--;
+ autoreload_delay_ms--;
}
-void autoreset_enable() {
- autoreset_enabled = true;
- reset_next_character = false;
+void autoreload_enable() {
+ autoreload_enabled = true;
+ reload_next_character = false;
}
-void autoreset_disable() {
- autoreset_enabled = false;
+void autoreload_disable() {
+ autoreload_enabled = false;
}
-inline bool autoreset_is_enabled() {
- return autoreset_enabled;
+inline bool autoreload_is_enabled() {
+ return autoreload_enabled;
}
-void autoreset_start() {
- autoreset_delay_ms = AUTORESET_DELAY_MS;
+void autoreload_start() {
+ autoreload_delay_ms = CIRCUITPY_AUTORELOAD_DELAY_MS;
}
-void autoreset_stop() {
- autoreset_delay_ms = 0;
+void autoreload_stop() {
+ autoreload_delay_ms = 0;
}
diff --git a/atmel-samd/autoreset.h b/atmel-samd/autoreload.h
index 02e3ec18a..cb54893c2 100644
--- a/atmel-samd/autoreset.h
+++ b/atmel-samd/autoreload.h
@@ -24,19 +24,19 @@
* THE SOFTWARE.
*/
-#ifndef __MICROPY_INCLUDED_ATMEL_SAMD_AUTORESET_H__
-#define __MICROPY_INCLUDED_ATMEL_SAMD_AUTORESET_H__
+#ifndef __MICROPY_INCLUDED_ATMEL_SAMD_AUTORELOAD_H__
+#define __MICROPY_INCLUDED_ATMEL_SAMD_AUTORELOAD_H__
#include <stdbool.h>
-extern volatile bool reset_next_character;
+extern volatile bool reload_next_character;
-void autoreset_tick(void);
+void autoreload_tick(void);
-void autoreset_start(void);
-void autoreset_stop(void);
-void autoreset_enable(void);
-void autoreset_disable(void);
-bool autoreset_is_enabled(void);
+void autoreload_start(void);
+void autoreload_stop(void);
+void autoreload_enable(void);
+void autoreload_disable(void);
+bool autoreload_is_enabled(void);
-#endif // __MICROPY_INCLUDED_ATMEL_SAMD_AUTORESET_H__
+#endif // __MICROPY_INCLUDED_ATMEL_SAMD_AUTORELOAD_H__
diff --git a/atmel-samd/bindings/samd/__init__.c b/atmel-samd/bindings/samd/__init__.c
index 62deb78c5..83c069eca 100644
--- a/atmel-samd/bindings/samd/__init__.c
+++ b/atmel-samd/bindings/samd/__init__.c
@@ -25,7 +25,7 @@
*/
#include "py/obj.h"
#include "py/runtime.h"
- #include "autoreset.h"
+ #include "autoreload.h"
//| :mod:`samd` --- SAMD implementation settings
//| =================================================
@@ -35,31 +35,31 @@
//| :platform: SAMD21
//|
-//| .. method:: enable_autoreset()
+//| .. method:: enable_autoreload()
//|
-//| Enable autoreset based on USB file write activity.
+//| Enable autoreload based on USB file write activity.
//|
-STATIC mp_obj_t samd_enable_autoreset(void) {
- autoreset_enable();
+STATIC mp_obj_t samd_enable_autoreload(void) {
+ autoreload_enable();
return mp_const_none;
}
-MP_DEFINE_CONST_FUN_OBJ_0(samd_enable_autoreset_obj, samd_enable_autoreset);
+MP_DEFINE_CONST_FUN_OBJ_0(samd_enable_autoreload_obj, samd_enable_autoreload);
-//| .. method:: disable_autoreset()
+//| .. method:: disable_autoreload()
//|
-//| Disable autoreset based on USB file write activity until the next reset
-//| or until `enable_autoreset` is called.
+//| Disable autoreload based on USB file write activity until the next reload
+//| or until `enable_autoreload` is called.
//|
-STATIC mp_obj_t samd_disable_autoreset(void) {
- autoreset_disable();
+STATIC mp_obj_t samd_disable_autoreload(void) {
+ autoreload_disable();
return mp_const_none;
}
-MP_DEFINE_CONST_FUN_OBJ_0(samd_disable_autoreset_obj, samd_disable_autoreset);
+MP_DEFINE_CONST_FUN_OBJ_0(samd_disable_autoreload_obj, samd_disable_autoreload);
STATIC const mp_rom_map_elem_t samd_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_samd) },
- { MP_OBJ_NEW_QSTR(MP_QSTR_enable_autoreset), MP_ROM_PTR(&samd_enable_autoreset_obj)},
- { MP_OBJ_NEW_QSTR(MP_QSTR_disable_autoreset), MP_ROM_PTR(&samd_disable_autoreset_obj)},
+ { MP_OBJ_NEW_QSTR(MP_QSTR_enable_autoreload), MP_ROM_PTR(&samd_enable_autoreload_obj)},
+ { MP_OBJ_NEW_QSTR(MP_QSTR_disable_autoreload), MP_ROM_PTR(&samd_disable_autoreload_obj)},
};
STATIC MP_DEFINE_CONST_DICT(samd_module_globals, samd_module_globals_table);
diff --git a/atmel-samd/boards/arduino_zero/mpconfigboard.h b/atmel-samd/boards/arduino_zero/mpconfigboard.h
index 50ab4c51c..dd4ec88d3 100644
--- a/atmel-samd/boards/arduino_zero/mpconfigboard.h
+++ b/atmel-samd/boards/arduino_zero/mpconfigboard.h
@@ -10,8 +10,6 @@
#define MICROPY_PORT_A (PORT_PA24 | PORT_PA25 | PORT_PA27)
#define MICROPY_PORT_B (PORT_PB03)
-#define AUTORESET_DELAY_MS 500
-
#include "internal_flash.h"
#define BOARD_FLASH_SIZE (0x00040000 - 0x2000 - 0x010000)
diff --git a/atmel-samd/boards/circuitplayground_express/mpconfigboard.h b/atmel-samd/boards/circuitplayground_express/mpconfigboard.h
index 4eb124adf..e551e5545 100644
--- a/atmel-samd/boards/circuitplayground_express/mpconfigboard.h
+++ b/atmel-samd/boards/circuitplayground_express/mpconfigboard.h
@@ -32,8 +32,6 @@
#define SPEAKER_ENABLE_PIN (&pin_PA30)
-#define AUTORESET_DELAY_MS 500
-
#include "spi_flash.h"
#define BOARD_FLASH_SIZE (0x00040000 - 0x2000)
diff --git a/atmel-samd/boards/feather_m0_adalogger/mpconfigboard.h b/atmel-samd/boards/feather_m0_adalogger/mpconfigboard.h
index 9ed6daf66..f1b9dfcbe 100644
--- a/atmel-samd/boards/feather_m0_adalogger/mpconfigboard.h
+++ b/atmel-samd/boards/feather_m0_adalogger/mpconfigboard.h
@@ -6,8 +6,6 @@
#define MICROPY_HW_BOARD_NAME "Adafruit Feather M0 Adalogger"
#define MICROPY_HW_MCU_NAME "samd21g18"
-#define AUTORESET_DELAY_MS 500
-
#define MICROPY_PORT_A (PORT_PA24 | PORT_PA25)
#define MICROPY_PORT_B (0)
diff --git a/atmel-samd/boards/feather_m0_basic/mpconfigboard.h b/atmel-samd/boards/feather_m0_basic/mpconfigboard.h
index 10693934a..ff6088c3a 100644
--- a/atmel-samd/boards/feather_m0_basic/mpconfigboard.h
+++ b/atmel-samd/boards/feather_m0_basic/mpconfigboard.h
@@ -6,8 +6,6 @@
#define MICROPY_HW_BOARD_NAME "Adafruit Feather M0 Basic"
#define MICROPY_HW_MCU_NAME "samd21g18"
-#define AUTORESET_DELAY_MS 500
-
#define MICROPY_PORT_A (PORT_PA24 | PORT_PA25)
#define MICROPY_PORT_B (0)
diff --git a/atmel-samd/boards/feather_m0_express/mpconfigboard.h b/atmel-samd/boards/feather_m0_express/mpconfigboard.h
index 4f787aef6..865e53033 100644
--- a/atmel-samd/boards/feather_m0_express/mpconfigboard.h
+++ b/atmel-samd/boards/feather_m0_express/mpconfigboard.h
@@ -21,8 +21,6 @@
#define MICROPY_PORT_A (PORT_PA06 | PORT_PA08 | PORT_PA09 | PORT_PA14 | PORT_PA13 | PORT_PA14 | PORT_PA24 | PORT_PA25)
#define MICROPY_PORT_B ( 0 )
-#define AUTORESET_DELAY_MS 500
-
#include "spi_flash.h"
#define BOARD_FLASH_SIZE (0x00040000 - 0x2000)
diff --git a/atmel-samd/boards/gemma_m0/mpconfigboard.h b/atmel-samd/boards/gemma_m0/mpconfigboard.h
index 5368ad9b3..da331cadd 100644
--- a/atmel-samd/boards/gemma_m0/mpconfigboard.h
+++ b/atmel-samd/boards/gemma_m0/mpconfigboard.h
@@ -11,8 +11,6 @@
#define MICROPY_PORT_A (PORT_PA04 | PORT_PA05 | PORT_PA24 | PORT_PA25)
#define MICROPY_PORT_B (0)
-#define AUTORESET_DELAY_MS 500
-
#include "internal_flash.h"
#define BOARD_FLASH_SIZE (0x00040000 - 0x2000 - 0x010000)
diff --git a/atmel-samd/boards/metro_m0_express/mpconfigboard.h b/atmel-samd/boards/metro_m0_express/mpconfigboard.h
index 49da728dc..95632f20d 100644
--- a/atmel-samd/boards/metro_m0_express/mpconfigboard.h
+++ b/atmel-samd/boards/metro_m0_express/mpconfigboard.h
@@ -23,8 +23,6 @@
#define MICROPY_PORT_A (PORT_PA13 |PORT_PA24 | PORT_PA25 | PORT_PA27 | PORT_PA30 | PORT_PA31)
#define MICROPY_PORT_B (PORT_PB03 | PORT_PB22 | PORT_PB23)
-#define AUTORESET_DELAY_MS 500
-
#include "spi_flash.h"
#define BOARD_FLASH_SIZE (0x00040000 - 0x2000)
diff --git a/atmel-samd/boards/trinket_m0/mpconfigboard.h b/atmel-samd/boards/trinket_m0/mpconfigboard.h
index 23e51e8d2..1cf5e7b0a 100644
--- a/atmel-samd/boards/trinket_m0/mpconfigboard.h
+++ b/atmel-samd/boards/trinket_m0/mpconfigboard.h
@@ -10,8 +10,6 @@
#define MICROPY_PORT_A (PORT_PA04 | PORT_PA05 | PORT_PA24 | PORT_PA25)
#define MICROPY_PORT_B (0)
-#define AUTORESET_DELAY_MS 500
-
#include "internal_flash.h"
#define BOARD_FLASH_SIZE (0x00040000 - 0x2000 - 0x010000)
diff --git a/atmel-samd/main.c b/atmel-samd/main.c
index da9c08019..0dfd2d471 100644
--- a/atmel-samd/main.c
+++ b/atmel-samd/main.c
@@ -38,7 +38,7 @@
#define INTERNAL_CIRCUITPY_CONFIG_START_ADDR (0x00040000 - 0x010000 - 0x100)
#endif
-#include "autoreset.h"
+#include "autoreload.h"
#include "flash_api.h"
#include "mpconfigboard.h"
#include "rgb_led_status.h"
@@ -84,7 +84,7 @@ void init_flash_fs(void) {
FRESULT res = f_mount(&vfs->fatfs, vfs->str, 1);
if (res == FR_NO_FILESYSTEM) {
- // no filesystem, or asked to reset it, so create a fresh one
+ // no filesystem so create a fresh one
// We are before USB initializes so temporarily undo the USB_WRITEABLE
// requirement.
@@ -120,8 +120,8 @@ static char heap[16384];
void reset_mp(void) {
reset_status_led();
new_status_color(0x8f008f);
- autoreset_stop();
- autoreset_enable();
+ autoreload_stop();
+ autoreload_enable();
// Sync the file systems in case any used RAM from the GC to cache. As soon
// as we re-init the GC all bets are off on the cache.
@@ -245,10 +245,10 @@ bool maybe_run(const char* filename, pyexec_result_t* exec_result) {
bool start_mp(void) {
bool cdc_enabled_at_start = mp_cdc_enabled;
- #ifdef AUTORESET_DELAY_MS
+ #ifdef CIRCUITPY_AUTORELOAD_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 or enter REPL to disable.\r\n");
+ mp_hal_stdout_tx_str("Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.\r\n");
}
#endif
@@ -269,7 +269,7 @@ bool start_mp(void) {
reset_status_led();
if (result.return_code & PYEXEC_FORCED_EXIT) {
- return reset_next_character;
+ return reload_next_character;
}
// If not is USB mode then do not skip the repl.
@@ -309,11 +309,11 @@ bool start_mp(void) {
#ifdef MICROPY_VM_HOOK_LOOP
MICROPY_VM_HOOK_LOOP
#endif
- if (reset_next_character) {
+ if (reload_next_character) {
return true;
}
if (usb_rx_count > 0) {
- // Skip REPL if reset was requested.
+ // Skip REPL if reload was requested.
return receive_usb() == CHAR_CTRL_D;
}
@@ -322,12 +322,12 @@ bool start_mp(void) {
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");
+ if (!cdc_enabled_at_start && autoreload_is_enabled()) {
+ mp_hal_stdout_tx_str("Auto-reload 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 off.\r\n");
+ mp_hal_stdout_tx_str("Auto-reload is off.\r\n");
}
- mp_hal_stdout_tx_str("Press any key to enter the REPL. Use CTRL-D to soft reset.\r\n");
+ mp_hal_stdout_tx_str("Press any key to enter the REPL. Use CTRL-D to reload.\r\n");
}
if (cdc_enabled_before && !mp_cdc_enabled) {
cdc_enabled_at_start = false;
@@ -529,13 +529,13 @@ int main(void) {
// Main script is finished, so now go into REPL mode.
- // The REPL mode can change, or it can request a soft reset.
+ // The REPL mode can change, or it can request a reload.
int exit_code = PYEXEC_FORCED_EXIT;
bool skip_repl = true;
bool first_run = true;
for (;;) {
if (!skip_repl) {
- autoreset_disable();
+ autoreload_disable();
new_status_color(REPL_RUNNING);
if (pyexec_mode_kind == PYEXEC_MODE_RAW_REPL) {
exit_code = pyexec_raw_repl();
diff --git a/atmel-samd/mpconfigport.h b/atmel-samd/mpconfigport.h
index 166f257ef..48aa192cc 100644
--- a/atmel-samd/mpconfigport.h
+++ b/atmel-samd/mpconfigport.h
@@ -203,4 +203,6 @@ bool udi_msc_process_trans(void);
#define MICROPY_VM_HOOK_LOOP udi_msc_process_trans();
#define MICROPY_VM_HOOK_RETURN udi_msc_process_trans();
+#define CIRCUITPY_AUTORELOAD_DELAY_MS 500
+
#endif // __INCLUDED_MPCONFIGPORT_H
diff --git a/atmel-samd/mphalport.c b/atmel-samd/mphalport.c
index 7fe06dd80..827e585d2 100644
--- a/atmel-samd/mphalport.c
+++ b/atmel-samd/mphalport.c
@@ -1,6 +1,6 @@
#include <string.h>
-#include "autoreset.h"
+#include "autoreload.h"
#include "compiler.h"
#include "asf/common/services/sleepmgr/sleepmgr.h"
#include "asf/common/services/usb/class/cdc/device/udi_cdc.h"
@@ -131,8 +131,8 @@ int receive_usb(void) {
return 0;
}
- // Disable autoreset if someone is using the repl.
- autoreset_disable();
+ // Disable autoreload if someone is using the repl.
+ autoreload_disable();
// Copy from head.
cpu_irq_disable();
@@ -157,7 +157,7 @@ int mp_hal_stdin_rx_chr(void) {
MICROPY_VM_HOOK_LOOP
#endif
#ifdef USB_REPL
- if (reset_next_character) {
+ if (reload_next_character) {
return CHAR_CTRL_D;
}
if (usb_rx_count > 0) {
@@ -228,7 +228,7 @@ void mp_hal_delay_ms(mp_uint_t delay) {
#ifdef MICROPY_VM_HOOK_LOOP
MICROPY_VM_HOOK_LOOP
#endif
- // Check to see if we've been CTRL-Ced by autoreset or the user.
+ // Check to see if we've been CTRL-Ced by autoreload or the user.
if(MP_STATE_VM(mp_pending_exception) == MP_OBJ_FROM_PTR(&MP_STATE_VM(mp_kbd_exception))) {
break;
}
diff --git a/atmel-samd/tick.c b/atmel-samd/tick.c
index 84893e3e2..cbe72abc6 100644
--- a/atmel-samd/tick.c
+++ b/atmel-samd/tick.c
@@ -1,4 +1,4 @@
-#include "autoreset.h"
+#include "autoreload.h"
#include "tick.h"
@@ -14,8 +14,8 @@ static void ms_tick(struct tc_module *const module_inst) {
// (every millisecond).
ticks_ms += 1;
- #ifdef AUTORESET_DELAY_MS
- autoreset_tick();
+ #ifdef CIRCUITPY_AUTORELOAD_DELAY_MS
+ autoreload_tick();
#endif
}
diff --git a/atmel-samd/tick.h b/atmel-samd/tick.h
index 401d77652..3f6f4959a 100644
--- a/atmel-samd/tick.h
+++ b/atmel-samd/tick.h
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013, 2014 Damien P. George
+ * Copyright (c) 2017 Scott Shawcroft for Adafruit Industries
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal