diff options
| author | chemicstry <[email protected]> | 2022-03-30 00:27:33 +0300 |
|---|---|---|
| committer | chemicstry <[email protected]> | 2022-03-30 00:27:33 +0300 |
| commit | d052631118d8cc998696cf353a5ae7f5b28bbd69 (patch) | |
| tree | fad539aedf92daa624f5b9834e2515058a98dc0f | |
| parent | 1a31cda3c37c1e82e592566d683091180d1c3a08 (diff) | |
Fix STM32 timer interrupt bug
| -rw-r--r-- | embassy-stm32/src/time_driver.rs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/embassy-stm32/src/time_driver.rs b/embassy-stm32/src/time_driver.rs index 5b3efca72..d936a11a2 100644 --- a/embassy-stm32/src/time_driver.rs +++ b/embassy-stm32/src/time_driver.rs | |||
| @@ -172,8 +172,11 @@ impl RtcDriver { | |||
| 172 | // Mid-way point | 172 | // Mid-way point |
| 173 | r.ccr(0).write(|w| w.set_ccr(0x8000)); | 173 | r.ccr(0).write(|w| w.set_ccr(0x8000)); |
| 174 | 174 | ||
| 175 | // Enable CC0, disable others | 175 | // Enable overflow and half-overflow interrupts |
| 176 | r.dier().write(|w| w.set_ccie(0, true)); | 176 | r.dier().write(|w| { |
| 177 | w.set_uie(true); | ||
| 178 | w.set_ccie(0, true); | ||
| 179 | }); | ||
| 177 | 180 | ||
| 178 | let irq: <T as BasicInstance>::Interrupt = core::mem::transmute(()); | 181 | let irq: <T as BasicInstance>::Interrupt = core::mem::transmute(()); |
| 179 | irq.unpend(); | 182 | irq.unpend(); |
| @@ -197,6 +200,7 @@ impl RtcDriver { | |||
| 197 | // miss interrupts. | 200 | // miss interrupts. |
| 198 | r.sr().write_value(regs::SrGp(!sr.0)); | 201 | r.sr().write_value(regs::SrGp(!sr.0)); |
| 199 | 202 | ||
| 203 | // Overflow | ||
| 200 | if sr.uif() { | 204 | if sr.uif() { |
| 201 | self.next_period(); | 205 | self.next_period(); |
| 202 | } | 206 | } |
