Skip to content

Commit

Permalink
Merge pull request #554 from jorisvr/fix_timer
Browse files Browse the repository at this point in the history
Fix clearing of TIMx_SR register
  • Loading branch information
rogerclarkmelbourne authored Jun 14, 2019
2 parents 7b3d634 + 73e268d commit 2e1d0f6
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions STM32F1/system/libmaple/timer_private.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ static inline __always_inline void dispatch_single_irq(timer_dev *dev,
void (*handler)(void) = dev->handlers[iid];
if (handler) {
handler();
regs->SR &= ~irq_mask;
regs->SR = ~irq_mask;
}
}
}
Expand Down Expand Up @@ -165,7 +165,7 @@ static inline __always_inline void dispatch_adv_trg_com(timer_dev *dev) {
handle_irq(dsr, TIMER_SR_TIF, hs, TIMER_TRG_INTERRUPT, handled);
handle_irq(dsr, TIMER_SR_COMIF, hs, TIMER_COM_INTERRUPT, handled);

regs->SR &= ~handled;
regs->SR = ~handled;
}

static inline __always_inline void dispatch_adv_cc(timer_dev *dev) {
Expand All @@ -179,7 +179,7 @@ static inline __always_inline void dispatch_adv_cc(timer_dev *dev) {
handle_irq(dsr, TIMER_SR_CC2IF, hs, TIMER_CC2_INTERRUPT, handled);
handle_irq(dsr, TIMER_SR_CC1IF, hs, TIMER_CC1_INTERRUPT, handled);

regs->SR &= ~handled;
regs->SR = ~handled;
}

static inline __always_inline void dispatch_general(timer_dev *dev) {
Expand All @@ -195,7 +195,7 @@ static inline __always_inline void dispatch_general(timer_dev *dev) {
handle_irq(dsr, TIMER_SR_CC1IF, hs, TIMER_CC1_INTERRUPT, handled);
handle_irq(dsr, TIMER_SR_UIF, hs, TIMER_UPDATE_INTERRUPT, handled);

regs->SR &= ~handled;
regs->SR = ~handled;
}

/* On F1 (XL-density), F2, and F4, TIM9 and TIM12 are restricted
Expand All @@ -211,7 +211,7 @@ static inline __always_inline void dispatch_tim_9_12(timer_dev *dev) {
handle_irq(dsr, TIMER_SR_CC1IF, hs, TIMER_CC1_INTERRUPT, handled);
handle_irq(dsr, TIMER_SR_UIF, hs, TIMER_UPDATE_INTERRUPT, handled);

regs->SR &= ~handled;
regs->SR = ~handled;
}

/* On F1 (XL-density), F2, and F4, timers 10, 11, 13, and 14 are
Expand All @@ -225,7 +225,7 @@ static inline __always_inline void dispatch_tim_10_11_13_14(timer_dev *dev) {
handle_irq(dsr, TIMER_SR_CC1IF, hs, TIMER_CC1_INTERRUPT, handled);
handle_irq(dsr, TIMER_SR_UIF, hs, TIMER_UPDATE_INTERRUPT, handled);

regs->SR &= ~handled;
regs->SR = ~handled;
}

static inline __always_inline void dispatch_basic(timer_dev *dev) {
Expand Down

0 comments on commit 2e1d0f6

Please sign in to comment.