1.2.19.56 1.3.22.56 1.4.20.56 1.5.21.56 1.6.21.56 1.7.22.56 1.8.17.13 1.25.17.11 1.26.15.11 1.27.17.11 1.28.20.11 1.29.21.56 1.30.15.39 1.31.15.39 1.32.24.56 1.33.15.39 1.34.16.11 1.35.11.11 1.36.14.11 1.37.15.39 1.38.20.56 1.39.17.56 1.40.19.56 1.41.17.11 1.42.15.11 RTC_CALLBACK Typedef
C
typedef void (*RTC_CALLBACK)( RTC_CLOCK_EVENT event, uintptr_t context ); OR typedef void (*RTC_CALLBACK)(uint32_t int_cause, uintptr_t context);
Summary
Defines the data type and function signature of the Real Time Clock Calendar callback function.
Description
This data type defines the function signature of the RTC Real Time Clock Calendar Callback function. The RTC peripheral will call back the client's function with this signature when the configured RTCC Alarm has occurred.
The application should register a callback function whose signature (input arguments and return type) must match the signature of this function. The callback function should be registered by calling the RTC_RTCCCallbackRegister() function. The callback function should be registered before setting the alarm.
Precondition
The RTC_Initialize() function should have been called to initialize the RTC peripheral. The RTC_RTCCCallbackRegister() function should have been called to register the callback function. The RTC peripheral should have been configured for RTCC operation in MHC. The RTC peripheral should have been configured for interrupt mode of operation in MHC.
Parameters
For prototype
typedef void (*RTC_CALLBACK)( RTC_CLOCK_EVENT event, uintptr_t context );
Param | Description |
---|---|
event | RTCC event that caused the callback function to be called. Multiple events could be active. Application should process all events in the callback function. |
context | Allows the caller to provide a context value (usually a pointer to the callers context for multi-instance clients) |
For prototype
typedef void (*RTC_CALLBACK)(uint32_t int_cause, uintptr_t context);
Param | Description |
---|---|
int_cause | RTC interrupt cause |
context | Allows the caller to provide a context value (usually a pointer to the callers context for multi-instance clients) |
Returns
None.
Example
void MyRTCCCallback ( RTC_CLOCK_EVENT event, uintptr_t context ) { if((event & RTC_CLOCK_EVENT_YEAR_OVERFLOW) == RTC_CLOCK_EVENT_YEAR_OVERFLOW) { // This means a year overflow has occurred. } else if ((event & RTC_CLOCK_EVENT_ALARM) == RTC_CLOCK_EVENT_ALARM) { // This means an alarm has occurred. } } // Initialize the RTC Peripheral and register the callback function. // Note how the pointer to the alarmOccurred flag is specified // as the context. This is passed back into the callback function. // Refer to the description of the RTC_RTCCTimeSet() and // RTC_RTCCAlarmSet() function for API usage details. RTC_Initialize(); RTC_RTCCTimeSet(&time); RTC_RTCCAlarmSet(&alarm); RTC_RTCCCallbackRegister(MyRTCCCallback, &alarmOccurred);
Remarks
The Real Time Clock Calendar feature is available when the RTC peripheral is configured for Real Time Clock Calendar mode. The callback function will be execute in an interrupt context. Avoid calling blocking functions , performing computationally intensive operations or interrupt un-safe functions from the callback function.