aboutsummaryrefslogtreecommitdiff
path: root/embassy-nrf
diff options
context:
space:
mode:
authorUlf Lilleengen <[email protected]>2025-01-02 12:53:55 +0100
committerUlf Lilleengen <[email protected]>2025-01-02 12:53:55 +0100
commit422938745a03ae36ffc058ff28011fe15dff2d00 (patch)
treef132fa84d83a1f86eb6e4841ba8c8ad985e29a45 /embassy-nrf
parent06901c3279430a40a449e5944e8ba3788388deb7 (diff)
Move safeguard if compare irq is enabled
Diffstat (limited to 'embassy-nrf')
-rw-r--r--embassy-nrf/src/time_driver.rs11
1 files changed, 6 insertions, 5 deletions
diff --git a/embassy-nrf/src/time_driver.rs b/embassy-nrf/src/time_driver.rs
index b8c19014e..61ae96718 100644
--- a/embassy-nrf/src/time_driver.rs
+++ b/embassy-nrf/src/time_driver.rs
@@ -244,15 +244,16 @@ impl RtcDriver {
244 let diff = timestamp - t; 244 let diff = timestamp - t;
245 if diff < 0xc00000 { 245 if diff < 0xc00000 {
246 r.intenset().write(|w| w.0 = compare_n(n)); 246 r.intenset().write(|w| w.0 = compare_n(n));
247
248 // If we have not passed the timestamp, we can be sure the alarm will be invoked. Otherwise,
249 // we need to retry setting the alarm.
250 if self.now() + 3 <= timestamp {
251 return true;
252 }
247 } else { 253 } else {
248 // If it's too far in the future, don't setup the compare channel yet. 254 // If it's too far in the future, don't setup the compare channel yet.
249 // It will be setup later by `next_period`. 255 // It will be setup later by `next_period`.
250 r.intenclr().write(|w| w.0 = compare_n(n)); 256 r.intenclr().write(|w| w.0 = compare_n(n));
251 }
252
253 // If we have not passed the timestamp, we can be sure the alarm will be invoked. Otherwise,
254 // we need to retry setting the alarm.
255 if self.now() + 3 <= timestamp {
256 return true; 257 return true;
257 } 258 }
258 } 259 }