nrf5/main: Move initializaton of modmusic to the module itself. Upon init of the module, the hardware, pwm and ticker will be started. Could be moved back to main if pwm or ticker should be shared among more modules and have to be initialized more global.

This commit is contained in:
Glenn Ruben Bakke 2017-05-24 23:38:33 +02:00 committed by glennrub
parent d9813910da
commit aba5fcbf0f
2 changed files with 2 additions and 8 deletions

View File

@ -123,14 +123,6 @@ int main(int argc, char **argv) {
timer_init0();
#endif
#if MICROPY_PY_MUSIC
microbit_music_init0();
#endif
/*
extint_init0();
timer_init0();
*/
uart_init0();
#if (MICROPY_PY_BLE_NUS == 0)

View File

@ -451,6 +451,8 @@ MP_DEFINE_CONST_FUN_OBJ_KW(microbit_music_set_tempo_obj, 0, microbit_music_set_t
static mp_obj_t music_init(void) {
microbit_music_init0();
music_data = m_new_obj(music_data_t);
music_data->bpm = DEFAULT_BPM;
music_data->ticks = DEFAULT_TICKS;