diff options
author | Damien George <damien.p.george@gmail.com> | 2014-04-21 18:23:50 +0100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2014-04-21 18:23:50 +0100 |
commit | 6125ba4a7f9d757abd89f85745f458e52e2ef6fb (patch) | |
tree | ec19b9cef0fc8c4630f54816cc9466cb5c8e4cd6 /stmhal/modpyb.c | |
parent | af797f476fe03b7c1f6c645f0e43df5ca3254bc3 (diff) | |
download | micropython-6125ba4a7f9d757abd89f85745f458e52e2ef6fb.tar.gz micropython-6125ba4a7f9d757abd89f85745f458e52e2ef6fb.zip |
stmhal: Make switch a class, to follow suit of all other modules.
Instead of pyb.switch() as a function, it's more consistent (with
respect to all the other modules and peripherals) to have
pyb.Switch() create a switch object. This then generalises to having
multiple switches. Call the object to get its state. Use sw.callback
to set the callback function for when the switch is pressed.
Diffstat (limited to 'stmhal/modpyb.c')
-rw-r--r-- | stmhal/modpyb.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/stmhal/modpyb.c b/stmhal/modpyb.c index 7bd7d5f994..7aec712510 100644 --- a/stmhal/modpyb.c +++ b/stmhal/modpyb.c @@ -295,7 +295,7 @@ STATIC const mp_map_elem_t pyb_module_globals_table[] = { #endif #if MICROPY_HW_HAS_SWITCH - { MP_OBJ_NEW_QSTR(MP_QSTR_switch), (mp_obj_t)&pyb_switch_obj }, + { MP_OBJ_NEW_QSTR(MP_QSTR_Switch), (mp_obj_t)&pyb_switch_type }, #endif #if MICROPY_HW_HAS_SDCARD |