Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add methods for task clear and trigger overflow to the RTC #168

Merged
merged 4 commits into from
Jul 10, 2020
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions nrf-hal-common/src/rtc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,21 @@ where
self.periph.counter.read().bits()
}

/// Clear the Real Time Counter
mariusknaust marked this conversation as resolved.
Show resolved Hide resolved
pub fn clear_counter(&self) {
unsafe {
self.periph.tasks_clear.write(|w| w.bits(1));
}
}

/// Sets the Real Time Counter value to 0xFFFFF0, to allow tests of the overflow condition.
/// The overflow event occurs when the Real Time Counter overflows from 0xFFFFFF to 0.
pub fn trigger_overflow(&self) {
mariusknaust marked this conversation as resolved.
Show resolved Hide resolved
unsafe {
self.periph.tasks_trigovrflw.write(|w| w.bits(1));
}
}

/// Destructure the high level interface. Does not reset any configuration made
/// to the given RTC peripheral
pub fn release(self) -> T {
Expand Down