[python/modion] Use constants to identify keys

This commit is contained in:
Romain Goyet
2019-11-15 13:56:34 +01:00
committed by LeaNumworks
parent 9d66b23848
commit 7607c4cba4
4 changed files with 124 additions and 16 deletions

View File

@@ -9,5 +9,5 @@ extern "C" {
mp_obj_t modion_keyboard_keydown(mp_obj_t key_o) {
Ion::Keyboard::Key key = static_cast<Ion::Keyboard::Key>(mp_obj_get_int(key_o));
Ion::Keyboard::State state = Ion::Keyboard::scan();
return MP_OBJ_NEW_SMALL_INT(state.keyDown(key));
return mp_obj_new_bool(state.keyDown(key));
}