diff options
| author | Glenn Ruben Bakke | 2017-11-25 01:03:41 +0100 |
|---|---|---|
| committer | Damien George | 2018-07-18 17:12:25 +1000 |
| commit | 789f8f1c4be6b5f5a3b6194e85664e83fa20e7fe (patch) | |
| tree | 37201eb7e6790b30fe650b75d5df98eda908664a | |
| parent | 91fcde73d2beb2318587499f352afd5ac65bdde9 (diff) | |
nrf/boards/microbit: Update to work with new ticker code.
- Rename microbit_module_init to board_module_init0 which is the generic
board module init function.
- Add low priority callback registration of display tick handler in the
module init function.
| -rw-r--r-- | ports/nrf/boards/microbit/modules/modmicrobit.c | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/ports/nrf/boards/microbit/modules/modmicrobit.c b/ports/nrf/boards/microbit/modules/modmicrobit.c index 0df999f9b..df782f4a2 100644 --- a/ports/nrf/boards/microbit/modules/modmicrobit.c +++ b/ports/nrf/boards/microbit/modules/modmicrobit.c @@ -27,6 +27,7 @@ #include "py/nlr.h" #include "py/obj.h" #include "py/mphal.h" +#include "modmicrobit.h" #include "microbitdisplay.h" #include "microbitimage.h" #include "softpwm.h" @@ -108,18 +109,11 @@ STATIC mp_obj_t microbit_temperature(void) { } MP_DEFINE_CONST_FUN_OBJ_0(microbit_temperature_obj, microbit_temperature); -static mp_obj_t microbit_module_init(void) { - softpwm_init(); - ticker_init(microbit_display_tick); - ticker_start(); - pwm_start(); - return mp_const_none; +void board_modules_init0(void) { + ticker_register_low_pri_callback(microbit_display_tick); } -MP_DEFINE_CONST_FUN_OBJ_0(microbit_module___init___obj, microbit_module_init); STATIC const mp_rom_map_elem_t microbit_module_globals_table[] = { - { MP_ROM_QSTR(MP_QSTR___init__), MP_ROM_PTR(µbit_module___init___obj) }, - { MP_ROM_QSTR(MP_QSTR_Image), MP_ROM_PTR(µbit_image_type) }, { MP_ROM_QSTR(MP_QSTR_display), MP_ROM_PTR(µbit_display_obj) }, |
