1.19.17.6 RTCC_AlarmSet Function

C

bool RTCC_AlarmSet(struct tm *alarmTime, RTC_ALARM_MASK alarmFreq);

Summary

Sets the alarm time and date in the RTCC peripheral.

Description

This functions sets the alarm time and date in the RTCC peripheral.

Precondition

The RTCC_Initialize() function should have been called to initialize the RTCC peripheral.

Parameters

Param Description
alarmTime Structure which holds the alarm time and date information.
alarmFreq This parameter of type RTC_ALARM_MASK. Used to specify the recurrence of alarm.

Returns

Always return true. Discard the return value at the application level. This return is to satisfy the function signature requirement of drivers which uses different RTC PLIBs.

Example

struct tm alarm_time;
//15-01-2018 12:00:20 Monday
alarm_time.tm_hour = 23;
alarm_time.tm_min = 59;
alarm_time.tm_sec = 55;

alarm_time.tm_year = 18;
alarm_time.tm_mon = 12;
alarm_time.tm_mday = 31;
alarm_time.tm_wday = 1;

RTCC_AlarmSet(&alarm_time, RTC_ALARM_MASK_SECOND);

Remarks

This function checks RTCSYNC before writing into RTCTIME and RTCDATE registers. Thus no separate check for the bit is needed.