Vehicle Control Unit 0.01
This is the c library for controlling the car.
Loading...
Searching...
No Matches
Functions
Task.c File Reference
#include "../../Inc/Scheduler/Task.h"
Include dependency graph for Task.c:

Go to the source code of this file.

Functions

void TaskInit (Task *task, Updateable *updateable, int hz)
 Initializes a task with the given sensor and update frequency. More...
 
void TaskExecute (Task *task)
 Executes the task by calling the sensor's update function. More...
 

Function Documentation

◆ TaskExecute()

void TaskExecute ( Task task)

Executes the task by calling the sensor's update function.

Parameters
taskPointer to the Task structure to execute.

This function executes the task by invoking the update function of the associated sensor, if it exists.

Definition at line 9 of file Task.c.

9 {
10 if (task->updateable && task->updateable->update) {
11 UPDATE(task);
12 }
13}
#define UPDATE(item_)
Definition: Updateable.h:8
Updateable * updateable
Definition: Task.h:11
void(* update)(void *self)
Definition: Updateable.h:26
Here is the caller graph for this function:

◆ TaskInit()

void TaskInit ( Task task,
Updateable updateable,
int  hz 
)

Initializes a task with the given sensor and update frequency.

Parameters
taskPointer to the Task structure to initialize.
updateablePointer to the Updateable structure associated with the task.
hzThe update frequency in Hertz.

This function sets up a task by assigning the specified sensor and update frequency. It also initializes the next execution time to zero.

Definition at line 3 of file Task.c.

3 {
4 task->updateable = updateable;
5 task->hz = hz;
6 task->nextExecTime = 0;
7}
int hz
Definition: Task.h:9
highResTime nextExecTime
Definition: Task.h:10
Here is the caller graph for this function: