Skip to content

Commit 0ac37da

Browse files
dtjones-atsemvertescher
authored andcommitted
added method to clear timer interrupts
1 parent 980b2e4 commit 0ac37da

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/timer.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,19 @@ macro_rules! hal {
100100
}
101101
}
102102

103+
/// Clears interrupt associated with `event`.
104+
///
105+
/// If the interrupt is not cleared, it will immediately retrigger after
106+
/// the ISR has finished.
107+
pub fn clear_interrupt(&mut self, event: Event) {
108+
match event {
109+
Event::TimeOut => {
110+
// Clear interrupt flag
111+
self.tim.sr.write(|w| w.uif().clear_bit());
112+
}
113+
}
114+
}
115+
103116
/// Stops listening for an `event`
104117
pub fn unlisten(&mut self, event: Event) {
105118
match event {

0 commit comments

Comments
 (0)