NinjaFlight
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Scheduler
Collaboration diagram for Scheduler:

Macros

#define REALTIME_GUARD_INTERVAL_MIN   10
 
#define REALTIME_GUARD_INTERVAL_MAX   300
 
#define REALTIME_GUARD_INTERVAL_MARGIN   25
 
#define VBATINTERVAL   (6 * 3500)
 
#define IBATINTERVAL   (6 * 3500)
 

Functions

void led_on (int id)
 
void led_off (int id)
 
void ninja_sched_get_task_info (struct ninja_sched *self, cfTaskId_e taskId, cfTaskInfo_t *taskInfo)
 
void ninja_sched_set_task_period (struct ninja_sched *self, cfTaskId_e taskId, uint32_t newPeriodMicros)
 
void ninja_sched_set_task_enabled (struct ninja_sched *self, cfTaskId_e taskId, bool enabled)
 
uint32_t ninja_sched_get_task_dt (struct ninja_sched *self, cfTaskId_e taskId)
 
void ninja_sched_init (struct ninja_sched *self, const struct system_calls_time *time, const struct config *config)
 
void ninja_sched_run (struct ninja_sched *self)
 
uint16_t ninja_sched_get_load (struct ninja_sched *self)
 

Detailed Description

Primary responsibility of this module is to define core tasks and their timing for the ninjaflight application. The scheduler is nothing more than a small cooperative scheduler that helps organize different cooperative processes. For example, you can define that the pid loop should run every 1000 microseconds and that receiver loop should run at 20000. This module helps decouple timing from the tasks themselves and uses current tick counter for determining when tasks need to run. It does not (and should not) do any preemptive task switching. It is a rather primitive scheduler actually.

Macro Definition Documentation

#define IBATINTERVAL   (6 * 3500)
#define REALTIME_GUARD_INTERVAL_MARGIN   25
#define REALTIME_GUARD_INTERVAL_MAX   300
#define REALTIME_GUARD_INTERVAL_MIN   10
#define VBATINTERVAL   (6 * 3500)

Function Documentation

void led_off ( int  id)
void led_on ( int  id)
uint16_t ninja_sched_get_load ( struct ninja_sched self)
uint32_t ninja_sched_get_task_dt ( struct ninja_sched self,
cfTaskId_e  taskId 
)
void ninja_sched_get_task_info ( struct ninja_sched self,
cfTaskId_e  taskId,
cfTaskInfo_t taskInfo 
)
void ninja_sched_init ( struct ninja_sched self,
const struct system_calls_time time,
const struct config config 
)

Here is the call graph for this function:

void ninja_sched_run ( struct ninja_sched self)
void ninja_sched_set_task_enabled ( struct ninja_sched self,
cfTaskId_e  taskId,
bool  enabled 
)
void ninja_sched_set_task_period ( struct ninja_sched self,
cfTaskId_e  taskId,
uint32_t  newPeriodMicros 
)