rtc_alarm.c File Reference
#include <stdlib.h>
#include "rtc_alarm.h"
#include "rtc.h"
#include "c_list.h"
#include "LPC17xx.h"
Include dependency graph for rtc_alarm.c:

Data Structures

struct  sem_alarm_t
 

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)
 
void RTC_IRQHandler (void)
 

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.
void RTC_IRQHandler ( void  )