aboutsummaryrefslogtreecommitdiffstats
path: root/src/stm32f1/timer.c
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2018-10-03 11:55:08 -0400
committerKevin O'Connor <kevin@koconnor.net>2018-10-11 10:50:51 -0400
commit1302514ea8723f05fc0a9ccdbc9cf45c4fa80f81 (patch)
tree3ae49decd9347cbaecd11f6ccb475a04dd18249a /src/stm32f1/timer.c
parentd32506bd2eb6c5231d83b063ad528a26f0dda563 (diff)
downloadkutter-1302514ea8723f05fc0a9ccdbc9cf45c4fa80f81.tar.gz
kutter-1302514ea8723f05fc0a9ccdbc9cf45c4fa80f81.tar.xz
kutter-1302514ea8723f05fc0a9ccdbc9cf45c4fa80f81.zip
stm32f1: Serial should have a higher irq priority than timers
It's possible for the code to stay in the timer irq for up to 100ms, so serial irqs should have a higher irq priority to prevent them from being starved. (The timer code disables irqs during event dispatch, so serial irqs would only be permitted between events anyway.) Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'src/stm32f1/timer.c')
-rw-r--r--src/stm32f1/timer.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/stm32f1/timer.c b/src/stm32f1/timer.c
index b0549136..e9b96b0a 100644
--- a/src/stm32f1/timer.c
+++ b/src/stm32f1/timer.c
@@ -8,7 +8,6 @@
#include "autoconf.h"
#include "board/misc.h" // timer_from_us
#include "stm32f1xx.h"
-#include "stm32f1xx.h"
#include "stm32f1xx_ll_bus.h"
#include "stm32f1xx_ll_tim.h"
#include "command.h" // shutdown
@@ -96,8 +95,8 @@ timer_init(void)
LL_TIM_SetAutoReload(TIM2, 0xFFFF);
LL_TIM_EnableIT_CC1(TIM2);
LL_TIM_CC_EnableChannel(TIM2, LL_TIM_CHANNEL_CH1);
+ NVIC_SetPriority(TIM2_IRQn, 2);
NVIC_EnableIRQ(TIM2_IRQn);
- NVIC_SetPriority(TIM2_IRQn, 0);
timer_kick();
timer_reset();
LL_TIM_EnableCounter(TIM2);