Move safeguard if compare irq is enabled
This commit is contained in:
parent
06901c3279
commit
422938745a
@ -244,15 +244,16 @@ impl RtcDriver {
|
||||
let diff = timestamp - t;
|
||||
if diff < 0xc00000 {
|
||||
r.intenset().write(|w| w.0 = compare_n(n));
|
||||
|
||||
// If we have not passed the timestamp, we can be sure the alarm will be invoked. Otherwise,
|
||||
// we need to retry setting the alarm.
|
||||
if self.now() + 3 <= timestamp {
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
// If it's too far in the future, don't setup the compare channel yet.
|
||||
// It will be setup later by `next_period`.
|
||||
r.intenclr().write(|w| w.0 = compare_n(n));
|
||||
}
|
||||
|
||||
// If we have not passed the timestamp, we can be sure the alarm will be invoked. Otherwise,
|
||||
// we need to retry setting the alarm.
|
||||
if self.now() + 3 <= timestamp {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user