diff options
author | Damien George <damien.p.george@gmail.com> | 2015-12-04 14:07:15 +0000 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2015-12-04 14:07:15 +0000 |
commit | 66b96822fb33863fde5ce13a6bdeb99a404575dc (patch) | |
tree | 3bd14e12de97527afd9f362bdd9aaef0a1f2ec2c /stmhal/main.c | |
parent | 9aaf888b420101fd01c9455f20fda7a09ce8d93d (diff) |
stmhal: Add option to free up TIM3 from USB VCP polling.
This is a hack to free up TIM3 so that it can be used by the user.
Instead we use the PVD irq to call the USB VCP polling function, and
trigger it from SysTick (so SysTick itself does not do any processing).
The feature is enabled for pyboard lite only, since it lacks timers.
Diffstat (limited to 'stmhal/main.c')
-rw-r--r-- | stmhal/main.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/stmhal/main.c b/stmhal/main.c index 3a15f6158..2eb5a5338 100644 --- a/stmhal/main.c +++ b/stmhal/main.c @@ -393,7 +393,12 @@ int main(void) { // basic sub-system init pendsv_init(); + #if defined(MICROPY_HW_USE_ALT_IRQ_FOR_CDC) + HAL_NVIC_SetPriority(PVD_IRQn, 6, 0); // same priority as USB + HAL_NVIC_EnableIRQ(PVD_IRQn); + #else timer_tim3_init(); + #endif led_init(); #if MICROPY_HW_HAS_SWITCH switch_init0(); |