From 789f8f1c4be6b5f5a3b6194e85664e83fa20e7fe Mon Sep 17 00:00:00 2001 From: Glenn Ruben Bakke Date: Sat, 25 Nov 2017 01:03:41 +0100 Subject: [PATCH] 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. --- ports/nrf/boards/microbit/modules/modmicrobit.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/ports/nrf/boards/microbit/modules/modmicrobit.c b/ports/nrf/boards/microbit/modules/modmicrobit.c index 0df999f9b2..df782f4a2b 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) },