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

@ -63,12 +63,7 @@ impl<T: Send> Signal<T> {
futures::future::poll_fn(move |cx| self.poll_wait(cx))
}
/// Blocks until the signal has been received.
///
/// Returns immediately when [`poll_wait()`] has not been called before.
pub fn blocking_wait(&self) {
while cortex_m::interrupt::free(|_| {
matches!(unsafe { &*self.state.get() }, State::Waiting(_))
}) {}
pub fn signaled(&self) -> bool {
cortex_m::interrupt::free(|_| matches!(unsafe { &*self.state.get() }, State::Signaled(_)))
}
}