BURTC - Back-Up Real Time Counter#
Back-up Real Time Counter (BURTC) Peripheral API.
This module contains functions to control the BURTC peripheral. The Backup Real Time Counter allows timekeeping in all energy modes. The Backup RTC is also available when the system is in backup mode.
Example#
This example demonstrates initialization, basic configuration, and usage of the BURTC peripheral. It shows how to:
Initialize the BURTC with default settings
Start and stop the counter
Configure and read the compare register value
#include "sl_hal_burtc.h"
void burtc_example(void)
{
// Initialize configuration structure with default settings
sl_hal_burtc_init_t init = SL_HAL_BURTC_INIT_DEFAULT;
// Initialize BURTC with default settings
sl_hal_burtc_init(&init);
// Enable and start the BURTC counter
sl_hal_burtc_enable();
sl_hal_burtc_start();
// Set compare value for generating an interrupt
sl_hal_burtc_set_compare(1000); // Set to 1000 counts
// Get the current compare value
uint32_t compare_value = sl_hal_burtc_get_compare();
// Later, when done using the BURTC
sl_hal_burtc_stop();
sl_hal_burtc_disable();
}
Modules#
Functions#
Initialize the Back-Up RTC.
Reset the Back-Up RTC.
Enable the Back-Up RTC.
Disable the Back-Up RTC.
Reset the Back-Up RTC counter.
Set the Back-Up RTC compare register.
Get the Back-Up RTC compare register value.
Clear one or more pending BURTC interrupts.
Disable one or more BURTC interrupts.
Enable one or more BURTC interrupts.
Get pending BURTC interrupt flags.
Get enabled and pending BURTC interrupt flags.
Set one or more pending BURTC interrupts from SW.
Status of BURTC RAM, timestamp and LP Mode.
Wait for the BURTC to complete all synchronization of register changes and commands.
Start BURTC counter.
Stop the BURTC counter.
Get BURTC counter.
Lock BURTC registers, which will protect from writing new config settings.
Unlock BURTC registers, which will enable write access to change configuration.
Macros#
Default configuration for BURTC init structure.
Function Documentation#
sl_hal_burtc_init#
void sl_hal_burtc_init (const sl_hal_burtc_init_t * init)
Initialize the Back-Up RTC.
Type | Direction | Argument Name | Description |
---|---|---|---|
const sl_hal_burtc_init_t * | [in] | init | A pointer to the initialization structure used to configure the BURTC. |
sl_hal_burtc_reset#
void sl_hal_burtc_reset (void )
Reset the Back-Up RTC.
Type | Direction | Argument Name | Description |
---|---|---|---|
void | N/A |
sl_hal_burtc_enable#
void sl_hal_burtc_enable (void )
Enable the Back-Up RTC.
Type | Direction | Argument Name | Description |
---|---|---|---|
void | N/A |
sl_hal_burtc_disable#
void sl_hal_burtc_disable (void )
Disable the Back-Up RTC.
Type | Direction | Argument Name | Description |
---|---|---|---|
void | N/A |
sl_hal_burtc_reset_counter#
void sl_hal_burtc_reset_counter (void )
Reset the Back-Up RTC counter.
Type | Direction | Argument Name | Description |
---|---|---|---|
void | N/A |
sl_hal_burtc_set_compare#
void sl_hal_burtc_set_compare (uint32_t value)
Set the Back-Up RTC compare register.
Type | Direction | Argument Name | Description |
---|---|---|---|
uint32_t | [in] | value | Back-Up RTC compare register value. |
sl_hal_burtc_get_compare#
uint32_t sl_hal_burtc_get_compare (void )
Get the Back-Up RTC compare register value.
Type | Direction | Argument Name | Description |
---|---|---|---|
void | N/A |
Returns
return the Back-Up RTC compare register value.
sl_hal_burtc_clear_interrupts#
void sl_hal_burtc_clear_interrupts (uint32_t flags)
Clear one or more pending BURTC interrupts.
Type | Direction | Argument Name | Description |
---|---|---|---|
uint32_t | [in] | flags | BURTC interrupt sources to clear. Use a set of interrupt flags OR-ed together to clear multiple interrupt sources for the BURTC module (BURTC_IF_CLR_nnn). |
sl_hal_burtc_disable_interrupts#
void sl_hal_burtc_disable_interrupts (uint32_t flags)
Disable one or more BURTC interrupts.
Type | Direction | Argument Name | Description |
---|---|---|---|
uint32_t | [in] | flags | BURTC interrupt sources to disable. Use a set of interrupt flags OR-ed together to disable multiple interrupt sources for the BURTC module. |
sl_hal_burtc_enable_interrupts#
void sl_hal_burtc_enable_interrupts (uint32_t flags)
Enable one or more BURTC interrupts.
Type | Direction | Argument Name | Description |
---|---|---|---|
uint32_t | [in] | flags | BURTC interrupt sources to enable. Use a set of interrupt flags OR-ed together to set multiple interrupt sources for the BURTC module. |
Note
Depending on use, a pending interrupt may already be set prior to enabling the interrupt. Consider using sl_hal_burtc_clear_interrupts() prior to enabling, if a pending interrupt should be ignored.
sl_hal_burtc_get_pending_interrupts#
uint32_t sl_hal_burtc_get_pending_interrupts (void )
Get pending BURTC interrupt flags.
Type | Direction | Argument Name | Description |
---|---|---|---|
void | N/A |
Note
This function does not clear the event bits.
Returns
Pending BURTC interrupt sources. Returns a set of interrupt flags OR-ed together for multiple interrupt sources in the BURTC module.
sl_hal_burtc_get_enabled_pending_interrupts#
uint32_t sl_hal_burtc_get_enabled_pending_interrupts (void )
Get enabled and pending BURTC interrupt flags.
Type | Direction | Argument Name | Description |
---|---|---|---|
void | N/A |
Note
The event bits are not cleared by the use of this function.
Returns
Pending BURTC interrupt sources that is also enabled. Returns a set of interrupt flags OR-ed together for multiple interrupt sources in the BURTC module.
sl_hal_burtc_set_interrupts#
void sl_hal_burtc_set_interrupts (uint32_t flags)
Set one or more pending BURTC interrupts from SW.
Type | Direction | Argument Name | Description |
---|---|---|---|
uint32_t | [in] | flags | BURTC interrupt sources to set to pending. Use a set of interrupt flags OR-ed together to set multiple interrupt sources for the BURTC module. |
sl_hal_burtc_get_status#
uint32_t sl_hal_burtc_get_status (void )
Status of BURTC RAM, timestamp and LP Mode.
Type | Direction | Argument Name | Description |
---|---|---|---|
void | N/A |
Returns
A mask logically OR-ed status bits.
sl_hal_burtc_wait_sync#
void sl_hal_burtc_wait_sync (void )
Wait for the BURTC to complete all synchronization of register changes and commands.
Type | Direction | Argument Name | Description |
---|---|---|---|
void | N/A |
sl_hal_burtc_start#
void sl_hal_burtc_start (void )
Start BURTC counter.
Type | Direction | Argument Name | Description |
---|---|---|---|
void | N/A |
This function will send a start command to the BURTC peripheral. The BURTC peripheral will use some LF clock ticks before the command is executed. The sl_hal_burtc_wait_sync() function can be used to wait for the start command to be executed.
Note
This function requires the BURTC to be enabled.
sl_hal_burtc_stop#
void sl_hal_burtc_stop (void )
Stop the BURTC counter.
Type | Direction | Argument Name | Description |
---|---|---|---|
void | N/A |
This function will send a stop command to the BURTC peripheral. The BURTC peripheral will use some LF clock ticks before the command is executed. The sl_hal_burtc_wait_sync() function can be used to wait for the stop command to be executed.
Note
This function requires the BURTC to be enabled.
sl_hal_burtc_get_counter#
uint32_t sl_hal_burtc_get_counter (void )
Get BURTC counter.
Type | Direction | Argument Name | Description |
---|---|---|---|
void | N/A |
Returns
BURTC counter value.
sl_hal_burtc_lock#
void sl_hal_burtc_lock (void )
Lock BURTC registers, which will protect from writing new config settings.
Type | Direction | Argument Name | Description |
---|---|---|---|
void | N/A |
sl_hal_burtc_unlock#
void sl_hal_burtc_unlock (void )
Unlock BURTC registers, which will enable write access to change configuration.
Type | Direction | Argument Name | Description |
---|---|---|---|
void | N/A |