From 66b96822fb33863fde5ce13a6bdeb99a404575dc Mon Sep 17 00:00:00 2001 From: Damien George Date: Fri, 4 Dec 2015 14:07:15 +0000 Subject: 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. --- stmhal/main.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'stmhal/main.c') 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(); -- cgit v1.2.3