From 9391c8f9ddadbf8b46662f9baa9f10b8826d8b02 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Sun, 6 Dec 2020 12:00:00 -0500 Subject: [PATCH] Make ResetReason and RunReason available --- shared-bindings/alarm/__init__.c | 4 ++-- shared-bindings/microcontroller/ResetReason.c | 4 ++-- shared-bindings/microcontroller/__init__.c | 1 + shared-bindings/microcontroller/__init__.h | 1 - shared-bindings/supervisor/__init__.c | 1 + 5 files changed, 6 insertions(+), 5 deletions(-) diff --git a/shared-bindings/alarm/__init__.c b/shared-bindings/alarm/__init__.c index c983130a19..a1f1a2f8c2 100644 --- a/shared-bindings/alarm/__init__.c +++ b/shared-bindings/alarm/__init__.c @@ -125,8 +125,8 @@ MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(alarm_light_sleep_until_alarms_obj, 1, MP_OB //| //| If no alarms are specified, the microcontroller will deep sleep until reset. //| -//| **If CircuitPython is connected to a host computer, `alarm.exit_and_deep_sleep_until_alarms()` -//| then the connection will be maintained, and the system will not go into deep sleep.** +//| **If CircuitPython is connected to a host computer, the connection will be maintained, +//| and the system will not go into deep sleep.** //| This allows the user to interrupt an existing program with ctrl-C, //| and to edit the files in CIRCUITPY, which would not be possible in true deep sleep. //| Thus, to use deep sleep and save significant power, you will need to disconnect from the host. diff --git a/shared-bindings/microcontroller/ResetReason.c b/shared-bindings/microcontroller/ResetReason.c index 61891934ae..1750e55204 100644 --- a/shared-bindings/microcontroller/ResetReason.c +++ b/shared-bindings/microcontroller/ResetReason.c @@ -72,6 +72,6 @@ MAKE_ENUM_MAP(mcu_reset_reason) { }; STATIC MP_DEFINE_CONST_DICT(mcu_reset_reason_locals_dict, mcu_reset_reason_locals_table); -MAKE_PRINTER(alarm, mcu_reset_reason); +MAKE_PRINTER(microcontroller, mcu_reset_reason); -MAKE_ENUM_TYPE(alarm, ResetReason, mcu_reset_reason); +MAKE_ENUM_TYPE(microcontroller, ResetReason, mcu_reset_reason); diff --git a/shared-bindings/microcontroller/__init__.c b/shared-bindings/microcontroller/__init__.c index 8a77d1df5b..035587c30f 100644 --- a/shared-bindings/microcontroller/__init__.c +++ b/shared-bindings/microcontroller/__init__.c @@ -170,6 +170,7 @@ STATIC const mp_rom_map_elem_t mcu_module_globals_table[] = { #else { MP_ROM_QSTR(MP_QSTR_watchdog), MP_ROM_PTR(&mp_const_none_obj) }, #endif + { MP_ROM_QSTR(MP_QSTR_ResetReason), MP_ROM_PTR(&mcu_reset_reason_type) }, { MP_ROM_QSTR(MP_QSTR_RunMode), MP_ROM_PTR(&mcu_runmode_type) }, { MP_ROM_QSTR(MP_QSTR_Pin), MP_ROM_PTR(&mcu_pin_type) }, { MP_ROM_QSTR(MP_QSTR_pin), MP_ROM_PTR(&mcu_pin_module) }, diff --git a/shared-bindings/microcontroller/__init__.h b/shared-bindings/microcontroller/__init__.h index ac71de4247..0dafc74c72 100644 --- a/shared-bindings/microcontroller/__init__.h +++ b/shared-bindings/microcontroller/__init__.h @@ -1,4 +1,3 @@ - /* * This file is part of the MicroPython project, http://micropython.org/ * diff --git a/shared-bindings/supervisor/__init__.c b/shared-bindings/supervisor/__init__.c index aaecdcbeb1..ad86030478 100644 --- a/shared-bindings/supervisor/__init__.c +++ b/shared-bindings/supervisor/__init__.c @@ -119,6 +119,7 @@ STATIC const mp_rom_map_elem_t supervisor_module_globals_table[] = { { MP_ROM_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) }, + { MP_ROM_QSTR(MP_QSTR_RunReason), MP_ROM_PTR(&supervisor_run_reason_type) }, { MP_ROM_QSTR(MP_QSTR_set_next_stack_limit), MP_ROM_PTR(&supervisor_set_next_stack_limit_obj) }, };