ELEC-C7222
Libraries for ELEC C7222 Course Work
Loading...
Searching...
No Matches
c7222::FreeRtosTaskNotification Class Referencefinal

Utility interface for direct task notifications. More...

#include <freertos_task_notification.hpp>

Collaboration diagram for c7222::FreeRtosTaskNotification:
Collaboration graph

Public Types

enum class  Action : std::uint8_t {
  kNoAction = 0 , kSetBits , kIncrement , kSetValueWithOverwrite ,
  kSetValueWithoutOverwrite
}
 Notification update action. More...
 
using TaskHandle = void *
 Opaque task handle type.
 

Static Public Member Functions

static bool Notify (TaskHandle task_handle, std::uint32_t value, Action action)
 Send a notification to a task.
 
static bool NotifyFromISR (TaskHandle task_handle, std::uint32_t value, Action action)
 Send a notification to a task from ISR context.
 
static bool NotifyIndexed (TaskHandle task_handle, std::uint32_t index, std::uint32_t value, Action action)
 Indexed notification variant.
 
static bool NotifyIndexedFromISR (TaskHandle task_handle, std::uint32_t index, std::uint32_t value, Action action)
 Indexed ISR notification variant.
 
static bool Wait (std::uint32_t bits_to_clear_on_entry, std::uint32_t bits_to_clear_on_exit, std::uint32_t *out_value, std::uint32_t ticks_to_wait)
 Wait on current task notification value.
 
static bool WaitIndexed (std::uint32_t index, std::uint32_t bits_to_clear_on_entry, std::uint32_t bits_to_clear_on_exit, std::uint32_t *out_value, std::uint32_t ticks_to_wait)
 Indexed wait variant.
 
static std::uint32_t Take (bool clear_count_on_exit, std::uint32_t ticks_to_wait)
 Notification-as-count take helper for current task.
 
static std::uint32_t TakeIndexed (std::uint32_t index, bool clear_count_on_exit, std::uint32_t ticks_to_wait)
 Indexed notification-as-count take helper.
 

Detailed Description

Utility interface for direct task notifications.

Task notifications are lightweight per-task signaling values and are often used as fast alternatives to semaphores/queues for many one-to-one cases.

Typical usage:

// Sender:
1u << 0,
// Receiver task:
std::uint32_t value = 0;
if(c7222::FreeRtosTaskNotification::Wait(0, 0, &value, 100)) {
// process notification value
}
static bool Wait(std::uint32_t bits_to_clear_on_entry, std::uint32_t bits_to_clear_on_exit, std::uint32_t *out_value, std::uint32_t ticks_to_wait)
Wait on current task notification value.
static bool Notify(TaskHandle task_handle, std::uint32_t value, Action action)
Send a notification to a task.

Member Typedef Documentation

◆ TaskHandle

Opaque task handle type.

Member Enumeration Documentation

◆ Action

enum class c7222::FreeRtosTaskNotification::Action : std::uint8_t
strong

Notification update action.

Enumerator
kNoAction 
kSetBits 
kIncrement 
kSetValueWithOverwrite 
kSetValueWithoutOverwrite 

Member Function Documentation

◆ Notify()

static bool c7222::FreeRtosTaskNotification::Notify ( TaskHandle  task_handle,
std::uint32_t  value,
Action  action 
)
static

Send a notification to a task.

◆ NotifyFromISR()

static bool c7222::FreeRtosTaskNotification::NotifyFromISR ( TaskHandle  task_handle,
std::uint32_t  value,
Action  action 
)
static

Send a notification to a task from ISR context.

◆ NotifyIndexed()

static bool c7222::FreeRtosTaskNotification::NotifyIndexed ( TaskHandle  task_handle,
std::uint32_t  index,
std::uint32_t  value,
Action  action 
)
static

Indexed notification variant.

◆ NotifyIndexedFromISR()

static bool c7222::FreeRtosTaskNotification::NotifyIndexedFromISR ( TaskHandle  task_handle,
std::uint32_t  index,
std::uint32_t  value,
Action  action 
)
static

Indexed ISR notification variant.

◆ Take()

static std::uint32_t c7222::FreeRtosTaskNotification::Take ( bool  clear_count_on_exit,
std::uint32_t  ticks_to_wait 
)
static

Notification-as-count take helper for current task.

◆ TakeIndexed()

static std::uint32_t c7222::FreeRtosTaskNotification::TakeIndexed ( std::uint32_t  index,
bool  clear_count_on_exit,
std::uint32_t  ticks_to_wait 
)
static

Indexed notification-as-count take helper.

◆ Wait()

static bool c7222::FreeRtosTaskNotification::Wait ( std::uint32_t  bits_to_clear_on_entry,
std::uint32_t  bits_to_clear_on_exit,
std::uint32_t *  out_value,
std::uint32_t  ticks_to_wait 
)
static

Wait on current task notification value.

Parameters
bits_to_clear_on_entryBits cleared before waiting.
bits_to_clear_on_exitBits cleared before returning.
out_valueOptional resulting notification value.
ticks_to_waitMax ticks to wait.

◆ WaitIndexed()

static bool c7222::FreeRtosTaskNotification::WaitIndexed ( std::uint32_t  index,
std::uint32_t  bits_to_clear_on_entry,
std::uint32_t  bits_to_clear_on_exit,
std::uint32_t *  out_value,
std::uint32_t  ticks_to_wait 
)
static

Indexed wait variant.


The documentation for this class was generated from the following file: