Firmware SDK
twr_scheduler

Task scheduler. More...

Macros

#define TWR_SCHEDULER_MAX_TASKS   32
 Maximum number of tasks.
 
#define TWR_SCHEDULER_INTERVAL_MS   10
 

Typedefs

typedef size_t twr_scheduler_task_id_t
 Task ID assigned by scheduler.
 

Functions

void twr_scheduler_init (void)
 Initialize task scheduler.
 
void twr_scheduler_run (void)
 Run task scheduler (this call never ends)
 
twr_scheduler_task_id_t twr_scheduler_register (void(*task)(void *), void *param, twr_tick_t tick)
 Register task in scheduler. More...
 
void twr_scheduler_unregister (twr_scheduler_task_id_t task_id)
 Unregister specified task. More...
 
twr_scheduler_task_id_t twr_scheduler_get_current_task_id (void)
 Get task ID of currently executing task. More...
 
twr_tick_t twr_scheduler_get_spin_tick (void)
 Get current tick of spin in which task has been run. More...
 
void twr_scheduler_disable_sleep (void)
 Disable sleep mode, implemented as semaphore.
 
void twr_scheduler_enable_sleep (void)
 Enable sleep mode, implemented as semaphore.
 
void twr_scheduler_plan_now (twr_scheduler_task_id_t task_id)
 Schedule specified task for immediate execution. More...
 
void twr_scheduler_plan_absolute (twr_scheduler_task_id_t task_id, twr_tick_t tick)
 Schedule specified task to absolute tick. More...
 
void twr_scheduler_plan_relative (twr_scheduler_task_id_t task_id, twr_tick_t tick)
 Schedule specified task to tick relative from current spin. More...
 
void twr_scheduler_plan_from_now (twr_scheduler_task_id_t task_id, twr_tick_t tick)
 Schedule specified task to tick relative from now. More...
 
void twr_scheduler_plan_current_now (void)
 Schedule current task for immediate execution.
 
void twr_scheduler_plan_current_absolute (twr_tick_t tick)
 Schedule current task to absolute tick. More...
 
void twr_scheduler_plan_current_relative (twr_tick_t tick)
 Schedule current task to tick relative from current spin. More...
 
void twr_scheduler_plan_current_from_now (twr_tick_t tick)
 Schedule current task to tick relative from now. More...
 

Detailed Description

Task scheduler.

Function Documentation

◆ twr_scheduler_get_current_task_id()

twr_scheduler_task_id_t twr_scheduler_get_current_task_id ( void  )

Get task ID of currently executing task.

Returns
Task ID

Definition at line 100 of file twr_scheduler.c.

◆ twr_scheduler_get_spin_tick()

twr_tick_t twr_scheduler_get_spin_tick ( void  )

Get current tick of spin in which task has been run.

Returns
Tick of spin

Definition at line 105 of file twr_scheduler.c.

◆ twr_scheduler_plan_absolute()

void twr_scheduler_plan_absolute ( twr_scheduler_task_id_t  task_id,
twr_tick_t  tick 
)

◆ twr_scheduler_plan_current_absolute()

void twr_scheduler_plan_current_absolute ( twr_tick_t  tick)

Schedule current task to absolute tick.

Parameters
[in]tickTick at which the task will be run

Definition at line 151 of file twr_scheduler.c.

◆ twr_scheduler_plan_current_from_now()

void twr_scheduler_plan_current_from_now ( twr_tick_t  tick)

Schedule current task to tick relative from now.

Parameters
[in]tickTick at which the task will be run as a relative value from now

Definition at line 161 of file twr_scheduler.c.

Here is the call graph for this function:

◆ twr_scheduler_plan_current_relative()

void twr_scheduler_plan_current_relative ( twr_tick_t  tick)

Schedule current task to tick relative from current spin.

Parameters
[in]tickTick at which the task will be run as a relative value from current spin

Definition at line 156 of file twr_scheduler.c.

◆ twr_scheduler_plan_from_now()

void twr_scheduler_plan_from_now ( twr_scheduler_task_id_t  task_id,
twr_tick_t  tick 
)

Schedule specified task to tick relative from now.

Parameters
[in]task_idTask ID to be scheduled
[in]tickTick at which the task will be run as a relative value from now

Definition at line 137 of file twr_scheduler.c.

Referenced by twr_led_pulse().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ twr_scheduler_plan_now()

◆ twr_scheduler_plan_relative()

◆ twr_scheduler_register()

◆ twr_scheduler_unregister()