3#include "../../Inc/Scheduler/Scheduler.h"
18 for (
int i = 0; updatableArray[i] != NULL; i++) {
20 printf(
"Warning: Number of sensors exceeds MAX_SENSORS. "
21 "Some sensors will not be scheduled.\n");
26 if (updateable->
hz <= 0 || updateable->
hz >
MAX_HZ) {
32 int hz = 1000 / updateable->
hz;
33 int initialPriority = clock() / (CLOCKS_PER_SEC / 1000) + hz;
bool PQPeek(PriorityQueue *pq, Task *task)
Peeks at the highest priority task in the priority queue without removing it.
bool PQIsEmpty(PriorityQueue *pq)
Checks if the priority queue is empty.
bool PQPop(PriorityQueue *pq, Task *task)
Pops the highest priority task from the priority queue.
bool PQPush(PriorityQueue *pq, Task task, int priority)
Pushes a task with a given priority onto the priority queue.
void PQInit(PriorityQueue *pq)
Initializes the priority queue.
void SchedulerInit(Scheduler *scheduler, Updateable *updatableArray[])
Initializes the scheduler with the given sensors.
void SchedulerStop(Scheduler *scheduler)
Stops the scheduler.
void SchedulerRun(Scheduler *scheduler)
Runs the scheduler, executing tasks based on their priority.
void TaskInit(Task *task, Updateable *updateable, int hz)
Initializes a task with the given sensor and update frequency.
void TaskExecute(Task *task)
Executes the task by calling the sensor's update function.