summaryrefslogtreecommitdiff
path: root/stmhal/main.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2014-04-21 18:23:50 +0100
committerDamien George <damien.p.george@gmail.com>2014-04-21 18:23:50 +0100
commit6125ba4a7f9d757abd89f85745f458e52e2ef6fb (patch)
treeec19b9cef0fc8c4630f54816cc9466cb5c8e4cd6 /stmhal/main.c
parentaf797f476fe03b7c1f6c645f0e43df5ca3254bc3 (diff)
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/main.c')
-rw-r--r--stmhal/main.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/stmhal/main.c b/stmhal/main.c
index bb2a1d88a..861e584d1 100644
--- a/stmhal/main.c
+++ b/stmhal/main.c
@@ -205,7 +205,9 @@ int main(void) {
pendsv_init();
timer_tim3_init();
led_init();
+#if MICROPY_HW_HAS_SWITCH
switch_init0();
+#endif
int first_soft_reset = true;
@@ -297,11 +299,6 @@ soft_reset:
pin_init();
extint_init();
-#if MICROPY_HW_HAS_SWITCH
- // must come after extint_init
- switch_init();
-#endif
-
#if MICROPY_HW_HAS_LCD
// LCD init (just creates class, init hardware by calling LCD())
lcd_init();