Lamp-Da 0.1
A compact lantern project
Loading...
Searching...
No Matches
Typedefs | Functions | Variables
lampda::bsp::threads Namespace Reference

Define low level thread behavior and handling. More...

Typedefs

typedef void * TaskHandle_t
 
typedef void(* taskfunc_t) (void)
 model of a task function
 

Functions

const char *const get_name_from_hash (const uint32_t hash)
 
void start_thread (taskfunc_t taskFunction, const uint32_t taskName, const int priority, const int stackSize)
 Start a separate thread, running until the system shuts off.
 
void start_suspended_thread (taskfunc_t taskFunction, const uint32_t taskName, const int priority, const int stackSize)
 Start a separate thread, running until the system shuts off. Start in suspended state.
 
void yield_this_thread ()
 make this thread pass the control to other threads
 
void suspend_this_thread ()
 threads can only suspend itself
 
void resume_thread (const uint32_t taskName)
 resume a target thread
 
uint16_t get_usage_percent (const uint32_t taskName)
 Get the stack usage of this task, in percent.
 
void notify_thread (const uint32_t taskName, int wakeUpEvent)
 notify a thread to resume
 
int wait_notification (const int timeout_ms)
 block this thread until a timeout or notification is received
 
void display_thread_debug ()
 
void shutdown ()
 Shutdown the task driver cleanly.
 

Variables

const uint32_t pd_taskName = utils::hash("usbpd")
 name of the USB power delivery task
 
const uint32_t pdInterruptHandle_taskName = utils::hash("intpd")
 name of the USB power delivery interrupt handle task
 
const uint32_t button_taskName = utils::hash("button")
 
const uint32_t power_taskName = utils::hash("power")
 name of the main power task
 
const uint32_t user_taskName = utils::hash("user")
 name of the optional user task
 
const uint32_t taskScheduler_taskName = utils::hash("task_sched")
 name of the task scheduling task
 
const uint32_t sunset_taskName = utils::hash("sunset")
 name of the task schedule sunset
 
const uint32_t ble_cli_taskName = utils::hash("ble_cli")
 BLE cli queue.
 
const uint32_t print_taskName = utils::hash("print")
 UART print task.
 

Detailed Description

Define low level thread behavior and handling.

Function Documentation

◆ get_usage_percent()

uint16_t lampda::bsp::threads::get_usage_percent ( const uint32_t  taskName)

Get the stack usage of this task, in percent.

Returns
usage, in [0; 100]

◆ notify_thread()

void lampda::bsp::threads::notify_thread ( const uint32_t  taskName,
int  wakeUpEvent 
)

notify a thread to resume

Parameters
[in]taskNametarget task name
[in]wakeUpEventtype of the event to send

◆ resume_thread()

void lampda::bsp::threads::resume_thread ( const uint32_t  taskName)

resume a target thread

Parameters
[in]taskNametarget task name

◆ start_suspended_thread()

void lampda::bsp::threads::start_suspended_thread ( taskfunc_t  taskFunction,
const uint32_t  taskName,
const int  priority,
const int  stackSize 
)

Start a separate thread, running until the system shuts off. Start in suspended state.

Parameters
taskFunctionthe function to run
[in]taskNameThe name associated
[in]priorityfrom to 2, this thread priority
[in]stackSizeThe size of the stack to allocate. can be ignored and checked while running using the command line

◆ start_thread()

void lampda::bsp::threads::start_thread ( taskfunc_t  taskFunction,
const uint32_t  taskName,
const int  priority,
const int  stackSize 
)

Start a separate thread, running until the system shuts off.

Parameters
taskFunctionthe function to run
[in]taskNameThe name associated
[in]priorityfrom to 2, this thread priority
[in]stackSizeThe size of the stack to allocate. can be ignored and checked while running using the command line

◆ wait_notification()

int lampda::bsp::threads::wait_notification ( const int  timeout_ms)

block this thread until a timeout or notification is received

Parameters
[in]timeout_msTimeout delay. Can be zero of less for no timeout
Returns
the wake up flag