LoRa-BLE-Sensor
Loading...
Searching...
No Matches
sensor_scheduling.h
Go to the documentation of this file.
1
12#ifndef SENSOR_SCHEDULING_H
13#define SENSOR_SCHEDULING_H
14
15#include "sensor_timer.h"
16#include <stdint.h>
17#include <zephyr/kernel.h>
18#include <zephyr/device.h>
19
25 SENSOR_SCHEDULING_ID_SENSOR1,
26 SENSOR_SCHEDULING_ID_SENSOR2,
27 SENSOR_SCHEDULING_ID_RADIO, // Radio is the last scheduled component in case sensors are triggered at the same time
28 SENSOR_SCHEDULING_ID_LIMIT,
29};
30
34typedef struct {
35 /* The id of the component to schedule */
37 /* The frequency of the schedule in seconds */
38 uint32_t frequency_seconds;
39 /* Whether this component is currently scheduled */
40 uint8_t is_scheduled;
41 /* Whether this component schedule has been triggered */
42 uint8_t is_triggered;
43 /* Last event time in seconds */
44 uint32_t last_event_time;
45 /* An optional trigger that isn't based on the frequency and is used for one-time events */
46 uint8_t one_time_trigger;
48
55int sensor_scheduling_init(const struct device *timer);
56
64
72
81
88
89#endif
int sensor_scheduling_init(const struct device *timer)
Initialize the sensor scheduling module.
Definition sensor_scheduling.c:91
int sensor_scheduling_get_seconds(void)
Get the current time in seconds since the scheduling module was initialized.
Definition sensor_scheduling.c:152
int sensor_scheduling_reset_schedule(sensor_scheduling_cfg_t *schedule)
Reset a schedule in the sensor scheduling module. This will set the alarm to trigger at the given fre...
Definition sensor_scheduling.c:123
int sensor_scheduling_add_schedule(sensor_scheduling_cfg_t *schedule)
Add a schedule to the sensor scheduling module.
Definition sensor_scheduling.c:103
sensor_scheduling_id
Enum for the sensor scheduling id. This is used to identify the sensor or radio to schedule.
Definition sensor_scheduling.h:24
int sensor_scheduling_remove_schedule(sensor_scheduling_cfg_t *schedule)
Remove a schedule from the sensor scheduling module.
Definition sensor_scheduling.c:114
This is a library to keep track of sensor and radio timers. Manages alarms for sensors and radio tran...
Structure for the sensor scheduling configuration, each sensor and radio will have a schedule.
Definition sensor_scheduling.h:34