Skip to content

Commit 2616034

Browse files
committed
codal_port/microbit_soundeffect: Add WAVE,FX,INTER constants.
Signed-off-by: Damien George <[email protected]>
1 parent 650d960 commit 2616034

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

src/codal_port/microbit_soundeffect.c

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,28 @@ STATIC void microbit_soundeffect_attr(mp_obj_t self_in, qstr attr, mp_obj_t *des
282282
}
283283
}
284284

285+
// Note: these locals are only accessible as SoundEffect.xxx, because
286+
// microbit_soundeffect_attr handles attribute lookups on instances.
285287
STATIC const mp_rom_map_elem_t microbit_soundeffect_locals_dict_table[] = {
288+
// Class constants.
289+
#define C(NAME) { MP_ROM_QSTR(MP_QSTR_ ## NAME), MP_ROM_INT(SOUND_EFFECT_ ## NAME) }
290+
291+
C(WAVE_SINE),
292+
C(WAVE_SAWTOOTH),
293+
C(WAVE_TRIANGLE),
294+
C(WAVE_SQUARE),
295+
C(WAVE_NOISE),
296+
297+
C(INTER_LINEAR),
298+
C(INTER_CURVE),
299+
C(INTER_LOG),
300+
301+
C(FX_NONE),
302+
C(FX_TREMOLO),
303+
C(FX_VIBRATO),
304+
C(FX_WARBLE),
305+
306+
#undef C
286307
};
287308
STATIC MP_DEFINE_CONST_DICT(microbit_soundeffect_locals_dict, microbit_soundeffect_locals_dict_table);
288309

0 commit comments

Comments
 (0)