pub struct EventGroup { /* private fields */ }Expand description
Event group — a set of named bits that can be set, cleared, and waited on.
Implementations§
Source§impl EventGroup
impl EventGroup
Sourcepub fn create(storage: &'static EventGroupStorage) -> Result<Self>
pub fn create(storage: &'static EventGroupStorage) -> Result<Self>
Mode-agnostic constructor (see crate::Mutex::create).
Sourcepub fn set_bits(&self, bits: u32) -> u32
pub fn set_bits(&self, bits: u32) -> u32
Set bits in the event group. Returns the bits value after setting.
Sourcepub fn clear_bits(&self, bits: u32) -> u32
pub fn clear_bits(&self, bits: u32) -> u32
Clear bits in the event group. Returns the bits value before clearing.
Sourcepub fn wait_bits(&self, bits: u32, flags: WaitFlags) -> Result<u32>
pub fn wait_bits(&self, bits: u32, flags: WaitFlags) -> Result<u32>
Wait indefinitely for the specified bits to be set. Returns the bits value at the moment the wait condition was satisfied.
flags is a combination of WaitFlags::WAIT_ALL and
WaitFlags::CLEAR_ON_EXIT.
Sourcepub fn try_wait_bits(&self, bits: u32, flags: WaitFlags) -> Result<u32>
pub fn try_wait_bits(&self, bits: u32, flags: WaitFlags) -> Result<u32>
Non-blocking check for the specified bits.
§Errors
Returns Error::Timeout if the bits are not currently set.
Sourcepub fn wait_bits_for(
&self,
bits: u32,
flags: WaitFlags,
d: Duration,
) -> Result<u32>
pub fn wait_bits_for( &self, bits: u32, flags: WaitFlags, d: Duration, ) -> Result<u32>
Wait up to d for the specified bits.
Sourcepub fn wait_bits_until(
&self,
bits: u32,
flags: WaitFlags,
deadline: Instant,
) -> Result<u32>
pub fn wait_bits_until( &self, bits: u32, flags: WaitFlags, deadline: Instant, ) -> Result<u32>
Wait by the given deadline. Use
Instant::FOREVER for an
indefinite wait.
Sourcepub fn set_bits_from_isr(&self, bits: u32) -> u32
pub fn set_bits_from_isr(&self, bits: u32) -> u32
Set bits from an ISR context. Returns the bits value after setting.
Sourcepub unsafe fn set_notify(
&self,
cb: Option<unsafe extern "C" fn(*mut c_void)>,
user_data: *mut c_void,
) -> Result<()>
pub unsafe fn set_notify( &self, cb: Option<unsafe extern "C" fn(*mut c_void)>, user_data: *mut c_void, ) -> Result<()>
Register a notify callback fired after every successful set_bits.
Wraps the C-level ove_eventgroup_set_notify.
§Safety
Same as crate::Stream::set_notify: user_data must remain
valid for as long as the callback may fire, and cb must be
ISR-safe (the C-side invokes it from whatever context the set
ran in, thread or ISR).