Skip to content

Commit b53b4a2

Browse files
Merge pull request #168 from mariusknaust/master
Add methods for task clear and trigger overflow to the RTC
2 parents 7b58f2b + 93ef850 commit b53b4a2

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

nrf-hal-common/src/rtc.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,21 @@ where
203203
self.periph.counter.read().bits()
204204
}
205205

206+
/// Clear the Real Time Counter
207+
pub fn clear_counter(&self) {
208+
unsafe {
209+
self.periph.tasks_clear.write(|w| w.bits(1));
210+
}
211+
}
212+
213+
/// Sets the Real Time Counter value to 0xFFFFF0, to allow tests of the overflow condition.
214+
/// The overflow event occurs when the Real Time Counter overflows from 0xFFFFFF to 0.
215+
pub fn trigger_overflow(&self) {
216+
unsafe {
217+
self.periph.tasks_trigovrflw.write(|w| w.bits(1));
218+
}
219+
}
220+
206221
/// Destructure the high level interface. Does not reset any configuration made
207222
/// to the given RTC peripheral
208223
pub fn release(self) -> T {

0 commit comments

Comments
 (0)