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#

sl_hal_burtc_init_t

Functions#

void
sl_hal_burtc_init(const sl_hal_burtc_init_t *init)

Initialize the Back-Up RTC.

void

Reset the Back-Up RTC.

void

Enable the Back-Up RTC.

void

Disable the Back-Up RTC.

void

Reset the Back-Up RTC counter.

void
sl_hal_burtc_set_compare(uint32_t value)

Set the Back-Up RTC compare register.

uint32_t

Get the Back-Up RTC compare register value.

void

Clear one or more pending BURTC interrupts.

void

Disable one or more BURTC interrupts.

void

Enable one or more BURTC interrupts.

uint32_t

Get pending BURTC interrupt flags.

uint32_t

Get enabled and pending BURTC interrupt flags.

void

Set one or more pending BURTC interrupts from SW.

uint32_t

Status of BURTC RAM, timestamp and LP Mode.

void

Wait for the BURTC to complete all synchronization of register changes and commands.

void

Start BURTC counter.

void

Stop the BURTC counter.

uint32_t

Get BURTC counter.

void

Lock BURTC registers, which will protect from writing new config settings.

void

Unlock BURTC registers, which will enable write access to change configuration.

Macros#

#define
SL_HAL_BURTC_INIT_DEFAULT undefined

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.

Parameters
TypeDirectionArgument NameDescription
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.

Parameters
TypeDirectionArgument NameDescription
voidN/A

sl_hal_burtc_enable#

void sl_hal_burtc_enable (void )

Enable the Back-Up RTC.

Parameters
TypeDirectionArgument NameDescription
voidN/A

sl_hal_burtc_disable#

void sl_hal_burtc_disable (void )

Disable the Back-Up RTC.

Parameters
TypeDirectionArgument NameDescription
voidN/A

sl_hal_burtc_reset_counter#

void sl_hal_burtc_reset_counter (void )

Reset the Back-Up RTC counter.

Parameters
TypeDirectionArgument NameDescription
voidN/A

sl_hal_burtc_set_compare#

void sl_hal_burtc_set_compare (uint32_t value)

Set the Back-Up RTC compare register.

Parameters
TypeDirectionArgument NameDescription
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.

Parameters
TypeDirectionArgument NameDescription
voidN/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.

Parameters
TypeDirectionArgument NameDescription
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.

Parameters
TypeDirectionArgument NameDescription
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.

Parameters
TypeDirectionArgument NameDescription
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.

Parameters
TypeDirectionArgument NameDescription
voidN/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.

Parameters
TypeDirectionArgument NameDescription
voidN/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.

Parameters
TypeDirectionArgument NameDescription
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.

Parameters
TypeDirectionArgument NameDescription
voidN/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.

Parameters
TypeDirectionArgument NameDescription
voidN/A

sl_hal_burtc_start#

void sl_hal_burtc_start (void )

Start BURTC counter.

Parameters
TypeDirectionArgument NameDescription
voidN/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.

Parameters
TypeDirectionArgument NameDescription
voidN/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.

Parameters
TypeDirectionArgument NameDescription
voidN/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.

Parameters
TypeDirectionArgument NameDescription
voidN/A

sl_hal_burtc_unlock#

void sl_hal_burtc_unlock (void )

Unlock BURTC registers, which will enable write access to change configuration.

Parameters
TypeDirectionArgument NameDescription
voidN/A