summaryrefslogtreecommitdiff
path: root/shared-bindings/microcontroller/__init__.c
diff options
context:
space:
mode:
Diffstat (limited to 'shared-bindings/microcontroller/__init__.c')
-rw-r--r--shared-bindings/microcontroller/__init__.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/shared-bindings/microcontroller/__init__.c b/shared-bindings/microcontroller/__init__.c
index b8ca8f18b..7b896d99b 100644
--- a/shared-bindings/microcontroller/__init__.c
+++ b/shared-bindings/microcontroller/__init__.c
@@ -152,6 +152,24 @@ STATIC mp_obj_t mcu_sleep(void) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_0(mcu_sleep_obj, mcu_sleep);
+//| def getWakeAlarm() -> None:
+//| """This returns the alarm that triggered wakeup,
+//| also returns alarm specific parameters`.
+//|
+STATIC mp_obj_t mcu_get_wake_alarm(void) {
+ return common_hal_mcu_get_wake_alarm();
+}
+STATIC MP_DEFINE_CONST_FUN_OBJ_0(mcu_get_wake_alarm_obj, mcu_get_wake_alarm);
+
+//| def getSleepTime() -> None:
+//| """This returns the period of time in ms,
+//| in which the board was in deep sleep`.
+//|
+STATIC mp_obj_t mcu_get_sleep_time(void) {
+ return mp_obj_new_int(common_hal_mcu_get_sleep_time());
+}
+STATIC MP_DEFINE_CONST_FUN_OBJ_0(mcu_get_sleep_time_obj, mcu_get_sleep_time);
+
//| nvm: Optional[ByteArray]
//| """Available non-volatile memory.
//| This object is the sole instance of `nvm.ByteArray` when available or ``None`` otherwise.
@@ -188,6 +206,8 @@ STATIC const mp_rom_map_elem_t mcu_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR_on_next_reset), MP_ROM_PTR(&mcu_on_next_reset_obj) },
{ MP_ROM_QSTR(MP_QSTR_reset), MP_ROM_PTR(&mcu_reset_obj) },
{ MP_ROM_QSTR(MP_QSTR_sleep), MP_ROM_PTR(&mcu_sleep_obj) },
+ { MP_ROM_QSTR(MP_QSTR_getSleepTime), MP_ROM_PTR(&mcu_get_sleep_time_obj) },
+ { MP_ROM_QSTR(MP_QSTR_getWakeAlarm), MP_ROM_PTR(&mcu_get_wake_alarm_obj) },
#if CIRCUITPY_INTERNAL_NVM_SIZE > 0
{ MP_ROM_QSTR(MP_QSTR_nvm), MP_ROM_PTR(&common_hal_mcu_nvm_obj) },
#else