embassy/embassy-nrf/src/util/mod.rs

13 lines
389 B
Rust
Raw Normal View History

pub mod peripheral;
pub mod ring_buffer;
2021-01-03 17:05:04 +01:00
/// 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();
}