From 567f3e30a77f286713b697a0f8a85e8b31a4a27a Mon Sep 17 00:00:00 2001 From: Roy Hooper Date: Mon, 14 May 2018 16:57:50 -0400 Subject: [PATCH 1/8] Initial implementation of supervisor.reload() --- docs/library/builtins.rst | 4 ++++ py/modbuiltins.c | 1 + py/mpstate.h | 3 +++ py/obj.h | 1 + py/objexcept.c | 1 + py/runtime.c | 6 ++++++ shared-bindings/supervisor/__init__.c | 23 +++++++++++++++++++++++ 7 files changed, 39 insertions(+) diff --git a/docs/library/builtins.rst b/docs/library/builtins.rst index b45b6fe380..83246afc92 100644 --- a/docs/library/builtins.rst +++ b/docs/library/builtins.rst @@ -188,6 +188,10 @@ Exceptions .. exception:: RuntimeError +.. exception:: ReloadException + + `ReloadException` is used internally to deal with soft restarts. + .. exception:: StopIteration .. exception:: SyntaxError diff --git a/py/modbuiltins.c b/py/modbuiltins.c index 5e11b8d18c..cea87b1813 100644 --- a/py/modbuiltins.c +++ b/py/modbuiltins.c @@ -700,6 +700,7 @@ STATIC const mp_rom_map_elem_t mp_module_builtins_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_IndentationError), MP_ROM_PTR(&mp_type_IndentationError) }, { MP_ROM_QSTR(MP_QSTR_IndexError), MP_ROM_PTR(&mp_type_IndexError) }, { MP_ROM_QSTR(MP_QSTR_KeyboardInterrupt), MP_ROM_PTR(&mp_type_KeyboardInterrupt) }, + { MP_ROM_QSTR(MP_QSTR_ReloadException), MP_ROM_PTR(&mp_type_ReloadException) }, { MP_ROM_QSTR(MP_QSTR_KeyError), MP_ROM_PTR(&mp_type_KeyError) }, { MP_ROM_QSTR(MP_QSTR_LookupError), MP_ROM_PTR(&mp_type_LookupError) }, { MP_ROM_QSTR(MP_QSTR_MemoryError), MP_ROM_PTR(&mp_type_MemoryError) }, diff --git a/py/mpstate.h b/py/mpstate.h index 19a5d711ed..c509470662 100644 --- a/py/mpstate.h +++ b/py/mpstate.h @@ -136,6 +136,9 @@ typedef struct _mp_state_vm_t { mp_obj_exception_t mp_kbd_exception; #endif + // exception object of type ReloadException + mp_obj_exception_t mp_reload_exception; + // dictionary with loaded modules (may be exposed as sys.modules) mp_obj_dict_t mp_loaded_modules_dict; diff --git a/py/obj.h b/py/obj.h index e4d950b97c..d086d3c149 100644 --- a/py/obj.h +++ b/py/obj.h @@ -590,6 +590,7 @@ extern const mp_obj_type_t mp_type_ImportError; extern const mp_obj_type_t mp_type_IndentationError; extern const mp_obj_type_t mp_type_IndexError; extern const mp_obj_type_t mp_type_KeyboardInterrupt; +extern const mp_obj_type_t mp_type_ReloadException; extern const mp_obj_type_t mp_type_KeyError; extern const mp_obj_type_t mp_type_LookupError; extern const mp_obj_type_t mp_type_MemoryError; diff --git a/py/objexcept.c b/py/objexcept.c index 4844c7f92d..bcf8493c4e 100644 --- a/py/objexcept.c +++ b/py/objexcept.c @@ -249,6 +249,7 @@ const mp_obj_type_t mp_type_ ## exc_name = { \ // http://docs.python.org/3/library/exceptions.html MP_DEFINE_EXCEPTION(SystemExit, BaseException) MP_DEFINE_EXCEPTION(KeyboardInterrupt, BaseException) +MP_DEFINE_EXCEPTION(ReloadException, BaseException) MP_DEFINE_EXCEPTION(GeneratorExit, BaseException) MP_DEFINE_EXCEPTION(Exception, BaseException) #if MICROPY_PY_ASYNC_AWAIT diff --git a/py/runtime.c b/py/runtime.c index cbec82f17c..a7ff57a47f 100644 --- a/py/runtime.c +++ b/py/runtime.c @@ -84,6 +84,12 @@ void mp_init(void) { MP_STATE_VM(mp_kbd_exception).args = (mp_obj_tuple_t*)&mp_const_empty_tuple_obj; #endif + MP_STATE_VM(mp_reload_exception).base.type = &mp_type_ReloadException; + MP_STATE_VM(mp_reload_exception).traceback_alloc = 0; + MP_STATE_VM(mp_reload_exception).traceback_len = 0; + MP_STATE_VM(mp_reload_exception).traceback_data = NULL; + MP_STATE_VM(mp_reload_exception).args = (mp_obj_tuple_t*)&mp_const_empty_tuple_obj; + // call port specific initialization if any #ifdef MICROPY_PORT_INIT_FUNC MICROPY_PORT_INIT_FUNC; diff --git a/shared-bindings/supervisor/__init__.c b/shared-bindings/supervisor/__init__.c index a82459ad78..9a3fa855af 100644 --- a/shared-bindings/supervisor/__init__.c +++ b/shared-bindings/supervisor/__init__.c @@ -25,11 +25,15 @@ */ #include "py/obj.h" #include "py/runtime.h" + + #include "lib/utils/interrupt_char.h" #include "supervisor/shared/autoreload.h" + #include "supervisor/shared/rgb_led_status.h" #include "shared-bindings/supervisor/__init__.h" #include "shared-bindings/supervisor/Runtime.h" + //| :mod:`supervisor` --- Supervisor settings //| ================================================= //| @@ -91,12 +95,31 @@ STATIC mp_obj_t supervisor_set_rgb_status_brightness(mp_obj_t lvl){ } MP_DEFINE_CONST_FUN_OBJ_1(supervisor_set_rgb_status_brightness_obj, supervisor_set_rgb_status_brightness); +//| .. method:: reload() +//| +//| Reload the microcontroller (equivalent to hitting Ctrl-D at the REPL). +//| +STATIC mp_obj_t supervisor_reload(void) { + reload_next_character = true; + + MP_STATE_VM(mp_pending_exception) = MP_OBJ_FROM_PTR(&MP_STATE_VM(mp_reload_exception)); + #if MICROPY_ENABLE_SCHEDULER + if (MP_STATE_VM(sched_state) == MP_SCHED_IDLE) { + MP_STATE_VM(sched_state) = MP_SCHED_PENDING; + } + #endif + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_0(supervisor_reload_obj, supervisor_reload); + + STATIC const mp_rom_map_elem_t supervisor_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_supervisor) }, { MP_OBJ_NEW_QSTR(MP_QSTR_enable_autoreload), MP_ROM_PTR(&supervisor_enable_autoreload_obj) }, { MP_OBJ_NEW_QSTR(MP_QSTR_disable_autoreload), MP_ROM_PTR(&supervisor_disable_autoreload_obj) }, { MP_OBJ_NEW_QSTR(MP_QSTR_set_rgb_status_brightness), MP_ROM_PTR(&supervisor_set_rgb_status_brightness_obj) }, { MP_ROM_QSTR(MP_QSTR_runtime), MP_ROM_PTR(&common_hal_supervisor_runtime_obj) }, + { MP_ROM_QSTR(MP_QSTR_reload), MP_ROM_PTR(&supervisor_reload_obj) }, }; STATIC MP_DEFINE_CONST_DICT(supervisor_module_globals, supervisor_module_globals_table); From 698912633fab70b7a0fa19a84c730face41b10ff Mon Sep 17 00:00:00 2001 From: Roy Hooper Date: Mon, 14 May 2018 17:00:38 -0400 Subject: [PATCH 2/8] Rename reload_next_character to reload_requested to make it match it's intended use --- main.c | 4 ++-- ports/atmel-samd/mphalport.c | 2 +- shared-bindings/supervisor/__init__.c | 2 +- supervisor/shared/autoreload.c | 10 +++++----- supervisor/shared/autoreload.h | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/main.c b/main.c index bc37fa8711..24f27438c9 100644 --- a/main.c +++ b/main.c @@ -168,7 +168,7 @@ bool start_mp(safe_mode_t safe_mode) { reset_status_led(); if (result.return_code & PYEXEC_FORCED_EXIT) { - return reload_next_character; + return reload_requested; } } @@ -180,7 +180,7 @@ bool start_mp(safe_mode_t safe_mode) { #ifdef MICROPY_VM_HOOK_LOOP MICROPY_VM_HOOK_LOOP #endif - if (reload_next_character) { + if (reload_requested) { return true; } diff --git a/ports/atmel-samd/mphalport.c b/ports/atmel-samd/mphalport.c index cdf27fe028..c1b8ce5504 100644 --- a/ports/atmel-samd/mphalport.c +++ b/ports/atmel-samd/mphalport.c @@ -28,7 +28,7 @@ int mp_hal_stdin_rx_chr(void) { #ifdef MICROPY_VM_HOOK_LOOP MICROPY_VM_HOOK_LOOP #endif - // if (reload_next_character) { + // if (reload_requested) { // return CHAR_CTRL_D; // } if (usb_bytes_available()) { diff --git a/shared-bindings/supervisor/__init__.c b/shared-bindings/supervisor/__init__.c index 9a3fa855af..4eae404060 100644 --- a/shared-bindings/supervisor/__init__.c +++ b/shared-bindings/supervisor/__init__.c @@ -100,7 +100,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(supervisor_set_rgb_status_brightness_obj, supervisor_s //| Reload the microcontroller (equivalent to hitting Ctrl-D at the REPL). //| STATIC mp_obj_t supervisor_reload(void) { - reload_next_character = true; + reload_requested = true; MP_STATE_VM(mp_pending_exception) = MP_OBJ_FROM_PTR(&MP_STATE_VM(mp_reload_exception)); #if MICROPY_ENABLE_SCHEDULER diff --git a/supervisor/shared/autoreload.c b/supervisor/shared/autoreload.c index 39c33c05ea..fc70991fb1 100644 --- a/supervisor/shared/autoreload.c +++ b/supervisor/shared/autoreload.c @@ -32,23 +32,23 @@ volatile uint32_t autoreload_delay_ms = 0; bool autoreload_enabled = false; static bool autoreload_suspended = false; -volatile bool reload_next_character = false; +volatile bool reload_requested = false; inline void autoreload_tick() { if (autoreload_delay_ms == 0) { return; } if (autoreload_delay_ms == 1 && autoreload_enabled && - !autoreload_suspended && !reload_next_character) { + !autoreload_suspended && !reload_requested) { mp_keyboard_interrupt(); - reload_next_character = true; + reload_requested = true; } autoreload_delay_ms--; } void autoreload_enable() { autoreload_enabled = true; - reload_next_character = false; + reload_requested = false; } void autoreload_disable() { @@ -73,5 +73,5 @@ void autoreload_start() { void autoreload_stop() { autoreload_delay_ms = 0; - reload_next_character = false; + reload_requested = false; } diff --git a/supervisor/shared/autoreload.h b/supervisor/shared/autoreload.h index 62f9fe0738..bcb1001513 100644 --- a/supervisor/shared/autoreload.h +++ b/supervisor/shared/autoreload.h @@ -29,7 +29,7 @@ #include -extern volatile bool reload_next_character; +extern volatile bool reload_requested; void autoreload_tick(void); From 92b1cb574320578abe022c021c4b1891cfafbae6 Mon Sep 17 00:00:00 2001 From: Roy Hooper Date: Mon, 14 May 2018 17:41:17 -0400 Subject: [PATCH 3/8] move reload exception to reload.c --- py/py.mk | 1 + py/reload.c | 16 ++++++++++++++++ py/reload.h | 10 ++++++++++ shared-bindings/supervisor/__init__.c | 9 ++------- 4 files changed, 29 insertions(+), 7 deletions(-) create mode 100644 py/reload.c create mode 100644 py/reload.h diff --git a/py/py.mk b/py/py.mk index 21f81c35d5..e934c3a83f 100644 --- a/py/py.mk +++ b/py/py.mk @@ -188,6 +188,7 @@ PY_O_BASENAME = \ objtype.o \ objzip.o \ opmethods.o \ + reload.o \ sequence.o \ stream.o \ binary.o \ diff --git a/py/reload.c b/py/reload.c new file mode 100644 index 0000000000..95305f2c9c --- /dev/null +++ b/py/reload.c @@ -0,0 +1,16 @@ +// +// Created by Roy Hooper on 2018-05-14. +// + +#include "reload.h" +#include "py/mpstate.h" + +void mp_raise_reload_exception(void) { + MP_STATE_VM(mp_pending_exception) = MP_OBJ_FROM_PTR(&MP_STATE_VM(mp_reload_exception)); +#if MICROPY_ENABLE_SCHEDULER + if (MP_STATE_VM(sched_state) == MP_SCHED_IDLE) { + MP_STATE_VM(sched_state) = MP_SCHED_PENDING; + } +#endif + +} diff --git a/py/reload.h b/py/reload.h new file mode 100644 index 0000000000..72e84e5ca6 --- /dev/null +++ b/py/reload.h @@ -0,0 +1,10 @@ +// +// Created by Roy Hooper on 2018-05-14. +// + +#ifndef CIRCUITPYTHON_RELOAD_H +#define CIRCUITPYTHON_RELOAD_H + +void mp_raise_reload_exception(void); + +#endif //CIRCUITPYTHON_RELOAD_H diff --git a/shared-bindings/supervisor/__init__.c b/shared-bindings/supervisor/__init__.c index 4eae404060..b2b0c80d96 100644 --- a/shared-bindings/supervisor/__init__.c +++ b/shared-bindings/supervisor/__init__.c @@ -25,6 +25,7 @@ */ #include "py/obj.h" #include "py/runtime.h" + #include "py/reload.h" #include "lib/utils/interrupt_char.h" #include "supervisor/shared/autoreload.h" @@ -101,13 +102,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(supervisor_set_rgb_status_brightness_obj, supervisor_s //| STATIC mp_obj_t supervisor_reload(void) { reload_requested = true; - - MP_STATE_VM(mp_pending_exception) = MP_OBJ_FROM_PTR(&MP_STATE_VM(mp_reload_exception)); - #if MICROPY_ENABLE_SCHEDULER - if (MP_STATE_VM(sched_state) == MP_SCHED_IDLE) { - MP_STATE_VM(sched_state) = MP_SCHED_PENDING; - } - #endif + mp_raise_reload_exception(); return mp_const_none; } MP_DEFINE_CONST_FUN_OBJ_0(supervisor_reload_obj, supervisor_reload); From 06b6a10a5e54b7ba7421e2fc7ca42a2172773398 Mon Sep 17 00:00:00 2001 From: Roy Hooper Date: Mon, 14 May 2018 17:44:50 -0400 Subject: [PATCH 4/8] switch autoreload to reloadexception --- supervisor/shared/autoreload.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/supervisor/shared/autoreload.c b/supervisor/shared/autoreload.c index fc70991fb1..2a7fd1e9d8 100644 --- a/supervisor/shared/autoreload.c +++ b/supervisor/shared/autoreload.c @@ -26,8 +26,8 @@ #include "autoreload.h" -#include "lib/utils/interrupt_char.h" #include "py/mphal.h" +#include "py/reload.h" volatile uint32_t autoreload_delay_ms = 0; bool autoreload_enabled = false; @@ -40,7 +40,7 @@ inline void autoreload_tick() { } if (autoreload_delay_ms == 1 && autoreload_enabled && !autoreload_suspended && !reload_requested) { - mp_keyboard_interrupt(); + mp_raise_reload_exception(); reload_requested = true; } autoreload_delay_ms--; From 3fd9900ea75227aeab8505f1bc149eeeb1a21b56 Mon Sep 17 00:00:00 2001 From: Roy Hooper Date: Tue, 15 May 2018 13:13:59 -0400 Subject: [PATCH 5/8] disable pins on trinket_m0 so that we can free a fair bit of flash - Issue #840 --- .../boards/trinket_m0/mpconfigboard.h | 42 +++++++ .../common-hal/microcontroller/__init__.c | 104 +++++++++--------- ports/atmel-samd/samd21_pins.c | 104 +++++++++--------- 3 files changed, 146 insertions(+), 104 deletions(-) diff --git a/ports/atmel-samd/boards/trinket_m0/mpconfigboard.h b/ports/atmel-samd/boards/trinket_m0/mpconfigboard.h index 05033ad38b..92a14ba15a 100644 --- a/ports/atmel-samd/boards/trinket_m0/mpconfigboard.h +++ b/ports/atmel-samd/boards/trinket_m0/mpconfigboard.h @@ -14,3 +14,45 @@ #define CIRCUITPY_INTERNAL_NVM_SIZE 0 #define BOARD_FLASH_SIZE (0x00040000 - 0x2000 - 0x010000) + +#define IGNORE_PIN_PA03 1 +#define IGNORE_PIN_PA04 1 +#define IGNORE_PIN_PA11 1 +#define IGNORE_PIN_PA12 1 +#define IGNORE_PIN_PA13 1 +#define IGNORE_PIN_PA14 1 +#define IGNORE_PIN_PA15 1 +#define IGNORE_PIN_PA16 1 +#define IGNORE_PIN_PA17 1 +#define IGNORE_PIN_PA18 1 +#define IGNORE_PIN_PA19 1 +#define IGNORE_PIN_PA20 1 +#define IGNORE_PIN_PA21 1 +#define IGNORE_PIN_PA22 1 +#define IGNORE_PIN_PA23 1 +#define IGNORE_PIN_PA27 1 +#define IGNORE_PIN_PA28 1 +#define IGNORE_PIN_PA30 1 +#define IGNORE_PIN_PA31 1 +#define IGNORE_PIN_PB01 1 +#define IGNORE_PIN_PB02 1 +#define IGNORE_PIN_PB03 1 +#define IGNORE_PIN_PB04 1 +#define IGNORE_PIN_PB05 1 +#define IGNORE_PIN_PB06 1 +#define IGNORE_PIN_PB07 1 +#define IGNORE_PIN_PB08 1 +#define IGNORE_PIN_PB09 1 +#define IGNORE_PIN_PB10 1 +#define IGNORE_PIN_PB11 1 +#define IGNORE_PIN_PB12 1 +#define IGNORE_PIN_PB13 1 +#define IGNORE_PIN_PB14 1 +#define IGNORE_PIN_PB15 1 +#define IGNORE_PIN_PB16 1 +#define IGNORE_PIN_PB17 1 +#define IGNORE_PIN_PB22 1 +#define IGNORE_PIN_PB23 1 +#define IGNORE_PIN_PB30 1 +#define IGNORE_PIN_PB31 1 +#define IGNORE_PIN_PB00 1 diff --git a/ports/atmel-samd/common-hal/microcontroller/__init__.c b/ports/atmel-samd/common-hal/microcontroller/__init__.c index 4b8c33182f..a9c83646fd 100644 --- a/ports/atmel-samd/common-hal/microcontroller/__init__.c +++ b/ports/atmel-samd/common-hal/microcontroller/__init__.c @@ -97,162 +97,162 @@ const nvm_bytearray_obj_t common_hal_mcu_nvm_obj = { // This maps MCU pin names to pin objects. STATIC const mp_rom_map_elem_t mcu_pin_global_dict_table[] = { // Pins in datasheet order. -#ifdef PIN_PA00 +#if defined(PIN_PA00) && !defined(IGNORE_PIN_PA00) { MP_ROM_QSTR(MP_QSTR_PA00), MP_ROM_PTR(&pin_PA00) }, #endif -#ifdef PIN_PA01 +#if defined(PIN_PA01) && !defined(IGNORE_PIN_PA01) { MP_ROM_QSTR(MP_QSTR_PA01), MP_ROM_PTR(&pin_PA01) }, #endif -#ifdef PIN_PA02 +#if defined(PIN_PA02) && !defined(IGNORE_PIN_PA02) { MP_ROM_QSTR(MP_QSTR_PA02), MP_ROM_PTR(&pin_PA02) }, #endif -#ifdef PIN_PA03 +#if defined(PIN_PA03) && !defined(IGNORE_PIN_PA03) { MP_ROM_QSTR(MP_QSTR_PA03), MP_ROM_PTR(&pin_PA03) }, #endif -#ifdef PIN_PB04 +#if defined(PIN_PB04) && !defined(IGNORE_PIN_PB04) { MP_ROM_QSTR(MP_QSTR_PB04), MP_ROM_PTR(&pin_PB04) }, #endif -#ifdef PIN_PB05 +#if defined(PIN_PB05) && !defined(IGNORE_PIN_PB05) { MP_ROM_QSTR(MP_QSTR_PB05), MP_ROM_PTR(&pin_PB05) }, #endif -#ifdef PIN_PB06 +#if defined(PIN_PB06) && !defined(IGNORE_PIN_PB06) { MP_ROM_QSTR(MP_QSTR_PB06), MP_ROM_PTR(&pin_PB06) }, #endif -#ifdef PIN_PB07 +#if defined(PIN_PB07) && !defined(IGNORE_PIN_PB07) { MP_ROM_QSTR(MP_QSTR_PB07), MP_ROM_PTR(&pin_PB07) }, #endif -#ifdef PIN_PB08 +#if defined(PIN_PB08) && !defined(IGNORE_PIN_PB08) { MP_ROM_QSTR(MP_QSTR_PB08), MP_ROM_PTR(&pin_PB08) }, #endif -#ifdef PIN_PB09 +#if defined(PIN_PB09) && !defined(IGNORE_PIN_PB09) { MP_ROM_QSTR(MP_QSTR_PB09), MP_ROM_PTR(&pin_PB09) }, #endif -#ifdef PIN_PA04 +#if defined(PIN_PA04) && !defined(IGNORE_PIN_PA04) { MP_ROM_QSTR(MP_QSTR_PA04), MP_ROM_PTR(&pin_PA04) }, #endif -#ifdef PIN_PA05 +#if defined(PIN_PA05) && !defined(IGNORE_PIN_PA05) { MP_ROM_QSTR(MP_QSTR_PA05), MP_ROM_PTR(&pin_PA05) }, #endif -#ifdef PIN_PA06 +#if defined(PIN_PA06) && !defined(IGNORE_PIN_PA06) { MP_ROM_QSTR(MP_QSTR_PA06), MP_ROM_PTR(&pin_PA06) }, #endif -#ifdef PIN_PA07 +#if defined(PIN_PA07) && !defined(IGNORE_PIN_PA07) { MP_ROM_QSTR(MP_QSTR_PA07), MP_ROM_PTR(&pin_PA07) }, #endif -#ifdef PIN_PA08 +#if defined(PIN_PA08) && !defined(IGNORE_PIN_PA08) { MP_ROM_QSTR(MP_QSTR_PA08), MP_ROM_PTR(&pin_PA08) }, #endif -#ifdef PIN_PA09 +#if defined(PIN_PA09) && !defined(IGNORE_PIN_PA09) { MP_ROM_QSTR(MP_QSTR_PA09), MP_ROM_PTR(&pin_PA09) }, #endif -#ifdef PIN_PA10 +#if defined(PIN_PA10) && !defined(IGNORE_PIN_PA10) { MP_ROM_QSTR(MP_QSTR_PA10), MP_ROM_PTR(&pin_PA10) }, #endif -#ifdef PIN_PA11 +#if defined(PIN_PA11) && !defined(IGNORE_PIN_PA11) { MP_ROM_QSTR(MP_QSTR_PA11), MP_ROM_PTR(&pin_PA11) }, #endif -#ifdef PIN_PB10 +#if defined(PIN_PB10) && !defined(IGNORE_PIN_PB10) { MP_ROM_QSTR(MP_QSTR_PB10), MP_ROM_PTR(&pin_PB10) }, #endif -#ifdef PIN_PB11 +#if defined(PIN_PB11) && !defined(IGNORE_PIN_PB11) { MP_ROM_QSTR(MP_QSTR_PB11), MP_ROM_PTR(&pin_PB11) }, #endif -#ifdef PIN_PB12 +#if defined(PIN_PB12) && !defined(IGNORE_PIN_PB12) { MP_ROM_QSTR(MP_QSTR_PB12), MP_ROM_PTR(&pin_PB12) }, #endif -#ifdef PIN_PB13 +#if defined(PIN_PB13) && !defined(IGNORE_PIN_PB13) { MP_ROM_QSTR(MP_QSTR_PB13), MP_ROM_PTR(&pin_PB13) }, #endif -#ifdef PIN_PB14 +#if defined(PIN_PB14) && !defined(IGNORE_PIN_PB14) { MP_ROM_QSTR(MP_QSTR_PB14), MP_ROM_PTR(&pin_PB14) }, #endif // Second page. -#ifdef PIN_PB15 +#if defined(PIN_PB15) && !defined(IGNORE_PIN_PB15) { MP_ROM_QSTR(MP_QSTR_PB15), MP_ROM_PTR(&pin_PB15) }, #endif -#ifdef PIN_PA12 +#if defined(PIN_PA12) && !defined(IGNORE_PIN_PA12) { MP_ROM_QSTR(MP_QSTR_PA12), MP_ROM_PTR(&pin_PA12) }, #endif -#ifdef PIN_PA13 +#if defined(PIN_PA13) && !defined(IGNORE_PIN_PA13) { MP_ROM_QSTR(MP_QSTR_PA13), MP_ROM_PTR(&pin_PA13) }, #endif -#ifdef PIN_PA14 +#if defined(PIN_PA14) && !defined(IGNORE_PIN_PA14) { MP_ROM_QSTR(MP_QSTR_PA14), MP_ROM_PTR(&pin_PA14) }, #endif -#ifdef PIN_PA15 +#if defined(PIN_PA15) && !defined(IGNORE_PIN_PA15) { MP_ROM_QSTR(MP_QSTR_PA15), MP_ROM_PTR(&pin_PA15) }, #endif -#ifdef PIN_PA16 +#if defined(PIN_PA16) && !defined(IGNORE_PIN_PA16) { MP_ROM_QSTR(MP_QSTR_PA16), MP_ROM_PTR(&pin_PA16) }, #endif -#ifdef PIN_PA17 +#if defined(PIN_PA17) && !defined(IGNORE_PIN_PA17) { MP_ROM_QSTR(MP_QSTR_PA17), MP_ROM_PTR(&pin_PA17) }, #endif -#ifdef PIN_PA18 +#if defined(PIN_PA18) && !defined(IGNORE_PIN_PA18) { MP_ROM_QSTR(MP_QSTR_PA18), MP_ROM_PTR(&pin_PA18) }, #endif -#ifdef PIN_PA19 +#if defined(PIN_PA19) && !defined(IGNORE_PIN_PA19) { MP_ROM_QSTR(MP_QSTR_PA19), MP_ROM_PTR(&pin_PA19) }, #endif -#ifdef PIN_PB16 +#if defined(PIN_PB16) && !defined(IGNORE_PIN_PB16) { MP_ROM_QSTR(MP_QSTR_PB16), MP_ROM_PTR(&pin_PB16) }, #endif -#ifdef PIN_PB17 +#if defined(PIN_PB17) && !defined(IGNORE_PIN_PB17) { MP_ROM_QSTR(MP_QSTR_PB17), MP_ROM_PTR(&pin_PB17) }, #endif -#ifdef PIN_PA20 +#if defined(PIN_PA20) && !defined(IGNORE_PIN_PA20) { MP_ROM_QSTR(MP_QSTR_PA20), MP_ROM_PTR(&pin_PA20) }, #endif -#ifdef PIN_PA21 +#if defined(PIN_PA21) && !defined(IGNORE_PIN_PA21) { MP_ROM_QSTR(MP_QSTR_PA21), MP_ROM_PTR(&pin_PA21) }, #endif -#ifdef PIN_PA22 +#if defined(PIN_PA22) && !defined(IGNORE_PIN_PA22) { MP_ROM_QSTR(MP_QSTR_PA22), MP_ROM_PTR(&pin_PA22) }, #endif -#ifdef PIN_PA23 +#if defined(PIN_PA23) && !defined(IGNORE_PIN_PA23) { MP_ROM_QSTR(MP_QSTR_PA23), MP_ROM_PTR(&pin_PA23) }, #endif -#ifdef PIN_PA24 +#if defined(PIN_PA24) && !defined(IGNORE_PIN_PA24) { MP_ROM_QSTR(MP_QSTR_PA24), MP_ROM_PTR(&pin_PA24) }, #endif -#ifdef PIN_PA25 +#if defined(PIN_PA25) && !defined(IGNORE_PIN_PA25) { MP_ROM_QSTR(MP_QSTR_PA25), MP_ROM_PTR(&pin_PA25) }, #endif -#ifdef PIN_PB22 +#if defined(PIN_PB22) && !defined(IGNORE_PIN_PB22) { MP_ROM_QSTR(MP_QSTR_PB22), MP_ROM_PTR(&pin_PB22) }, #endif -#ifdef PIN_PB23 +#if defined(PIN_PB23) && !defined(IGNORE_PIN_PB23) { MP_ROM_QSTR(MP_QSTR_PB23), MP_ROM_PTR(&pin_PB23) }, #endif -#ifdef PIN_PA27 +#if defined(PIN_PA27) && !defined(IGNORE_PIN_PA27) { MP_ROM_QSTR(MP_QSTR_PA27), MP_ROM_PTR(&pin_PA27) }, #endif -#ifdef PIN_PA28 +#if defined(PIN_PA28) && !defined(IGNORE_PIN_PA28) { MP_ROM_QSTR(MP_QSTR_PA28), MP_ROM_PTR(&pin_PA28) }, #endif -#ifdef PIN_PA30 +#if defined(PIN_PA30) && !defined(IGNORE_PIN_PA30) { MP_ROM_QSTR(MP_QSTR_PA30), MP_ROM_PTR(&pin_PA30) }, #endif -#ifdef PIN_PA31 +#if defined(PIN_PA31) && !defined(IGNORE_PIN_PA31) { MP_ROM_QSTR(MP_QSTR_PA31), MP_ROM_PTR(&pin_PA31) }, #endif -#ifdef PIN_PB30 +#if defined(PIN_PB30) && !defined(IGNORE_PIN_PB30) { MP_ROM_QSTR(MP_QSTR_PB30), MP_ROM_PTR(&pin_PB30) }, #endif -#ifdef PIN_PB31 +#if defined(PIN_PB31) && !defined(IGNORE_PIN_PB31) { MP_ROM_QSTR(MP_QSTR_PB31), MP_ROM_PTR(&pin_PB31) }, #endif -#ifdef PIN_PB00 +#if defined(PIN_PB00) && !defined(IGNORE_PIN_PB00) { MP_ROM_QSTR(MP_QSTR_PB00), MP_ROM_PTR(&pin_PB00) }, #endif -#ifdef PIN_PB01 +#if defined(PIN_PB01) && !defined(IGNORE_PIN_PB01) { MP_ROM_QSTR(MP_QSTR_PB01), MP_ROM_PTR(&pin_PB01) }, #endif -#ifdef PIN_PB02 +#if defined(PIN_PB02) && !defined(IGNORE_PIN_PB02) { MP_ROM_QSTR(MP_QSTR_PB02), MP_ROM_PTR(&pin_PB02) }, #endif -#ifdef PIN_PB03 +#if defined(PIN_PB03) && !defined(IGNORE_PIN_PB03) { MP_ROM_QSTR(MP_QSTR_PB03), MP_ROM_PTR(&pin_PB03) } #endif }; diff --git a/ports/atmel-samd/samd21_pins.c b/ports/atmel-samd/samd21_pins.c index eafc4b5fb6..319870b9a3 100644 --- a/ports/atmel-samd/samd21_pins.c +++ b/ports/atmel-samd/samd21_pins.c @@ -93,21 +93,21 @@ const mcu_pin_obj_t pin_## p_name = { \ // Pins in datasheet order. // NOTE(tannewt): TC wave out 0 is commented out because the first channel is // used to vary the 16 bit timer's frequency. -#ifdef PIN_PA00 +#if defined(PIN_PA00) && !defined(IGNORE_PIN_PA00) PIN(PA00, EXTINT_CHANNEL(0), NO_ADC, NO_TOUCH, NO_SERCOM, SERCOM(1, 0), TCC(2, 0), NO_TIMER); #endif -#ifdef PIN_PA01 +#if defined(PIN_PA01) && !defined(IGNORE_PIN_PA01) PIN(PA01, EXTINT_CHANNEL(1), NO_ADC, NO_TOUCH, NO_SERCOM, SERCOM(1, 1), TCC(2, 1), NO_TIMER); #endif -#ifdef PIN_PA02 +#if defined(PIN_PA02) && !defined(IGNORE_PIN_PA02) // Touch is not allowed on A0 (PA02) on Circuit Playground Express. PIN(PA02, EXTINT_CHANNEL(2), ADC_INPUT(0), #ifdef PA02_NO_TOUCH @@ -120,140 +120,140 @@ PIN(PA02, EXTINT_CHANNEL(2), ADC_INPUT(0), NO_TIMER, NO_TIMER); #endif -#ifdef PIN_PA03 +#if defined(PIN_PA03) && !defined(IGNORE_PIN_PA03) PIN(PA03, EXTINT_CHANNEL(3), ADC_INPUT(1), TOUCH(1), NO_SERCOM, NO_SERCOM, NO_TIMER, NO_TIMER); #endif -#ifdef PIN_PB04 +#if defined(PIN_PB04) && !defined(IGNORE_PIN_PB04) PIN(PB04, EXTINT_CHANNEL(4), ADC_INPUT(12), TOUCH(10), NO_SERCOM, NO_SERCOM, NO_TIMER, NO_TIMER); #endif -#ifdef PIN_PB05 +#if defined(PIN_PB05) && !defined(IGNORE_PIN_PB05) PIN(PB05, EXTINT_CHANNEL(5), ADC_INPUT(13), TOUCH(11), NO_SERCOM, NO_SERCOM, NO_TIMER, NO_TIMER); #endif -#ifdef PIN_PB06 +#if defined(PIN_PB06) && !defined(IGNORE_PIN_PB06) PIN(PB06, EXTINT_CHANNEL(6), ADC_INPUT(14), TOUCH(12), NO_SERCOM, NO_SERCOM, NO_TIMER, NO_TIMER); #endif -#ifdef PIN_PB07 +#if defined(PIN_PB07) && !defined(IGNORE_PIN_PB07) PIN(PB07, EXTINT_CHANNEL(7), ADC_INPUT(15), TOUCH(13), NO_SERCOM, NO_SERCOM, NO_TIMER, NO_TIMER); #endif -#ifdef PIN_PB08 +#if defined(PIN_PB08) && !defined(IGNORE_PIN_PB08) PIN(PB08, EXTINT_CHANNEL(8), ADC_INPUT(2), TOUCH(14), NO_SERCOM, SERCOM(4, 0), TC(4, 0), NO_TIMER); #endif -#ifdef PIN_PB09 +#if defined(PIN_PB09) && !defined(IGNORE_PIN_PB09) PIN(PB09, EXTINT_CHANNEL(9), ADC_INPUT(3), TOUCH(15), NO_SERCOM, SERCOM(4, 1), TC(4, 1), NO_TIMER); #endif -#ifdef PIN_PA04 +#if defined(PIN_PA04) && !defined(IGNORE_PIN_PA04) PIN(PA04, EXTINT_CHANNEL(4), ADC_INPUT(4), TOUCH(2), NO_SERCOM, SERCOM(0, 0), TCC(0, 0), NO_TIMER); #endif -#ifdef PIN_PA05 +#if defined(PIN_PA05) && !defined(IGNORE_PIN_PA05) PIN(PA05, EXTINT_CHANNEL(5), ADC_INPUT(5), TOUCH(3), NO_SERCOM, SERCOM(0, 1), TCC(0, 1), NO_TIMER); #endif -#ifdef PIN_PA06 +#if defined(PIN_PA06) && !defined(IGNORE_PIN_PA06) PIN(PA06, EXTINT_CHANNEL(6), ADC_INPUT(6), TOUCH(4), NO_SERCOM, SERCOM(0, 2), TCC(1, 0), NO_TIMER); #endif -#ifdef PIN_PA07 +#if defined(PIN_PA07) && !defined(IGNORE_PIN_PA07) PIN(PA07, EXTINT_CHANNEL(7), ADC_INPUT(7), TOUCH(5), NO_SERCOM, SERCOM(0, 3), TCC(1, 1), NO_TIMER); #endif -#ifdef PIN_PA08 +#if defined(PIN_PA08) && !defined(IGNORE_PIN_PA08) PIN(PA08, NO_EXTINT, ADC_INPUT(16), NO_TOUCH, SERCOM(0, 0), SERCOM(2, 0), TCC(0, 0), TCC(1, 2)); #endif -#ifdef PIN_PA09 +#if defined(PIN_PA09) && !defined(IGNORE_PIN_PA09) PIN(PA09, EXTINT_CHANNEL(9), ADC_INPUT(17), NO_TOUCH, SERCOM(0, 1), SERCOM(2, 1), TCC(0, 1), TCC(1, 3)); #endif -#ifdef PIN_PA10 +#if defined(PIN_PA10) && !defined(IGNORE_PIN_PA10) PIN(PA10, EXTINT_CHANNEL(10), ADC_INPUT(18), NO_TOUCH, SERCOM(0, 2), SERCOM(2, 2), TCC(1, 0), TCC(0, 2)); #endif -#ifdef PIN_PA11 +#if defined(PIN_PA11) && !defined(IGNORE_PIN_PA11) PIN(PA11, EXTINT_CHANNEL(11), ADC_INPUT(19), NO_TOUCH, SERCOM(0, 3), SERCOM(2, 3), TCC(1, 1), TCC(0, 3)); #endif -#ifdef PIN_PB10 +#if defined(PIN_PB10) && !defined(IGNORE_PIN_PB10) PIN(PB10, EXTINT_CHANNEL(10), NO_ADC, NO_TOUCH, NO_SERCOM, SERCOM(4, 2), TC(5, 0), TCC(0, 4)); #endif -#ifdef PIN_PB11 +#if defined(PIN_PB11) && !defined(IGNORE_PIN_PB11) PIN(PB11, EXTINT_CHANNEL(11), NO_ADC, NO_TOUCH, NO_SERCOM, SERCOM(4, 3), TC(5, 1), TCC(0, 5)); #endif -#ifdef PIN_PB12 +#if defined(PIN_PB12) && !defined(IGNORE_PIN_PB12) PIN(PB12, EXTINT_CHANNEL(12), NO_ADC, NO_TOUCH, SERCOM(4, 0), NO_SERCOM, TC(4, 0), TCC(0, 6)); #endif -#ifdef PIN_PB13 +#if defined(PIN_PB13) && !defined(IGNORE_PIN_PB13) PIN(PB13, EXTINT_CHANNEL(13), NO_ADC, NO_TOUCH, SERCOM(4, 1), NO_SERCOM, TC(4, 1), TCC(0, 7)); #endif -#ifdef PIN_PB14 +#if defined(PIN_PB14) && !defined(IGNORE_PIN_PB14) PIN(PB14, EXTINT_CHANNEL(14), NO_ADC, NO_TOUCH, SERCOM(4, 2), NO_SERCOM, @@ -262,28 +262,28 @@ PIN(PB14, EXTINT_CHANNEL(14), NO_ADC, NO_TOUCH, #endif // Second page. -#ifdef PIN_PB15 +#if defined(PIN_PB15) && !defined(IGNORE_PIN_PB15) PIN(PB15, EXTINT_CHANNEL(15), NO_ADC, NO_TOUCH, SERCOM(4, 3), NO_SERCOM, TC(5, 1), NO_TIMER); #endif -#ifdef PIN_PA12 +#if defined(PIN_PA12) && !defined(IGNORE_PIN_PA12) PIN(PA12, EXTINT_CHANNEL(12), NO_ADC, NO_TOUCH, SERCOM(2, 0), SERCOM(4, 0), TCC(2, 0), TCC(0, 6)); #endif -#ifdef PIN_PA13 +#if defined(PIN_PA13) && !defined(IGNORE_PIN_PA13) PIN(PA13, EXTINT_CHANNEL(13), NO_ADC, NO_TOUCH, SERCOM(2, 1), SERCOM(4, 1), TCC(2, 1), TCC(0, 7)); #endif -#ifdef PIN_PA14 +#if defined(PIN_PA14) && !defined(IGNORE_PIN_PA14) PIN(PA14, EXTINT_CHANNEL(14), NO_ADC, NO_TOUCH, SERCOM(2, 2), #ifdef SERCOM4 @@ -294,7 +294,7 @@ PIN(PA14, EXTINT_CHANNEL(14), NO_ADC, NO_TOUCH, TC(3, 0), TCC(0, 4)); #endif -#ifdef PIN_PA15 +#if defined(PIN_PA15) && !defined(IGNORE_PIN_PA15) PIN(PA15, EXTINT_CHANNEL(15), NO_ADC, NO_TOUCH, SERCOM(2, 3), #ifdef SERCOM4 @@ -305,35 +305,35 @@ PIN(PA15, EXTINT_CHANNEL(15), NO_ADC, NO_TOUCH, TC(3, 1), TCC(0, 5)); #endif -#ifdef PIN_PA16 +#if defined(PIN_PA16) && !defined(IGNORE_PIN_PA16) PIN(PA16, EXTINT_CHANNEL(0), NO_ADC, NO_TOUCH, SERCOM(1, 0), SERCOM(3, 0), TCC(2, 0), TCC(0, 6)); #endif -#ifdef PIN_PA17 +#if defined(PIN_PA17) && !defined(IGNORE_PIN_PA17) PIN(PA17, EXTINT_CHANNEL(1), NO_ADC, NO_TOUCH, SERCOM(1, 1), SERCOM(3, 1), TCC(2, 1), TCC(0, 7)); #endif -#ifdef PIN_PA18 +#if defined(PIN_PA18) && !defined(IGNORE_PIN_PA18) PIN(PA18, EXTINT_CHANNEL(2), NO_ADC, NO_TOUCH, SERCOM(1, 2), SERCOM(3, 2), TC(3, 0), TCC(0, 2)); #endif -#ifdef PIN_PA19 +#if defined(PIN_PA19) && !defined(IGNORE_PIN_PA19) PIN(PA19, EXTINT_CHANNEL(3), NO_ADC, NO_TOUCH, SERCOM(1, 3), SERCOM(3, 3), TC(3, 1), TCC(0, 3)); #endif -#ifdef PIN_PB16 +#if defined(PIN_PB16) && !defined(IGNORE_PIN_PB16) PIN(PB16, EXTINT_CHANNEL(0), NO_ADC, NO_TOUCH, SERCOM(5, 0), NO_SERCOM, @@ -344,7 +344,7 @@ PIN(PB16, EXTINT_CHANNEL(0), NO_ADC, NO_TOUCH, #endif TCC(0, 4)); #endif -#ifdef PIN_PB17 +#if defined(PIN_PB17) && !defined(IGNORE_PIN_PB17) PIN(PB17, EXTINT_CHANNEL(1), NO_ADC, NO_TOUCH, SERCOM(5, 1), NO_SERCOM, @@ -355,7 +355,7 @@ PIN(PB17, EXTINT_CHANNEL(1), NO_ADC, NO_TOUCH, #endif TCC(0, 5)); #endif -#ifdef PIN_PA20 +#if defined(PIN_PA20) && !defined(IGNORE_PIN_PA20) PIN(PA20, EXTINT_CHANNEL(4), NO_ADC, NO_TOUCH, SERCOM(5, 2), SERCOM(3, 2), @@ -366,7 +366,7 @@ PIN(PA20, EXTINT_CHANNEL(4), NO_ADC, NO_TOUCH, #endif TCC(0, 6)); #endif -#ifdef PIN_PA21 +#if defined(PIN_PA21) && !defined(IGNORE_PIN_PA21) PIN(PA21, EXTINT_CHANNEL(5), NO_ADC, NO_TOUCH, SERCOM(5, 3), SERCOM(3, 3), @@ -377,7 +377,7 @@ PIN(PA21, EXTINT_CHANNEL(5), NO_ADC, NO_TOUCH, #endif TCC(0, 7)); #endif -#ifdef PIN_PA22 +#if defined(PIN_PA22) && !defined(IGNORE_PIN_PA22) PIN(PA22, EXTINT_CHANNEL(6), NO_ADC, NO_TOUCH, SERCOM(3, 0), #ifdef SERCOM5 @@ -388,7 +388,7 @@ PIN(PA22, EXTINT_CHANNEL(6), NO_ADC, NO_TOUCH, TC(4, 0), TCC(0, 4)); #endif -#ifdef PIN_PA23 +#if defined(PIN_PA23) && !defined(IGNORE_PIN_PA23) PIN(PA23, EXTINT_CHANNEL(7), NO_ADC, NO_TOUCH, SERCOM(3, 1), #ifdef SERCOM5 @@ -399,7 +399,7 @@ PIN(PA23, EXTINT_CHANNEL(7), NO_ADC, NO_TOUCH, TC(4, 1), TCC(0, 5)); #endif -#ifdef PIN_PA24 +#if defined(PIN_PA24) && !defined(IGNORE_PIN_PA24) PIN(PA24, EXTINT_CHANNEL(12), NO_ADC, NO_TOUCH, SERCOM(3, 2), #ifdef SERCOM5 @@ -410,7 +410,7 @@ PIN(PA24, EXTINT_CHANNEL(12), NO_ADC, NO_TOUCH, TC(5, 0), TCC(0, 2)); #endif -#ifdef PIN_PA25 +#if defined(PIN_PA25) && !defined(IGNORE_PIN_PA25) PIN(PA25, EXTINT_CHANNEL(13), NO_ADC, NO_TOUCH, SERCOM(3, 3), #ifdef SERCOM5 @@ -421,7 +421,7 @@ PIN(PA25, EXTINT_CHANNEL(13), NO_ADC, NO_TOUCH, TC(5, 1), TCC(1, 3)); #endif -#ifdef PIN_PB22 +#if defined(PIN_PB22) && !defined(IGNORE_PIN_PB22) PIN(PB22, EXTINT_CHANNEL(6), NO_ADC, NO_TOUCH, NO_SERCOM, SERCOM(5, 2), @@ -432,7 +432,7 @@ PIN(PB22, EXTINT_CHANNEL(6), NO_ADC, NO_TOUCH, #endif NO_TIMER); #endif -#ifdef PIN_PB23 +#if defined(PIN_PB23) && !defined(IGNORE_PIN_PB23) PIN(PB23, EXTINT_CHANNEL(7), NO_ADC, NO_TOUCH, NO_SERCOM, SERCOM(5, 3), @@ -443,49 +443,49 @@ PIN(PB23, EXTINT_CHANNEL(7), NO_ADC, NO_TOUCH, #endif NO_TIMER); #endif -#ifdef PIN_PA27 +#if defined(PIN_PA27) && !defined(IGNORE_PIN_PA27) PIN(PA27, EXTINT_CHANNEL(15), NO_ADC, NO_TOUCH, NO_SERCOM, NO_SERCOM, NO_TIMER, NO_TIMER); #endif -#ifdef PIN_PA28 +#if defined(PIN_PA28) && !defined(IGNORE_PIN_PA28) PIN(PA28, EXTINT_CHANNEL(8), NO_ADC, NO_TOUCH, NO_SERCOM, NO_SERCOM, NO_TIMER, NO_TIMER); #endif -#ifdef PIN_PA30 +#if defined(PIN_PA30) && !defined(IGNORE_PIN_PA30) PIN(PA30, EXTINT_CHANNEL(10), NO_ADC, NO_TOUCH, NO_SERCOM, SERCOM(1, 2), TCC(1, 0), NO_TIMER); #endif -#ifdef PIN_PA31 +#if defined(PIN_PA31) && !defined(IGNORE_PIN_PA31) PIN(PA31, EXTINT_CHANNEL(11), NO_ADC, NO_TOUCH, NO_SERCOM, SERCOM(1, 3), TCC(1, 1), NO_TIMER); #endif -#ifdef PIN_PB30 +#if defined(PIN_PB30) && !defined(IGNORE_PIN_PB30) PIN(PB30, EXTINT_CHANNEL(14), NO_ADC, NO_TOUCH, NO_SERCOM, SERCOM(5, 0), TCC(0, 0), TCC(1, 2)); #endif -#ifdef PIN_PB31 +#if defined(PIN_PB31) && !defined(IGNORE_PIN_PB31) PIN(PB31, EXTINT_CHANNEL(15), NO_ADC, NO_TOUCH, NO_SERCOM, SERCOM(5, 1), TCC(0, 1), TCC(1, 3)); #endif -#ifdef PIN_PB00 +#if defined(PIN_PB00) && !defined(IGNORE_PIN_PB00) PIN(PB00, EXTINT_CHANNEL(0), ADC_INPUT(8), TOUCH(6), NO_SERCOM, SERCOM(5, 2), @@ -496,7 +496,7 @@ PIN(PB00, EXTINT_CHANNEL(0), ADC_INPUT(8), TOUCH(6), #endif NO_TIMER); #endif -#ifdef PIN_PB01 +#if defined(PIN_PB01) && !defined(IGNORE_PIN_PB01) PIN(PB01, EXTINT_CHANNEL(1), ADC_INPUT(9), TOUCH(7), NO_SERCOM, SERCOM(5, 3)), @@ -507,7 +507,7 @@ PIN(PB01, EXTINT_CHANNEL(1), ADC_INPUT(9), TOUCH(7), #endif NO_TIMER; #endif -#ifdef PIN_PB02 +#if defined(PIN_PB02) && !defined(IGNORE_PIN_PB02) PIN(PB02, EXTINT_CHANNEL(2), ADC_INPUT(10), TOUCH(8), NO_SERCOM, SERCOM(5, 0), @@ -518,7 +518,7 @@ PIN(PB02, EXTINT_CHANNEL(2), ADC_INPUT(10), TOUCH(8), #endif NO_TIMER); #endif -#ifdef PIN_PB03 +#if defined(PIN_PB03) && !defined(IGNORE_PIN_PB03) PIN(PB03, EXTINT_CHANNEL(3), ADC_INPUT(11), TOUCH(9), NO_SERCOM, SERCOM(5, 1), From 7d443c87b39903f08e5f888117ee2f406acd6b01 Mon Sep 17 00:00:00 2001 From: Roy Hooper Date: Tue, 15 May 2018 14:03:39 -0400 Subject: [PATCH 6/8] Add gemma_m0 pin exclusions --- .../boards/gemma_m0/mpconfigboard.h | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/ports/atmel-samd/boards/gemma_m0/mpconfigboard.h b/ports/atmel-samd/boards/gemma_m0/mpconfigboard.h index 6457d481f3..45a6a694e9 100644 --- a/ports/atmel-samd/boards/gemma_m0/mpconfigboard.h +++ b/ports/atmel-samd/boards/gemma_m0/mpconfigboard.h @@ -15,3 +15,48 @@ #include "internal_flash.h" #define BOARD_FLASH_SIZE (0x00040000 - 0x2000 - 0x010000) + +#define IGNORE_PIN_PA03 1 +#define IGNORE_PIN_PA06 1 +#define IGNORE_PIN_PA07 1 +#define IGNORE_PIN_PA08 1 +#define IGNORE_PIN_PA09 1 +#define IGNORE_PIN_PA10 1 +#define IGNORE_PIN_PA11 1 +#define IGNORE_PIN_PA12 1 +#define IGNORE_PIN_PA13 1 +#define IGNORE_PIN_PA14 1 +#define IGNORE_PIN_PA15 1 +#define IGNORE_PIN_PA16 1 +#define IGNORE_PIN_PA17 1 +#define IGNORE_PIN_PA18 1 +#define IGNORE_PIN_PA19 1 +#define IGNORE_PIN_PA20 1 +#define IGNORE_PIN_PA21 1 +#define IGNORE_PIN_PA22 1 +#define IGNORE_PIN_PA27 1 +#define IGNORE_PIN_PA28 1 +#define IGNORE_PIN_PA30 1 +#define IGNORE_PIN_PA31 1 +#define IGNORE_PIN_PB01 1 +#define IGNORE_PIN_PB02 1 +#define IGNORE_PIN_PB03 1 +#define IGNORE_PIN_PB04 1 +#define IGNORE_PIN_PB05 1 +#define IGNORE_PIN_PB06 1 +#define IGNORE_PIN_PB07 1 +#define IGNORE_PIN_PB08 1 +#define IGNORE_PIN_PB09 1 +#define IGNORE_PIN_PB10 1 +#define IGNORE_PIN_PB11 1 +#define IGNORE_PIN_PB12 1 +#define IGNORE_PIN_PB13 1 +#define IGNORE_PIN_PB14 1 +#define IGNORE_PIN_PB15 1 +#define IGNORE_PIN_PB16 1 +#define IGNORE_PIN_PB17 1 +#define IGNORE_PIN_PB22 1 +#define IGNORE_PIN_PB23 1 +#define IGNORE_PIN_PB30 1 +#define IGNORE_PIN_PB31 1 +#define IGNORE_PIN_PB00 1 From 9f2026158b8a2d99ac41d1ee6a894db40d508718 Mon Sep 17 00:00:00 2001 From: Roy Hooper Date: Tue, 15 May 2018 14:54:12 -0400 Subject: [PATCH 7/8] add ugly workaround for apt failing - retry --- .travis.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 1e18640c81..4749416e0f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -42,7 +42,11 @@ notifications: before_script: - sudo dpkg --add-architecture i386 - - sudo apt-get install -y python3 gcc-multilib pkg-config libffi-dev libffi-dev:i386 qemu-system + - | + sudo apt-get install -y python3 gcc-multilib pkg-config libffi-dev libffi-dev:i386 qemu-system || + sleep 30 || + sudo apt-get install -y python3 gcc-multilib pkg-config libffi-dev libffi-dev:i386 qemu-system + - ([[ -z "$TRAVIS_TEST" ]] || sudo apt-get install -y qemu-system) - ([[ -z "$TRAVIS_BOARD" ]] || (wget https://s3.amazonaws.com/adafruit-circuit-python/gcc-arm-embedded_7-2017q4-1~trusty3_amd64.deb && sudo dpkg -i gcc-arm-embedded*_amd64.deb)) - ([[ $TRAVIS_TEST != "qemu" ]] || (wget https://s3.amazonaws.com/adafruit-circuit-python/gcc-arm-embedded_7-2017q4-1~trusty3_amd64.deb && sudo dpkg -i gcc-arm-embedded*_amd64.deb)) From 918d30cb97c8d15ad27c6a59f68c55dc211b425a Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Wed, 16 May 2018 16:28:43 -0500 Subject: [PATCH 8/8] Rephrase the doc --- shared-bindings/supervisor/__init__.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared-bindings/supervisor/__init__.c b/shared-bindings/supervisor/__init__.c index b2b0c80d96..e6429be320 100644 --- a/shared-bindings/supervisor/__init__.c +++ b/shared-bindings/supervisor/__init__.c @@ -98,7 +98,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(supervisor_set_rgb_status_brightness_obj, supervisor_s //| .. method:: reload() //| -//| Reload the microcontroller (equivalent to hitting Ctrl-D at the REPL). +//| Reload the main Python code and run it (equivalent to hitting Ctrl-D at the REPL). //| STATIC mp_obj_t supervisor_reload(void) { reload_requested = true;