From 3a2757b3902debc3ecbbc344ab6ec4850425f953 Mon Sep 17 00:00:00 2001 From: polymurph Date: Sat, 11 Mar 2023 11:35:12 +0100 Subject: [PATCH] added makro timer int flag handling makro. NEEDS TO BE TESTED!!! --- csl/stm32f042k6t6/implementation/imp_timer.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/csl/stm32f042k6t6/implementation/imp_timer.c b/csl/stm32f042k6t6/implementation/imp_timer.c index d60cf10..3468b27 100644 --- a/csl/stm32f042k6t6/implementation/imp_timer.c +++ b/csl/stm32f042k6t6/implementation/imp_timer.c @@ -3,13 +3,11 @@ #define BASE ((TIM_TypeDef *)timerBase_Addr_List[timer]) -#define HANDLE_INT_FLAG(flagReg, flagMask, intType)( \ - do {\ - if ((flagReg) & (flagMask)) {\ +#define HANDLE_INT_FLAG(flagReg, flagMask, intType)\ + do {if ((flagReg) & (flagMask)) {\ (flagReg) &= ~(flagMask);\ - ((intHandler_t)(intHandlerList[(intType)]))();)\ - }\ - } while (0) + ((intHandler_t)(intHandlerList[(intType)]))();\ + }} while (0) void timerReset(timerNo_t timer) { @@ -260,11 +258,13 @@ void timerThrowError(timerError_t error) void TIM1_BRK_UP_TRG_COM_IRQHandler() { + HANDLE_INT_FLAG(TIM1->SR,TIM_SR_BIF,TIM1_BREAK); + /* if(TIM1->SR & TIM_SR_BIF) { TIM1->SR &= ~TIM_SR_BIF; ((intHandler_t)(intHandlerList[TIM1_BREAK]))(); } - +*/ if(TIM1->SR & TIM_SR_UIF) { TIM1->SR &= ~TIM_SR_UIF; ((intHandler_t)(intHandlerList[TIM1_UPDATE]))();