Merge pull request #14 from timokroeger/uarte-power-optimization

UARTE power optimization and improvements
This commit is contained in:
Dario Nieuwenhuis
2021-01-05 22:10:52 +01:00
committed by GitHub
3 changed files with 91 additions and 42 deletions

View File

@ -1,2 +1,12 @@
pub mod peripheral;
pub mod ring_buffer;
/// Low power blocking wait loop using WFE/SEV.
pub fn low_power_wait_until(mut condition: impl FnMut() -> bool) {
while !condition() {
// WFE might "eat" an event that would have otherwise woken the executor.
cortex_m::asm::wfe();
}
// Retrigger an event to be transparent to the executor.
cortex_m::asm::sev();
}