From e5ff55b15c8cc67c2ece3b8857b5805109b858b3 Mon Sep 17 00:00:00 2001 From: microDev <70126934+microDev1@users.noreply.github.com> Date: Wed, 23 Sep 2020 12:54:07 +0530 Subject: [PATCH] Renamed alarm modules --- .../{io_alarm => alarm_io}/__init__.c | 6 +-- .../{time_alarm => alarm_time}/__init__.c | 6 +-- .../common-hal/microcontroller/__init__.c | 8 +-- ports/esp32s2/mpconfigport.mk | 4 +- py/circuitpy_defns.mk | 12 ++--- py/circuitpy_mpconfig.h | 20 +++---- py/circuitpy_mpconfig.mk | 8 +-- shared-bindings/alarm_io/__init__.c | 54 +++++++++++++++++++ shared-bindings/alarm_io/__init__.h | 17 ++++++ shared-bindings/alarm_time/__init__.c | 50 +++++++++++++++++ shared-bindings/alarm_time/__init__.h | 15 ++++++ shared-bindings/io_alarm/__init__.c | 54 ------------------- shared-bindings/io_alarm/__init__.h | 17 ------ shared-bindings/microcontroller/__init__.h | 4 +- shared-bindings/time_alarm/__init__.c | 50 ----------------- shared-bindings/time_alarm/__init__.h | 15 ------ 16 files changed, 170 insertions(+), 170 deletions(-) rename ports/esp32s2/common-hal/{io_alarm => alarm_io}/__init__.c (83%) rename ports/esp32s2/common-hal/{time_alarm => alarm_time}/__init__.c (62%) create mode 100644 shared-bindings/alarm_io/__init__.c create mode 100644 shared-bindings/alarm_io/__init__.h create mode 100644 shared-bindings/alarm_time/__init__.c create mode 100644 shared-bindings/alarm_time/__init__.h delete mode 100644 shared-bindings/io_alarm/__init__.c delete mode 100644 shared-bindings/io_alarm/__init__.h delete mode 100644 shared-bindings/time_alarm/__init__.c delete mode 100644 shared-bindings/time_alarm/__init__.h diff --git a/ports/esp32s2/common-hal/io_alarm/__init__.c b/ports/esp32s2/common-hal/alarm_io/__init__.c similarity index 83% rename from ports/esp32s2/common-hal/io_alarm/__init__.c rename to ports/esp32s2/common-hal/alarm_io/__init__.c index 5d926d4e93..9aa28f4156 100644 --- a/ports/esp32s2/common-hal/io_alarm/__init__.c +++ b/ports/esp32s2/common-hal/alarm_io/__init__.c @@ -1,9 +1,9 @@ -#include "shared-bindings/io_alarm/__init__.h" +#include "shared-bindings/alarm_io/__init__.h" #include "esp_sleep.h" #include "driver/rtc_io.h" -mp_obj_t common_hal_io_alarm_pin_state (io_alarm_obj_t *self_in) { +mp_obj_t common_hal_alarm_io_pin_state (alarm_io_obj_t *self_in) { if (!rtc_gpio_is_valid_gpio(self_in->gpio)) { mp_raise_ValueError(translate("io must be rtc io")); } @@ -22,6 +22,6 @@ mp_obj_t common_hal_io_alarm_pin_state (io_alarm_obj_t *self_in) { return self_in; } -void common_hal_io_alarm_disable (void) { +void common_hal_alarm_io_disable (void) { esp_sleep_disable_wakeup_source(ESP_SLEEP_WAKEUP_EXT0 | ESP_SLEEP_WAKEUP_EXT1); } diff --git a/ports/esp32s2/common-hal/time_alarm/__init__.c b/ports/esp32s2/common-hal/alarm_time/__init__.c similarity index 62% rename from ports/esp32s2/common-hal/time_alarm/__init__.c rename to ports/esp32s2/common-hal/alarm_time/__init__.c index a33376bb09..fb601e6be0 100644 --- a/ports/esp32s2/common-hal/time_alarm/__init__.c +++ b/ports/esp32s2/common-hal/alarm_time/__init__.c @@ -1,13 +1,13 @@ #include "esp_sleep.h" -#include "shared-bindings/time_alarm/__init__.h" +#include "shared-bindings/alarm_time/__init__.h" -void common_hal_time_alarm_duration (uint32_t ms) { +void common_hal_alarm_time_duration (uint32_t ms) { if (esp_sleep_enable_timer_wakeup((ms) * 1000) == ESP_ERR_INVALID_ARG) { mp_raise_ValueError(translate("time out of range")); } } -void common_hal_time_alarm_disable (void) { +void common_hal_alarm_time_disable (void) { esp_sleep_disable_wakeup_source(ESP_SLEEP_WAKEUP_TIMER); } diff --git a/ports/esp32s2/common-hal/microcontroller/__init__.c b/ports/esp32s2/common-hal/microcontroller/__init__.c index 8b9fef2f98..e79c602020 100644 --- a/ports/esp32s2/common-hal/microcontroller/__init__.c +++ b/ports/esp32s2/common-hal/microcontroller/__init__.c @@ -99,13 +99,13 @@ mp_obj_t common_hal_mcu_get_wake_alarm(void) { switch (esp_sleep_get_wakeup_cause()) { case ESP_SLEEP_WAKEUP_TIMER: ; //Wake up from timer. - time_alarm_obj_t *timer = m_new_obj(time_alarm_obj_t); - timer->base.type = &time_alarm_type; + alarm_time_obj_t *timer = m_new_obj(alarm_time_obj_t); + timer->base.type = &alarm_time_type; return timer; case ESP_SLEEP_WAKEUP_EXT0: ; //Wake up from GPIO - io_alarm_obj_t *ext0 = m_new_obj(io_alarm_obj_t); - ext0->base.type = &io_alarm_type; + alarm_io_obj_t *ext0 = m_new_obj(alarm_io_obj_t); + ext0->base.type = &alarm_io_type; return ext0; case ESP_SLEEP_WAKEUP_EXT1: //Wake up from GPIO, returns -> esp_sleep_get_ext1_wakeup_status() diff --git a/ports/esp32s2/mpconfigport.mk b/ports/esp32s2/mpconfigport.mk index 0f8f3ada53..4aaf1d00c7 100644 --- a/ports/esp32s2/mpconfigport.mk +++ b/ports/esp32s2/mpconfigport.mk @@ -22,8 +22,8 @@ CIRCUITPY_FREQUENCYIO = 0 CIRCUITPY_I2CPERIPHERAL = 0 CIRCUITPY_ROTARYIO = 0 CIRCUITPY_NVM = 0 -CIRCUITPY_TIME_ALARM = 1 -CIRCUITPY_IO_ALARM = 1 +CIRCUITPY_ALARM_TIME = 1 +CIRCUITPY_ALARM_IO = 1 # We don't have enough endpoints to include MIDI. CIRCUITPY_USB_MIDI = 0 CIRCUITPY_WIFI = 1 diff --git a/py/circuitpy_defns.mk b/py/circuitpy_defns.mk index 672eeda40c..4c57165936 100644 --- a/py/circuitpy_defns.mk +++ b/py/circuitpy_defns.mk @@ -259,11 +259,11 @@ endif ifeq ($(CIRCUITPY_TIME),1) SRC_PATTERNS += time/% endif -ifeq ($(CIRCUITPY_TIME_ALARM),1) -SRC_PATTERNS += time_alarm/% +ifeq ($(CIRCUITPY_ALARM_TIME),1) +SRC_PATTERNS += alarm_time/% endif -ifeq ($(CIRCUITPY_IO_ALARM),1) -SRC_PATTERNS += io_alarm/% +ifeq ($(CIRCUITPY_ALARM_IO),1) +SRC_PATTERNS += alarm_io/% endif ifeq ($(CIRCUITPY_TOUCHIO),1) SRC_PATTERNS += touchio/% @@ -366,8 +366,8 @@ SRC_COMMON_HAL_ALL = \ ssl/SSLContext.c \ supervisor/Runtime.c \ supervisor/__init__.c \ - time_alarm/__init__.c \ - io_alarm/__init__.c \ + alarm_time/__init__.c \ + alarm_io/__init__.c \ watchdog/WatchDogMode.c \ watchdog/WatchDogTimer.c \ watchdog/__init__.c \ diff --git a/py/circuitpy_mpconfig.h b/py/circuitpy_mpconfig.h index d899ecacb6..94072f580b 100644 --- a/py/circuitpy_mpconfig.h +++ b/py/circuitpy_mpconfig.h @@ -663,18 +663,18 @@ extern const struct _mp_obj_module_t time_module; #define TIME_MODULE_ALT_NAME #endif -#if CIRCUITPY_TIME_ALARM -extern const struct _mp_obj_module_t time_alarm_module; -#define TIME_ALARM_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_time_alarm), (mp_obj_t)&time_alarm_module }, +#if CIRCUITPY_ALARM_TIME +extern const struct _mp_obj_module_t alarm_time_module; +#define ALARM_TIME_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_alarm_time), (mp_obj_t)&alarm_time_module }, #else -#define TIME_ALARM_MODULE +#define ALARM_TIME_MODULE #endif -#if CIRCUITPY_IO_ALARM -extern const struct _mp_obj_module_t io_alarm_module; -#define IO_ALARM_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_io_alarm), (mp_obj_t)&io_alarm_module }, +#if CIRCUITPY_ALARM_IO +extern const struct _mp_obj_module_t alarm_io_module; +#define ALARM_IO_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_alarm_io), (mp_obj_t)&alarm_io_module }, #else -#define IO_ALARM_MODULE +#define ALARM_IO_MODULE #endif #if CIRCUITPY_TOUCHIO @@ -835,8 +835,8 @@ extern const struct _mp_obj_module_t wifi_module; STRUCT_MODULE \ SUPERVISOR_MODULE \ TOUCHIO_MODULE \ - TIME_ALARM_MODULE \ - IO_ALARM_MODULE \ + ALARM_TIME_MODULE \ + ALARM_IO_MODULE \ UHEAP_MODULE \ USB_HID_MODULE \ USB_MIDI_MODULE \ diff --git a/py/circuitpy_mpconfig.mk b/py/circuitpy_mpconfig.mk index 4cce2a0a1a..e8619347dd 100644 --- a/py/circuitpy_mpconfig.mk +++ b/py/circuitpy_mpconfig.mk @@ -234,11 +234,11 @@ CFLAGS += -DCIRCUITPY_TERMINALIO=$(CIRCUITPY_TERMINALIO) CIRCUITPY_TIME ?= 1 CFLAGS += -DCIRCUITPY_TIME=$(CIRCUITPY_TIME) -CIRCUITPY_TIME_ALARM ?= 0 -CFLAGS += -DCIRCUITPY_TIME_ALARM=$(CIRCUITPY_TIME_ALARM) +CIRCUITPY_ALARM_TIME ?= 0 +CFLAGS += -DCIRCUITPY_ALARM_TIME=$(CIRCUITPY_ALARM_TIME) -CIRCUITPY_IO_ALARM ?= 0 -CFLAGS += -DCIRCUITPY_IO_ALARM=$(CIRCUITPY_IO_ALARM) +CIRCUITPY_ALARM_IO ?= 0 +CFLAGS += -DCIRCUITPY_ALARM_IO=$(CIRCUITPY_ALARM_IO) # touchio might be native or generic. See circuitpy_defns.mk. CIRCUITPY_TOUCHIO_USE_NATIVE ?= 0 diff --git a/shared-bindings/alarm_io/__init__.c b/shared-bindings/alarm_io/__init__.c new file mode 100644 index 0000000000..09783d0d08 --- /dev/null +++ b/shared-bindings/alarm_io/__init__.c @@ -0,0 +1,54 @@ +#include "py/obj.h" + +#include "shared-bindings/alarm_io/__init__.h" +#include "shared-bindings/microcontroller/Pin.h" + +//| Set Pin Wakeup +//| +STATIC mp_obj_t alarm_io_pin_state(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { + enum { ARG_level, ARG_pull }; + static const mp_arg_t allowed_args[] = { + { MP_QSTR_level, MP_ARG_INT | MP_ARG_KW_ONLY | MP_ARG_REQUIRED }, + { MP_QSTR_pull, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_bool = false} }, + }; + + mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; + mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); + + mcu_pin_obj_t *pin = validate_obj_is_pin(pos_args[0]); + alarm_io_obj_t *self = m_new_obj(alarm_io_obj_t); + + self->base.type = &alarm_io_type; + self->gpio = pin->number; + self->level = args[ARG_level].u_int; + self->pull = args[ARG_pull].u_bool; + + return common_hal_alarm_io_pin_state(self); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_KW(alarm_io_pin_state_obj, 1, alarm_io_pin_state); + + +//| Disable Pin Wakeup +//| +STATIC mp_obj_t alarm_io_disable(void) { + common_hal_alarm_io_disable(); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_0(alarm_io_disable_obj, alarm_io_disable); + +STATIC const mp_rom_map_elem_t alarm_io_module_globals_table[] = { + { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_alarm_io) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_PinState), MP_ROM_PTR(&alarm_io_pin_state_obj) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_Disable), MP_ROM_PTR(&alarm_io_disable_obj) }, +}; +STATIC MP_DEFINE_CONST_DICT(alarm_io_module_globals, alarm_io_module_globals_table); + +const mp_obj_module_t alarm_io_module = { + .base = { &mp_type_module }, + .globals = (mp_obj_dict_t*)&alarm_io_module_globals, +}; + +const mp_obj_type_t alarm_io_type = { + { &mp_type_type }, + .name = MP_QSTR_ioAlarm, +}; diff --git a/shared-bindings/alarm_io/__init__.h b/shared-bindings/alarm_io/__init__.h new file mode 100644 index 0000000000..0a53497c01 --- /dev/null +++ b/shared-bindings/alarm_io/__init__.h @@ -0,0 +1,17 @@ +#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_ALARM_IO___INIT___H +#define MICROPY_INCLUDED_SHARED_BINDINGS_ALARM_IO___INIT___H + +#include "py/runtime.h" + +typedef struct { + mp_obj_base_t base; + uint8_t gpio, level; + bool pull; +} alarm_io_obj_t; + +extern const mp_obj_type_t alarm_io_type; + +extern mp_obj_t common_hal_alarm_io_pin_state (alarm_io_obj_t *self_in); +extern void common_hal_alarm_io_disable (void); + +#endif //MICROPY_INCLUDED_SHARED_BINDINGS_ALARM_IO___INIT___H diff --git a/shared-bindings/alarm_time/__init__.c b/shared-bindings/alarm_time/__init__.c new file mode 100644 index 0000000000..22fb935064 --- /dev/null +++ b/shared-bindings/alarm_time/__init__.c @@ -0,0 +1,50 @@ +#include "py/obj.h" +#include "shared-bindings/alarm_time/__init__.h" + +//| Set Timer Wakeup +//| +STATIC mp_obj_t alarm_time_duration(mp_obj_t seconds_o) { + #if MICROPY_PY_BUILTINS_FLOAT + mp_float_t seconds = mp_obj_get_float(seconds_o); + mp_float_t msecs = 1000.0f * seconds + 0.5f; + #else + mp_int_t seconds = mp_obj_get_int(seconds_o); + mp_int_t msecs = 1000 * seconds; + #endif + + if (seconds < 0) { + mp_raise_ValueError(translate("sleep length must be non-negative")); + } + common_hal_alarm_time_duration(msecs); + + alarm_time_obj_t *self = m_new_obj(alarm_time_obj_t); + self->base.type = &alarm_time_type; + + return self; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(alarm_time_duration_obj, alarm_time_duration); + +//| Disable Timer Wakeup +//| +STATIC mp_obj_t alarm_time_disable(void) { + common_hal_alarm_time_disable(); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_0(alarm_time_disable_obj, alarm_time_disable); + +STATIC const mp_rom_map_elem_t alarm_time_module_globals_table[] = { + { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_alarm_time) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_Duration), MP_ROM_PTR(&alarm_time_duration_obj) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_Disable), MP_ROM_PTR(&alarm_time_disable_obj) }, +}; +STATIC MP_DEFINE_CONST_DICT(alarm_time_module_globals, alarm_time_module_globals_table); + +const mp_obj_module_t alarm_time_module = { + .base = { &mp_type_module }, + .globals = (mp_obj_dict_t*)&alarm_time_module_globals, +}; + +const mp_obj_type_t alarm_time_type = { + { &mp_type_type }, + .name = MP_QSTR_timeAlarm, +}; diff --git a/shared-bindings/alarm_time/__init__.h b/shared-bindings/alarm_time/__init__.h new file mode 100644 index 0000000000..d69aa5a443 --- /dev/null +++ b/shared-bindings/alarm_time/__init__.h @@ -0,0 +1,15 @@ +#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_ALARM_TIME___INIT___H +#define MICROPY_INCLUDED_SHARED_BINDINGS_ALARM_TIME___INIT___H + +#include "py/runtime.h" + +typedef struct { + mp_obj_base_t base; +} alarm_time_obj_t; + +extern const mp_obj_type_t alarm_time_type; + +extern void common_hal_alarm_time_duration(uint32_t); +extern void common_hal_alarm_time_disable (void); + +#endif //MICROPY_INCLUDED_SHARED_BINDINGS_ALARM_TIME___INIT___H diff --git a/shared-bindings/io_alarm/__init__.c b/shared-bindings/io_alarm/__init__.c deleted file mode 100644 index 934b34e49d..0000000000 --- a/shared-bindings/io_alarm/__init__.c +++ /dev/null @@ -1,54 +0,0 @@ -#include "py/obj.h" - -#include "shared-bindings/io_alarm/__init__.h" -#include "shared-bindings/microcontroller/Pin.h" - -//| Set Pin Wakeup -//| -STATIC mp_obj_t io_alarm_pin_state(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { - enum { ARG_level, ARG_pull }; - static const mp_arg_t allowed_args[] = { - { MP_QSTR_level, MP_ARG_INT | MP_ARG_KW_ONLY | MP_ARG_REQUIRED }, - { MP_QSTR_pull, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_bool = false} }, - }; - - mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; - mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); - - mcu_pin_obj_t *pin = validate_obj_is_pin(pos_args[0]); - io_alarm_obj_t *self = m_new_obj(io_alarm_obj_t); - - self->base.type = &io_alarm_type; - self->gpio = pin->number; - self->level = args[ARG_level].u_int; - self->pull = args[ARG_pull].u_bool; - - return common_hal_io_alarm_pin_state(self); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(io_alarm_pin_state_obj, 1, io_alarm_pin_state); - - -//| Disable Pin Wakeup -//| -STATIC mp_obj_t io_alarm_disable(void) { - common_hal_io_alarm_disable(); - return mp_const_none; -} -STATIC MP_DEFINE_CONST_FUN_OBJ_0(io_alarm_disable_obj, io_alarm_disable); - -STATIC const mp_rom_map_elem_t io_alarm_module_globals_table[] = { - { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_io_alarm) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_PinState), MP_ROM_PTR(&io_alarm_pin_state_obj) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_Disable), MP_ROM_PTR(&io_alarm_disable_obj) }, -}; -STATIC MP_DEFINE_CONST_DICT(io_alarm_module_globals, io_alarm_module_globals_table); - -const mp_obj_module_t io_alarm_module = { - .base = { &mp_type_module }, - .globals = (mp_obj_dict_t*)&io_alarm_module_globals, -}; - -const mp_obj_type_t io_alarm_type = { - { &mp_type_type }, - .name = MP_QSTR_ioAlarm, -}; diff --git a/shared-bindings/io_alarm/__init__.h b/shared-bindings/io_alarm/__init__.h deleted file mode 100644 index 2b91f781d5..0000000000 --- a/shared-bindings/io_alarm/__init__.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_IO_ALARM___INIT___H -#define MICROPY_INCLUDED_SHARED_BINDINGS_IO_ALARM___INIT___H - -#include "py/runtime.h" - -typedef struct { - mp_obj_base_t base; - uint8_t gpio, level; - bool pull; -} io_alarm_obj_t; - -extern const mp_obj_type_t io_alarm_type; - -extern mp_obj_t common_hal_io_alarm_pin_state (io_alarm_obj_t *self_in); -extern void common_hal_io_alarm_disable (void); - -#endif //MICROPY_INCLUDED_SHARED_BINDINGS_IO_ALARM___INIT___H diff --git a/shared-bindings/microcontroller/__init__.h b/shared-bindings/microcontroller/__init__.h index f0a3cee2df..cd234fb033 100644 --- a/shared-bindings/microcontroller/__init__.h +++ b/shared-bindings/microcontroller/__init__.h @@ -35,8 +35,8 @@ #include "shared-bindings/microcontroller/RunMode.h" -#include "shared-bindings/io_alarm/__init__.h" -#include "shared-bindings/time_alarm/__init__.h" +#include "shared-bindings/alarm_io/__init__.h" +#include "shared-bindings/alarm_time/__init__.h" extern void common_hal_mcu_delay_us(uint32_t); diff --git a/shared-bindings/time_alarm/__init__.c b/shared-bindings/time_alarm/__init__.c deleted file mode 100644 index e45c5239f1..0000000000 --- a/shared-bindings/time_alarm/__init__.c +++ /dev/null @@ -1,50 +0,0 @@ -#include "py/obj.h" -#include "shared-bindings/time_alarm/__init__.h" - -//| Set Timer Wakeup -//| -STATIC mp_obj_t time_alarm_duration(mp_obj_t seconds_o) { - #if MICROPY_PY_BUILTINS_FLOAT - mp_float_t seconds = mp_obj_get_float(seconds_o); - mp_float_t msecs = 1000.0f * seconds + 0.5f; - #else - mp_int_t seconds = mp_obj_get_int(seconds_o); - mp_int_t msecs = 1000 * seconds; - #endif - - if (seconds < 0) { - mp_raise_ValueError(translate("sleep length must be non-negative")); - } - common_hal_time_alarm_duration(msecs); - - time_alarm_obj_t *self = m_new_obj(time_alarm_obj_t); - self->base.type = &time_alarm_type; - - return self; -} -STATIC MP_DEFINE_CONST_FUN_OBJ_1(time_alarm_duration_obj, time_alarm_duration); - -//| Disable Timer Wakeup -//| -STATIC mp_obj_t time_alarm_disable(void) { - common_hal_time_alarm_disable(); - return mp_const_none; -} -STATIC MP_DEFINE_CONST_FUN_OBJ_0(time_alarm_disable_obj, time_alarm_disable); - -STATIC const mp_rom_map_elem_t time_alarm_module_globals_table[] = { - { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_time_alarm) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_Duration), MP_ROM_PTR(&time_alarm_duration_obj) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_Disable), MP_ROM_PTR(&time_alarm_disable_obj) }, -}; -STATIC MP_DEFINE_CONST_DICT(time_alarm_module_globals, time_alarm_module_globals_table); - -const mp_obj_module_t time_alarm_module = { - .base = { &mp_type_module }, - .globals = (mp_obj_dict_t*)&time_alarm_module_globals, -}; - -const mp_obj_type_t time_alarm_type = { - { &mp_type_type }, - .name = MP_QSTR_timeAlarm, -}; diff --git a/shared-bindings/time_alarm/__init__.h b/shared-bindings/time_alarm/__init__.h deleted file mode 100644 index 52b6e89ee2..0000000000 --- a/shared-bindings/time_alarm/__init__.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_TIME_ALARM___INIT___H -#define MICROPY_INCLUDED_SHARED_BINDINGS_TIME_ALARM___INIT___H - -#include "py/runtime.h" - -typedef struct { - mp_obj_base_t base; -} time_alarm_obj_t; - -extern const mp_obj_type_t time_alarm_type; - -extern void common_hal_time_alarm_duration(uint32_t); -extern void common_hal_time_alarm_disable (void); - -#endif //MICROPY_INCLUDED_SHARED_BINDINGS_TIME_ALARM___INIT___H