Skip to content

Commit

Permalink
Fixes to timer clear
Browse files Browse the repository at this point in the history
  • Loading branch information
David O'Connor committed May 22, 2024
1 parent 1e86790 commit caa4c2f
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions src/timer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2059,31 +2059,29 @@ pub fn clear_update_interrupt(tim_num: u8) {

// todo: This is likely to fail on some variants, and it's missing a number of timer periphs.

let bits = 0xffff_ffff;

match tim_num {
1 => periphs
.TIM1
.sr
.write(|w| w.bits(0xffff_ffff).uif().clear_bit()),
.write(|w| w.bits(bits).uif().clear_bit()),
2 => periphs
.TIM2
.sr
.write(|w| w.bits(0xffff_ffff).uif().clear_bit()),
.write(|w| w.bits(bits).uif().clear_bit()),
3 => periphs
.TIM3
.sr
.write(|w| w.bits(0xffff_ffff).uif().clear_bit()),
6 => periphs
.TIM6
.sr
.write(|w| w.bits(0xffff_ffff).uif().clear_bit()),
7 => periphs
.TIM7
.write(|w| w.bits(bits).uif().clear_bit()),
4 => periphs
.TIM4
.sr
.write(|w| w.bits(0xffff_ffff).uif().clear_bit()),
.write(|w| w.bits(bits).uif().clear_bit()),
8 => periphs
.TIM8
.sr
.write(|w| w.bits(0xffff_ffff).uif().clear_bit()),
.write(|w| w.bits(bits).uif().clear_bit()),
_ => unimplemented!(),
}
};
Expand Down

0 comments on commit caa4c2f

Please sign in to comment.