Skip to content

Commit 15b467c

Browse files
committed
codal_port/modaudio: Ignore return_pin argument to audio.play().
On v2 this should be ignored, as per the docs. Fixes issue #181. Signed-off-by: Damien George <damien@micropython.org>
1 parent c143b24 commit 15b467c

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

src/codal_port/modaudio.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,7 @@ STATIC mp_obj_t stop(void) {
212212
MP_DEFINE_CONST_FUN_OBJ_0(microbit_audio_stop_obj, stop);
213213

214214
STATIC mp_obj_t play(mp_uint_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
215+
// Note: the return_pin argument is for compatibility with micro:bit v1 and is ignored on v2.
215216
static const mp_arg_t allowed_args[] = {
216217
{ MP_QSTR_source, MP_ARG_REQUIRED | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} },
217218
{ MP_QSTR_wait, MP_ARG_BOOL, {.u_bool = true} },
@@ -222,11 +223,6 @@ STATIC mp_obj_t play(mp_uint_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_ar
222223
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
223224
mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
224225

225-
// The return_pin argument from micro:bit v1 is no longer supported.
226-
if (args[3].u_obj != mp_const_none) {
227-
mp_raise_ValueError(MP_ERROR_TEXT("return_pin not supported"));
228-
}
229-
230226
mp_obj_t src = args[0].u_obj;
231227
microbit_audio_play_source(src, args[2].u_obj, args[1].u_bool, DEFAULT_SAMPLE_RATE);
232228
return mp_const_none;

0 commit comments

Comments
 (0)