High level interface for interacting with the Cypress RTC.
The real time clock provides tracking of the current time and date, as well as the ability to trigger a callback at a specific time in the future.
If a suitable clock source is available, the RTC can continue timekeeping operations even when the device is in a low power operating mode. See the device datasheet for more details.
◆ cyhal_alarm_active_t
| struct cyhal_alarm_active_t |
| Data Fields |
|
uint8_t |
en_sec: 1 |
|
|
uint8_t |
en_min: 1 |
!< Enable match of seconds
|
|
uint8_t |
en_hour: 1 |
!< Enable match of minutes
|
|
uint8_t |
en_day: 1 |
!< Enable match of hours
|
|
uint8_t |
en_date: 1 |
!< Enable match of day of week
|
|
uint8_t |
en_month: 1 |
!< Enable match of date in month
|
◆ CY_RSLT_RTC_NOT_INITIALIZED
◆ cyhal_rtc_event_callback_t
| typedef void(* cyhal_rtc_event_callback_t) (void *callback_arg, cyhal_rtc_event_t event) |
◆ cyhal_rtc_event_t
◆ cyhal_rtc_init()
Initialize the RTC peripheral
Powerup the RTC in preparation for access. This function must be called before any other RTC functions are called. This does not change the state of the RTC. It just enables access to it. NOTE: Before calling this, make sure all necessary System Clocks are setup correctly. Generally this means making sure the RTC has access to a Crystal for optimal accuracy and operation in low power.
- Parameters
-
- Returns
- The status of the init request
◆ cyhal_rtc_free()
Deinitialize RTC
Frees resources associated with the RTC and disables CPU access. This only affects the CPU domain and not the time keeping logic. After this function is called no other RTC functions should be called except for rtc_init.
- Parameters
-
◆ cyhal_rtc_is_enabled()
Check if the RTC has the time set and is counting
- Parameters
-
- Returns
- Whether the RTC is enabled or not
◆ cyhal_rtc_read()
Get the current time from the RTC peripheral
- Parameters
-
- Returns
- The status of the read request
◆ cyhal_rtc_write()
Write the current time in seconds to the RTC peripheral
- Parameters
-
- Returns
- The status of the write request
◆ cyhal_rtc_set_alarm()
Set an alarm for the specified time in seconds to the RTC peripheral
- Parameters
-
- Returns
- The status of the set_alarm request
◆ cyhal_rtc_register_callback()
The RTC event callback handler registration
- Parameters
-
| [in] | obj | The RTC object |
| [in] | callback | The callback handler which will be invoked when the alarm fires |
| [in] | callback_arg | Generic argument that will be provided to the callback when called |
◆ cyhal_rtc_enable_event()
Configure RTC event enablement.
- Parameters
-
| [in] | obj | The RTC object |
| [in] | event | The RTC event type |
| [in] | intrPriority | The priority for NVIC interrupt events |
| [in] | enable | True to turn on interrupts, False to turn off |