embassy/embassy-hal-common/src/lib.rs

24 lines
596 B
Rust
Raw Normal View History

2021-03-08 00:15:40 +01:00
#![no_std]
2021-10-18 00:55:43 +02:00
#![allow(clippy::new_without_default)]
2021-03-08 00:15:40 +01:00
// This mod MUST go first, so that the others see its macros.
pub(crate) mod fmt;
pub mod drop;
pub mod interrupt;
mod macros;
pub mod peripheral;
2021-09-02 10:46:49 +02:00
pub mod ratio;
pub mod ring_buffer;
2021-03-19 01:30:35 +01:00
pub mod usb;
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();
}