Skip to content

Commit 523ec02

Browse files
committed
codal_port/modmicrobit: Put audio module as entry in microbit module.
On micro:bit v2 the audio functionality is "built in", similar to the display functionality. And now the following is possible and nicely consistent: from microbit import * display.show(Image.HAPPY) audio.play(Sound.HAPPY) The "music" and "speech" modules are separate modules because they provide functionality on top of the base audio functionality.
1 parent 4971558 commit 523ec02

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/codal_port/modmicrobit.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,8 @@ STATIC const mp_rom_map_elem_t microbit_module_globals_table[] = {
104104
{ MP_ROM_QSTR(MP_QSTR_accelerometer), MP_ROM_PTR(&microbit_accelerometer_obj) },
105105
{ MP_ROM_QSTR(MP_QSTR_compass), MP_ROM_PTR(&microbit_compass_obj) },
106106
{ MP_ROM_QSTR(MP_QSTR_microphone), MP_ROM_PTR(&microbit_microphone_obj) },
107+
{ MP_ROM_QSTR(MP_QSTR_audio), MP_ROM_PTR(&audio_module) },
108+
107109
{ MP_ROM_QSTR(MP_QSTR_i2c), MP_ROM_PTR(&microbit_i2c_obj) },
108110
{ MP_ROM_QSTR(MP_QSTR_uart), MP_ROM_PTR(&microbit_uart_obj) },
109111
{ MP_ROM_QSTR(MP_QSTR_spi), MP_ROM_PTR(&microbit_spi_obj) },

0 commit comments

Comments
 (0)