diff options
author | 2023-12-06 08:49:38 +0100 | |
---|---|---|
committer | 2023-12-06 07:49:38 +0000 | |
commit | 89160b7cb9b3623e0a50f6745296d470fa7ea79d (patch) | |
tree | 1409920c1fe8dec4857cd1e73f2f02485229fcad /rtic-monotonics/src/stm32.rs | |
parent | 1622f6b953c93c3a680769636b60733f281f1ac0 (diff) | |
download | rtic-89160b7cb9b3623e0a50f6745296d470fa7ea79d.tar.gz rtic-89160b7cb9b3623e0a50f6745296d470fa7ea79d.tar.zst rtic-89160b7cb9b3623e0a50f6745296d470fa7ea79d.zip |
Fix nrf monotonics (#852)
* Fix nrf::timer
* Bootstrap nrf52840-blinky example
* More work on nrf blinky example
* Fix README
* Add asserts for correct timer functionality
* Add correctness check to other monotonics as well
* Update Changelog
* Fix potential timing issues
* Fix race condition in nrf::rtc
* Add changelog
* Add rtc blinky example
* Change rtc example to RC lf clock source
* Add changelog to rtic-time
* Add changelog
* Attempt to fix CI
* Update teensy4-blinky Cargo.lock
Diffstat (limited to 'rtic-monotonics/src/stm32.rs')
-rw-r--r-- | rtic-monotonics/src/stm32.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/rtic-monotonics/src/stm32.rs b/rtic-monotonics/src/stm32.rs index c86005ef..601196a3 100644 --- a/rtic-monotonics/src/stm32.rs +++ b/rtic-monotonics/src/stm32.rs @@ -272,12 +272,14 @@ macro_rules! make_timer { // Full period if $timer.sr().read().uif() { $timer.sr().modify(|r| r.set_uif(false)); - $overflow.fetch_add(1, Ordering::Relaxed); + let prev = $overflow.fetch_add(1, Ordering::Relaxed); + assert!(prev % 2 == 1, "Monotonic must have missed an interrupt!"); } // Half period if $timer.sr().read().ccif(2) { $timer.sr().modify(|r| r.set_ccif(2, false)); - $overflow.fetch_add(1, Ordering::Relaxed); + let prev = $overflow.fetch_add(1, Ordering::Relaxed); + assert!(prev % 2 == 0, "Monotonic must have missed an interrupt!"); } } } |