aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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 }