BURTC

Detailed Description

Backup Real Time Counter (BURTC) Peripheral API.

This module contains functions to control the BURTC peripheral of Silicon Labs 32-bit MCUs. The Backup Real Time Counter allows timekeeping in all energy modes. The Backup RTC is also available when the system is in backup mode.

Data Structures

struct BURTC_Init_TypeDef

Macros

#define BURTC_INIT_DEFAULT
#define burtcClkDiv_1 1
#define burtcClkDiv_128 128
#define burtcClkDiv_16 16
#define burtcClkDiv_2 2
#define burtcClkDiv_32 32
#define burtcClkDiv_4 4
#define burtcClkDiv_64 64
#define burtcClkDiv_8 8

Functions

uint32_t BURTC_ClockFreqGet (void)
uint32_t BURTC_CompareGet (unsigned int comp)
Get the BURTC compare value.
void BURTC_CompareSet (unsigned int comp, uint32_t value)
Set BURTC compare channel.
__STATIC_INLINE uint32_t BURTC_CounterGet (void)
Get BURTC counter.
void BURTC_CounterReset (void)
Reset counter.
void BURTC_Enable (bool enable)
Enable or Disable BURTC peripheral.
void BURTC_Init (const BURTC_Init_TypeDef *burtcInit)
Initialize BURTC.
__STATIC_INLINE void BURTC_IntClear (uint32_t flags)
Clear one or more pending BURTC interrupts.
__STATIC_INLINE void BURTC_IntDisable (uint32_t flags)
Disable one or more BURTC interrupts.
__STATIC_INLINE void BURTC_IntEnable (uint32_t flags)
Enable one or more BURTC interrupts.
__STATIC_INLINE uint32_t BURTC_IntGet (void)
Get pending BURTC interrupt flags.
__STATIC_INLINE uint32_t BURTC_IntGetEnabled (void)
Get enabled and pending BURTC interrupt flags.
__STATIC_INLINE void BURTC_IntSet (uint32_t flags)
Set one or more pending BURTC interrupts from SW.
__STATIC_INLINE void BURTC_Lock (void)
Lock BURTC registers, will protect from writing new config settings.
void BURTC_Reset (void)
Restore BURTC to reset state.
__STATIC_INLINE void BURTC_Start (void)
Start BURTC counter.
__STATIC_INLINE uint32_t BURTC_Status (void)
Status of BURTC RAM, timestamp and LP Mode.
__STATIC_INLINE void BURTC_Stop (void)
Stop the BURTC counter.
__STATIC_INLINE void BURTC_SyncWait (void)
Wait for the BURTC to complete all synchronization of register changes and commands.
__STATIC_INLINE void BURTC_Unlock (void)
Unlock BURTC registers, enable write access to change configuration.

Macro Definition Documentation

#define BURTC_INIT_DEFAULT
Value:
{ \
true, \
false, \
1, \
0, \
false, \
false, \
}

Default configuration for BURTC init structure

Definition at line 155 of file em_burtc.h .

#define burtcClkDiv_1   1

BURTC clock divisors. These values are valid for the BURTC prescaler. Divide clock by 1.

Definition at line 60 of file em_burtc.h .

#define burtcClkDiv_128   128

Divide clock by 128.

Definition at line 67 of file em_burtc.h .

#define burtcClkDiv_16   16

Divide clock by 16.

Definition at line 64 of file em_burtc.h .

#define burtcClkDiv_2   2

Divide clock by 2.

Definition at line 61 of file em_burtc.h .

#define burtcClkDiv_32   32

Divide clock by 32.

Definition at line 65 of file em_burtc.h .

#define burtcClkDiv_4   4

Divide clock by 4.

Definition at line 62 of file em_burtc.h .

#define burtcClkDiv_64   64

Divide clock by 64.

Definition at line 66 of file em_burtc.h .

#define burtcClkDiv_8   8

Divide clock by 8.

Definition at line 63 of file em_burtc.h .

Function Documentation

uint32_t BURTC_CompareGet ( unsigned int comp )

Get the BURTC compare value.

Parameters
[in] comp Compare the channel index value, must be 0 for Giant/Leopard Gecko.
Returns
The currently configured value for this compare channel.

Definition at line 300 of file em_burtc.c .

void BURTC_CompareSet ( unsigned int comp,
uint32_t value
)

Set BURTC compare channel.

Parameters
[in] comp Compare the channel index, must be 0 for current devices.
[in] value New compare value.

Definition at line 270 of file em_burtc.c .

__STATIC_INLINE uint32_t BURTC_CounterGet ( void )

Get BURTC counter.

Returns
BURTC counter value

Definition at line 372 of file em_burtc.h .

void BURTC_Enable ( bool enable )

Enable or Disable BURTC peripheral.

Parameters
[in] enable true to enable, false to disable.

Definition at line 223 of file em_burtc.c .

References BURTC_Stop() , and BURTC_SyncWait() .

Referenced by BURTC_Init() .

void BURTC_Init ( const BURTC_Init_TypeDef * burtcInit )

Initialize BURTC.

Configures the BURTC peripheral.

Note
Before initialization, BURTC module must first be enabled by clearing the reset bit in the RMU, i.e.,
*   RMU_ResetControl(rmuResetBU, rmuResetModeClear);
* 
Compare channel 0 must be configured outside this function, before initialization if enable is set to true. The counter will always be reset.
Parameters
[in] burtcInit A pointer to the BURTC initialization structure.

Definition at line 128 of file em_burtc.c .

References BURTC_Enable() , BURTC_IntClear() , BURTC_Start() , BURTC_SyncWait() , BURTC_Init_TypeDef::clkDiv , BURTC_Init_TypeDef::compare0Top , BURTC_Init_TypeDef::debugRun , BURTC_Init_TypeDef::em4comp , BURTC_Init_TypeDef::em4overflow , and BURTC_Init_TypeDef::start .

__STATIC_INLINE void BURTC_IntClear ( uint32_t flags )

Clear one or more pending BURTC interrupts.

Parameters
[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_IFS_nnn).

Definition at line 179 of file em_burtc.h .

Referenced by BURTC_Init() .

__STATIC_INLINE void BURTC_IntDisable ( uint32_t flags )

Disable one or more BURTC interrupts.

Parameters
[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 (BURTC_IFS_nnn).

Definition at line 197 of file em_burtc.h .

__STATIC_INLINE void BURTC_IntEnable ( uint32_t flags )

Enable one or more BURTC interrupts.

Note
Depending on use, a pending interrupt may already be set prior to enabling the interrupt. Consider using BURTC_IntClear() prior to enabling if a pending interrupt should be ignored.
Parameters
[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 (BURTC_IFS_nnn).

Definition at line 220 of file em_burtc.h .

__STATIC_INLINE uint32_t BURTC_IntGet ( void )

Get pending BURTC interrupt flags.

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 (BURTC_IFS_nnn).

Definition at line 240 of file em_burtc.h .

__STATIC_INLINE uint32_t BURTC_IntGetEnabled ( void )

Get enabled and pending BURTC interrupt flags.

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 (BURTC_IFS_nnn).

Definition at line 257 of file em_burtc.h .

__STATIC_INLINE void BURTC_IntSet ( uint32_t flags )

Set one or more pending BURTC interrupts from SW.

Parameters
[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 (BURTC_IFS_nnn).

Definition at line 277 of file em_burtc.h .

void BURTC_Reset ( void )

Restore BURTC to reset state.

Note
Before accessing the BURTC, BURSTEN in RMU->CTRL must be cleared. LOCK will not be reset to default value, as this will disable access to core BURTC registers.

Definition at line 336 of file em_burtc.c .

References BURTC_Stop() , BURTC_SyncWait() , BUS_RegBitRead() , and BUS_RegBitWrite() .

__STATIC_INLINE void BURTC_Start ( void )

Start BURTC counter.

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 BURTC_SyncWait() function can be used to wait for the start command to be executed.

Note
This function requires the BURTC to be enabled.

Definition at line 340 of file em_burtc.h .

References BURTC_SyncWait() .

Referenced by BURTC_CounterReset() , and BURTC_Init() .

__STATIC_INLINE uint32_t BURTC_Status ( void )

Status of BURTC RAM, timestamp and LP Mode.

Returns
A mask logially OR-ed status bits

Definition at line 292 of file em_burtc.h .

__STATIC_INLINE void BURTC_Stop ( void )

Stop the BURTC counter.

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 BURTC_SyncWait() function can be used to wait for the stop command to be executed.

Note
This function requires the BURTC to be enabled.

Definition at line 359 of file em_burtc.h .

References BURTC_SyncWait() .

Referenced by BURTC_CounterReset() , BURTC_Enable() , and BURTC_Reset() .