Skip to content

Commit d60c75b

Browse files
committed
codal_port/microbit_pinaudio: Disallow pin_speaker for audio pin select.
Audio/music/speech is output on the internal speaker by default, and can be turned off via speaker.off(). Signed-off-by: Damien George <damien@micropython.org>
1 parent 7c8e3e8 commit d60c75b

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/codal_port/microbit_pinaudio.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ void microbit_pin_audio_select(mp_const_obj_t select) {
3535
const microbit_pin_obj_t *pin_selected;
3636
if (select == mp_const_none) {
3737
pin_selected = NULL;
38+
} else if (select == MP_OBJ_FROM_PTR(&microbit_pin_speaker_obj)) {
39+
mp_raise_ValueError("pin_speaker not allowed");
3840
} else {
3941
pin_selected = microbit_obj_get_pin((mp_obj_t)select);
4042
}

0 commit comments

Comments
 (0)