3. Demonstration Example - RTC Description¶
This section analyzes an application example which demonstrates using the RTC functionality. The application also demonstrates alerts based on freeRTOS Timers functionality. The example uses the freertos_retarget sample code, found in the SDK, as its framework. Two additional tasks have been created: one task performs RTC measurements and, based on the results, computes the current date and time in standard format; the second task performs alert operations based on freeRTOS events. The code also enables the wake-up timer for handling external events. To aid readability, using the alert functionality is described in the next section.
3.1. Application Structure of RTC Functionality¶
- The key goal of this task is for the device to calculate the current time and date following an event.
For demonstration purposes, the button K1 (P1.6) on the Pro DevKit has been configured as a wake-up pin.
For more information on how to configure and set a pin to handle external
events, please read the External Interruption tutorial. At each external event (produced at every
button press - K1 on Pro Devkit) a dedicated callback function named
wkup_cb()
is triggered. This callback executes many operations including the activation ofprvRTC_Task()
.
- In this freeRTOS task, the current date and time is read through the RTC functionality. Depending on the value of SW_RTC_DBG_MESSAGES_CONSOLE, the current date and time are printed out on the serial console.