Struct esp_idf_svc::hal::interrupt::asynch::HalIsrNotification
source · pub struct HalIsrNotification { /* private fields */ }
Expand description
Single-slot lock-free signaling primitive supporting signalling with a u32
bit-set.
A variation of the IsrNotification
HAL primitive which is however safe to be notified from an ISR context.
The difference between this primitive and IsrNotification
is that this one is hard-wired to the
global HAL wake runner (HAL_WAKE_RUNNER
) and is thus occupying less space.
It is useful for sending data between an ISR routine (or a regular task context) and an async task when the receiver only cares about the latest data, and therefore it’s fine to “lose” messages. This is often the case for “state” updates.
The sending part of the primitive is non-blocking and ISR-safe, so it can be called from anywhere.
Similar in spirit to the ESP-IDF FreeRTOS task notifications in that it is light-weight and operates on bit-sets, but for synchronization between an asynchronous task, and another one, which might be blocking or asynchronous.
Implementations§
source§impl HalIsrNotification
impl HalIsrNotification
sourcepub const fn new() -> HalIsrNotification
pub const fn new() -> HalIsrNotification
Creates a new HalIsrNotification
.
This method is safe to call from an ISR context, yet such use cases should not normally occur in practice.
sourcepub fn notify_lsb(&self) -> bool
pub fn notify_lsb(&self) -> bool
Marks the least significant bit (bit 0) in this IsrNotification
as nofified.
This method is safe to call from an ISR context.
Returns true
if there was a registered waker which got awoken.
sourcepub fn notify(&self, bits: NonZero<u32>) -> bool
pub fn notify(&self, bits: NonZero<u32>) -> bool
Marks the supplied bits in this HalIsrNotification
as notified.
This method is safe to call from an ISR context.
Returns true
if there was a registered waker which got awoken.
sourcepub fn reset(&self)
pub fn reset(&self)
Clears the state of this notification by removing any registered waker and setting all bits to 0. This method is NOT safe to call from an ISR context.