summaryrefslogtreecommitdiffstatshomepage
path: root/stmhal/main.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2014-04-21 16:48:16 +0100
committerDamien George <damien.p.george@gmail.com>2014-04-21 16:48:16 +0100
commit7fdfa93700e0f5a5381a57bca3c45865c720dc2f (patch)
treec8516645bc8544d8c48720deb2113ae7944b8cf3 /stmhal/main.c
parente5f8a77db6b7328b9583cbd0fe6ac73535fca1a0 (diff)
downloadmicropython-7fdfa93700e0f5a5381a57bca3c45865c720dc2f.tar.gz
micropython-7fdfa93700e0f5a5381a57bca3c45865c720dc2f.zip
stmhal: Add Timer class: simple TIM control, incl callback on IRQ.
Simple but functional timer control. More sophistication will eventually be added, or for now just use direct register access :) Also added pyb.freq() function to get MCU clock frequencies.
Diffstat (limited to 'stmhal/main.c')
-rw-r--r--stmhal/main.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/stmhal/main.c b/stmhal/main.c
index 42aaff4d0a..bb2a1d88a1 100644
--- a/stmhal/main.c
+++ b/stmhal/main.c
@@ -78,7 +78,8 @@ void __fatal_error(const char *msg) {
led_toggle(((i++) & 3) + 1);
for (volatile uint delay = 0; delay < 10000000; delay++) {
}
- if (i >= 8) {
+ if (i >= 16) {
+ // to conserve power
__WFI();
}
}
@@ -457,15 +458,12 @@ soft_reset:
}
#endif
+ timer_init0();
+
#if MICROPY_HW_ENABLE_RNG
rng_init0();
#endif
-#if MICROPY_HW_ENABLE_TIMER
- // timer
- //timer_init();
-#endif
-
i2c_init0();
spi_init0();