Skip to content
Snippets Groups Projects
Verified Commit 0d8be9c3 authored by rahix's avatar rahix
Browse files

feat(pycardium): Add RTC_ALARM interrupt number


Signed-off-by: default avatarRahix <rahix@rahix.de>
parent b4246ffd
No related branches found
No related tags found
No related merge requests found
......@@ -65,3 +65,22 @@ alarm.
utime.alarm(alarm, minute_timer)
minute_timer(None)
Alternatively, you can register a callback using the interrupt module and
then call :py:func:`utime.alarm` without a ``callback`` parameter:
.. code-block:: python
import interrupt, utime
def 5_second_timer(x):
current = utime.time()
print("Current: " + str(current))
alarm = (current // 10) * 10 + 5
utime.alarm(alarm)
# This time, we need to register and enable the callback manually
interrupt.set_callback(interrupt.RTC_ALARM, 5_second_timer)
interrupt.enable_callback(interrupt.RTC_ALARM)
5_second_timer(None)
......@@ -81,7 +81,12 @@ static const mp_rom_map_elem_t interrupt_module_globals_table[] = {
MP_ROM_PTR(&interrupt_enable_callback_obj) },
{ MP_ROM_QSTR(MP_QSTR_disable_callback),
MP_ROM_PTR(&interrupt_disable_callback_obj) },
{ MP_ROM_QSTR(MP_QSTR_BHI160), MP_OBJ_NEW_SMALL_INT(2) },
/* Interrupt Numbers */
{ MP_ROM_QSTR(MP_QSTR_BHI160),
MP_OBJ_NEW_SMALL_INT(EPIC_INT_BHI160_TEST) },
{ MP_ROM_QSTR(MP_QSTR_RTC_ALARM),
MP_OBJ_NEW_SMALL_INT(EPIC_INT_RTC_ALARM) },
};
static MP_DEFINE_CONST_DICT(
interrupt_module_globals, interrupt_module_globals_table
......
......@@ -34,6 +34,7 @@ Q(set_callback)
Q(enable_callback)
Q(disable_callback)
Q(BHI160)
Q(RTC_ALARM)
/* display */
Q(sys_display)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment