diff options
Diffstat (limited to 'stmhal/pybmodule.c')
-rw-r--r-- | stmhal/pybmodule.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/stmhal/pybmodule.c b/stmhal/pybmodule.c index 09cdf83b8a..7727329849 100644 --- a/stmhal/pybmodule.c +++ b/stmhal/pybmodule.c @@ -196,12 +196,20 @@ STATIC mp_obj_t pyb_hid_send_report(mp_obj_t arg) { return mp_const_none; } -MP_DEFINE_CONST_FUN_OBJ_1(pyb_hid_send_report_obj, pyb_hid_send_report); +STATIC MP_DEFINE_CONST_FUN_OBJ_1(pyb_hid_send_report_obj, pyb_hid_send_report); #if 0 MP_DEFINE_CONST_FUN_OBJ_2(pyb_I2C_obj, pyb_I2C); // TODO put this in i2c.c #endif +extern int stdin_rx_chr(void); + +STATIC mp_obj_t pyb_input(void ) { + return mp_obj_new_int(stdin_rx_chr()); +} + +STATIC MP_DEFINE_CONST_FUN_OBJ_0(pyb_input_obj, pyb_input); + MP_DECLARE_CONST_FUN_OBJ(pyb_source_dir_obj); // defined in main.c MP_DECLARE_CONST_FUN_OBJ(pyb_main_obj); // defined in main.c @@ -268,6 +276,9 @@ STATIC const mp_map_elem_t pyb_module_globals_table[] = { #endif #endif + // input + { MP_OBJ_NEW_QSTR(MP_QSTR_input), (mp_obj_t)&pyb_input_obj }, + // pin mapper { MP_OBJ_NEW_QSTR(MP_QSTR_Pin), (mp_obj_t)&pin_map_obj }, |