STM32 RTC Scheduler
RTC-based scheduler for ultra-low power applications
|
This file contains the RTC-based scheduler definitions, structures and function prototypes. More...
#include "stm32l4xx_hal.h"
Go to the source code of this file.
Data Structures | |
struct | Job_t |
struct | Scheduler_t |
Macros | |
#define | MAX_NUM_OF_JOBS 10U |
Typedefs | |
typedef void(* | Callback_t) (void) |
Functions | |
void | SchedulerInit (void) |
Initialize the scheduler by setting its structure values to zero. | |
uint8_t | SchedulerAddJob (const uint32_t period, const Callback_t callback) |
Add a new job to the scheduler. More... | |
void | SchedulerProcess (void) |
Process the scheduler. More... | |
void | SchedulerExecutePendingJobs (void) |
Execute the pending jobs. More... | |
void | SchedulerStop (void) |
Stop the scheduler. More... | |
This file contains the RTC-based scheduler definitions, structures and function prototypes.
STM32 RTC Scheduler
Definition in file scheduler.h.
#define MAX_NUM_OF_JOBS 10U |
Maximum number of jobs that are allowed to be configured
Definition at line 27 of file scheduler.h.
typedef void(* Callback_t) (void) |
Shorthand type for callback functions
Definition at line 31 of file scheduler.h.
uint8_t SchedulerAddJob | ( | const uint32_t | period, |
const Callback_t | callback | ||
) |
Add a new job to the scheduler.
period | The period in [s] which the job needs to be executed. |
callback | The callback function that is called upon job execution. |
Definition at line 43 of file scheduler.c.
void SchedulerExecutePendingJobs | ( | void | ) |
Execute the pending jobs.
This function checks the current state of each job. If a job is pending, its callback is executed.
Definition at line 159 of file scheduler.c.
void SchedulerProcess | ( | void | ) |
Process the scheduler.
This function needs to be called each time upon an RTC alarm interrupt. The function checks all jobs whether they need to be executed and sets the appropriate pending flags.
Definition at line 85 of file scheduler.c.
void SchedulerStop | ( | void | ) |
Stop the scheduler.
This function stops the running scheduler and deactivates the RTC alarm. The function also processes the jobs.
Definition at line 188 of file scheduler.c.