rtc_alarm.h File Reference

This file provides API to enable real-time clock FreeRTOS signals or alarms. More...

#include <stdint.h>
#include "FreeRTOS.h"
#include "semphr.h"
Include dependency graph for rtc_alarm.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  alarm_time_t
 

Enumerations

enum  alarm_freq_t { everySecond = 0, everyMinute = 1, everyHour = 2, everyDay = 3 }
 

Functions

void rtc_alarm_create_recurring (alarm_freq_t freq, SemaphoreHandle_t *pAlarm)
 
alarm_time_trtc_alarm_create (alarm_time_t time, SemaphoreHandle_t *pAlarm)
 

Detailed Description

This file provides API to enable real-time clock FreeRTOS signals or alarms.

Enumeration Type Documentation

Frequency of a recurring alarm

Enumerator
everySecond 
everyMinute 
everyHour 
everyDay 

Function Documentation

alarm_time_t* rtc_alarm_create ( alarm_time_t  time,
SemaphoreHandle_t pAlarm 
)

Enables alarm at the given

Parameters
time
Postcondition
pAlarm semaphore will be given when RTC time matches the given time.
Returns
alarm_time_t that can be used to modify alarm time
1 alarm_time_t my_time = { 12, 30, 0 }; // Alarm at 12:30 PM
2 alarm_time_t *my_alarm_time = rtc_alarm_create(my_time, &my_sem);
3 
4 // Check for alarm trigger :
5 if (xSemaphoreTask(my_sem, portMAX_DELAY)) {
6  // Do something
7 }
8 
9 // You can change the time any time :
10 my_alarm_time->hour = 13
void rtc_alarm_create_recurring ( alarm_freq_t  freq,
SemaphoreHandle_t pAlarm 
)

Enables a permanent recurring alarm every second, minute, or hour

Parameters
pAlarmThe signal (semaphore) to give when the alarm triggers
freqThe frequency of the alarm
See also
alarm_freq_t
Note
This is different from rtc_alarm_create() because once you enable this recurring alarm, there is no way to disable it or change it later.