diff options
| author | Dave Hylands <dhylands@gmail.com> | 2014-08-23 12:21:12 -0700 |
|---|---|---|
| committer | Damien George <damien.p.george@gmail.com> | 2014-08-25 17:38:55 +0100 |
| commit | 2bf044442eae7dbdaff91051d2c135b4aa51f1b2 (patch) | |
| tree | f22d657138d316cc1e3b1669d001c90d14809741 /stmhal/stm32f4xx_it.c | |
| parent | 8c0add4eeeb77b8b4c6cb5a0313e6f06b0a62d32 (diff) | |
Add support for pyb.micros() by using the systick timer.
I also removed trailing spaces from modpyb.c which affected a couple
of lines technically not part of this patch.
Tested using: https://github.com/dhylands/upy-examples/blob/master/micros_test.py
which eventually fails due to wraparound issues (I could fix the test to compensate
but didn't bother)
Diffstat (limited to 'stmhal/stm32f4xx_it.c')
| -rw-r--r-- | stmhal/stm32f4xx_it.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/stmhal/stm32f4xx_it.c b/stmhal/stm32f4xx_it.c index 5fa7f8289..4bd13c05c 100644 --- a/stmhal/stm32f4xx_it.c +++ b/stmhal/stm32f4xx_it.c @@ -174,6 +174,11 @@ void PendSV_Handler(void) { */ void SysTick_Handler(void) { HAL_IncTick(); + + // Read the systick control regster. This has the side effect of clearing + // the COUNTFLAG bit, which makes the logic in sys_tick_get_microseconds + // work properly. + SysTick->CTRL; } /******************************************************************************/ |
