Ultra Low-Power Timer#

Introduction#

Ultra-Low-Power (ULP) timers are typically used to operate with extremely low power consumption. These timers are used in battery-powered or energy-efficient devices, where minimizing power usage is essential for extending battery life.

ULP timers offer configurable settings, allowing developers to adjust parameters such as clock frequency, timer resolution, and interrupt behavior to suit the specific needs of their applications.

  • Key features include:

    • The ULP-Timer module supports four different instances ulp_timer_instance_t.

    • Each ULP-timer can be independently programmed to operate in periodic or one-shot mode ulp_timer_mode_t.

    • Each ULP-timer can be independently configured as either a 32-bit counter or a microsecond timer ulp_timer_type_t.

ULP timer block diagramULP timer block diagram

Configuration#

The configurable parameters for the ULP-Timer include:

  1. The ULP-timer is initialized and its clocks are configured using sl_si91x_ulp_timer_init.

  2. Parameters such as match count, timer type, mode, and timer direction can be configured using sl_si91x_ulp_timer_set_configuration.

  • For more information on configuring available parameters, see the respective peripheral example readme document.

Usage#

The common ULP-timer functions can be used after ULP-timer structures are specified, passing an instance of ulp_timer_config_t.

The above functions allow for initializing the ULP-TIMER instance and generating interrupts.

Modules#

ulp_timer_clk_src_config_t

ulp_timer_config_t

sl_ulp_timer_version_t

Enumerations#

enum
ULP_TIMER_0
ULP_TIMER_1
ULP_TIMER_2
ULP_TIMER_3
ULP_TIMER_LAST
}

Enumeration to represent ULP timer instances.

enum
ULP_TIMER_MODE_ONESHOT
ULP_TIMER_MODE_PERIODIC
ULP_TIMER_MODE_LAST
}

Enumeration to represent ULP timer modes.

enum
ULP_TIMER_TYP_DEFAULT
ULP_TIMER_TYP_1US
ULP_TIMER_TYP_256US
ULP_TIMER_TYP_LAST
}

Enumeration to represent ULP timer types.

enum
ULP_TIMER_REF_CLK_SRC
ULP_TIMER_32KHZ_RO_CLK_SRC
ULP_TIMER_32KHZ_RC_CLK_SRC
ULP_TIMER_32KHZ_XTAL_CLK_SRC
ULP_TIMER_MHZ_RC_CLK_SRC
ULP_TIMER_20MHZ_RO_CLK_SRC
ULP_TIMER_ULP_CLK_SRC_LAST
}

Enumeration to represent values of clock sources to select as Timer clock.

Typedefs#

typedef void(*

Typedef for the function pointer of the callback function.

typedef CLK_ENABLE_T

Renaming clock type enum.

typedef ulp_timer_dir_t

Renaming clock type enum.

Functions#

sl_status_t
sl_si91x_ulp_timer_init(ulp_timer_clk_src_config_t *timer_clk_ptr)

To initialize the ULP-Timer by enabling its clock source.

sl_status_t
sl_si91x_ulp_timer_configure_clock(ulp_timer_clk_src_config_t *timer_clk_ptr)

To configure and enable the ULP-Timer input clock source.

sl_status_t
sl_si91x_ulp_timer_set_configuration(ulp_timer_config_t *timer_config_ptr)

To configure the ULP-Timer parameters.

sl_status_t
sl_si91x_ulp_timer_start(ulp_timer_instance_t timer_num)

To start the ULP-Timer.

sl_status_t
sl_si91x_ulp_timer_stop(ulp_timer_instance_t timer_num)

To stop the ULP-Timer instance.

sl_status_t
sl_si91x_ulp_timer_restart(ulp_timer_instance_t timer_num)

To restart the ULP-Timer.

sl_status_t
sl_si91x_ulp_timer_set_type(ulp_timer_instance_t timer_num, ulp_timer_type_t timer_type)

To set the ULP-Timer type.

sl_status_t
sl_si91x_ulp_timer_set_direction(ulp_timer_instance_t timer_num, ulp_timer_direction_t timer_direction)

To set the ULP-Timer direction.

sl_status_t
sl_si91x_ulp_timer_set_mode(ulp_timer_instance_t timer_num, ulp_timer_mode_t timer_mode)

To set the ULP-Timer mode as one-shot or periodic.

sl_status_t
sl_si91x_ulp_timer_set_count(ulp_timer_instance_t timer_num, uint32_t timer_match_value)

To set the ULP-Timer match value.

sl_status_t
sl_si91x_ulp_timer_get_count(ulp_timer_instance_t timer_num, uint32_t *count_value)

To get the ULP-Timer current count.

sl_status_t
sl_si91x_ulp_timer_get_type(ulp_timer_instance_t timer_num, uint32_t *timer_type)

To get the ULP-Timer type.

sl_status_t
sl_si91x_ulp_timer_get_mode(ulp_timer_instance_t timer_num, uint32_t *timer_mode)

To get the ULP-Timer mode.

sl_status_t
sl_si91x_ulp_timer_get_direction(ulp_timer_instance_t timer_num, uint32_t *timer_direction)

To get the ULP-Timer direction (up-counter or down-counter).

sl_status_t
sl_si91x_ulp_timer_register_timeout_callback(ulp_timer_instance_t timer_num, ulp_timer_callback_t on_timeout_callback)

To register the callback for the timer timeout interrupt and enable the interrupt.

sl_status_t
sl_si91x_ulp_timer_unregister_timeout_callback(ulp_timer_instance_t timer_num)

To unregister the callback for the timer interrupt and disable its interrupts.

sl_status_t
sl_si91x_ulp_timer_configure_soc_clock(boolean_t div_factor_type, uint16_t div_factor)

To configure and enable the SOC clock source for the timer.

sl_status_t

To configure the XTAL clock when the clock source is an external XTAL clock.

void

To de-initialize the ULP-Timer clock by disabling the peripheral clock.

To get the ULP-Timer API version.

Macros#

#define

default 1-second timer match-value for down-counter timer-type with 20Mhz clock

#define

Static clock type for the ULP timer.

#define

Dynamic clock type for the ULP timer.

Enumeration Documentation#

ulp_timer_instance_t#

ulp_timer_instance_t

Enumeration to represent ULP timer instances.

This enumeration defines the possible instances of the Ultra Low-Power (ULP) timer.

Enumerator
ULP_TIMER_0

ULP Timer 0 Instance.

ULP_TIMER_1

ULP Timer 1 Instance.

ULP_TIMER_2

ULP Timer 2 Instance.

ULP_TIMER_3

ULP Timer 3 Instance.

ULP_TIMER_LAST

Last member of the enum for validation.


Definition at line 73 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_ulp_timer.h

ulp_timer_mode_t#

ulp_timer_mode_t

Enumeration to represent ULP timer modes.

This enumeration defines the possible modes for the Ultra Low-Power (ULP) timer.

Enumerator
ULP_TIMER_MODE_ONESHOT

ULP Timer one-shot mode.

ULP_TIMER_MODE_PERIODIC

ULP Timer periodic mode.

ULP_TIMER_MODE_LAST

Last member of the enum for validation.


Definition at line 87 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_ulp_timer.h

ulp_timer_type_t#

ulp_timer_type_t

Enumeration to represent ULP timer types.

This enumeration defines the possible types for the Ultra Low-Power (ULP) timer.

Enumerator
ULP_TIMER_TYP_DEFAULT

ULP Timer normal down counter type.

ULP_TIMER_TYP_1US

ULP Timer one microsecond type.

ULP_TIMER_TYP_256US

ULP Timer 256 microsecond type.

ULP_TIMER_TYP_LAST

Last member of the enum for validation.


Definition at line 99 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_ulp_timer.h

ulp_timer_clk_input_source_t#

ulp_timer_clk_input_source_t

Enumeration to represent values of clock sources to select as Timer clock.

This enumeration defines the possible clock sources that can be selected as the timer clock for the Ultra Low-Power (ULP) timer.

Enumerator
ULP_TIMER_REF_CLK_SRC

Reference clock input source.

ULP_TIMER_32KHZ_RO_CLK_SRC

32 kHz RO clock input source

ULP_TIMER_32KHZ_RC_CLK_SRC

32 kHz RC clock input source

ULP_TIMER_32KHZ_XTAL_CLK_SRC

32 kHz XTAL clock input source

ULP_TIMER_MHZ_RC_CLK_SRC

32 MHz RC clock input source

ULP_TIMER_20MHZ_RO_CLK_SRC

20 MHz RO clock input source

ULP_TIMER_ULP_CLK_SRC_LAST

Last member of the enum for validation.


Definition at line 112 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_ulp_timer.h

Typedef Documentation#

ulp_timer_callback_t#

typedef void(* ulp_timer_callback_t) (void) )(void)

Typedef for the function pointer of the callback function.


Definition at line 62 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_ulp_timer.h

ulp_timer_clock_t#

typedef CLK_ENABLE_T ulp_timer_clock_t

Renaming clock type enum.


Definition at line 64 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_ulp_timer.h

ulp_timer_direction_t#

typedef ulp_timer_dir_t ulp_timer_direction_t

Renaming clock type enum.


Definition at line 65 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_ulp_timer.h

Function Documentation#

sl_si91x_ulp_timer_init#

sl_status_t sl_si91x_ulp_timer_init (ulp_timer_clk_src_config_t * timer_clk_ptr)

To initialize the ULP-Timer by enabling its clock source.

Parameters
[in]timer_clk_ptr

Pointer to the timer clock configuration structure.

This API configures the clock frequency, clock type, enables/disables synchronization to ULPSS pclk, and skips/allows waiting for timer clock switching.

Returns

  • sl_status_t Status code indicating the result:

    • SL_STATUS_OK - Success, timer clock-source parameters configured properly.

    • SL_STATUS_INVALID_PARAMETER - Timer clock type or timer clock source values are invalid.

    • SL_STATUS_NULL_POINTER - The parameter is a null pointer

    • SL_STATUS_INVALID_CONFIGURATION - Timer clock-source configuration structure members have invalid configurations.

For more information on status codes, see SL STATUS DOCUMENTATION.


Definition at line 181 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_ulp_timer.h

sl_si91x_ulp_timer_configure_clock#

sl_status_t sl_si91x_ulp_timer_configure_clock (ulp_timer_clk_src_config_t * timer_clk_ptr)

To configure and enable the ULP-Timer input clock source.

Parameters
[in]timer_clk_ptr

Pointer to the timer clock configuration structure ulp_timer_clk_src_config_t.

This API configures the clock frequency, clock type, enables/disables synchronization to ULPSS pclk, and determines whether to skip/allow waiting for timer clock switching. This function is invoked within the sl_si91x_ulp_timer_init API.

Note

Returns

  • sl_status_t Status code indicating the result:

    • SL_STATUS_OK - Success, timer clock-source parameters configured properly.

    • SL_STATUS_INVALID_PARAMETER - Timer clock type or timer clock source values are invalid.

    • SL_STATUS_NULL_POINTER - The parameter is a null pointer.

    • SL_STATUS_INVALID_CONFIGURATION - Timer clock-source configuration structure members have invalid configurations.

For more information on status codes, see SL STATUS DOCUMENTATION.


Definition at line 208 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_ulp_timer.h

sl_si91x_ulp_timer_set_configuration#

sl_status_t sl_si91x_ulp_timer_set_configuration (ulp_timer_config_t * timer_config_ptr)

To configure the ULP-Timer parameters.

Parameters
[in]timer_config_ptr

Pointer to the timer configuration structure ulp_timer_config_t.

This API configures the parameters such as timer number, mode, type, match value, and direction. Additionally, it configures the integral and fractional values of clock cycles per microsecond or per 256 microseconds as per the selected timer type.

Returns

  • sl_status_t Status code indicating the result:

    • SL_STATUS_OK - Success, timer parameters are configured properly.

    • SL_STATUS_INVALID_PARAMETER - Timer configuration structure member 'timer_direction' has an invalid value.

    • SL_STATUS_NULL_POINTER - The parameter is a null pointer.

    • SL_STATUS_INVALID_MODE - Timer configuration structure member 'timer_mode' has an invalid value.

    • SL_STATUS_INVALID_TYPE - Timer configuration structure member 'timer_type' has an invalid value.

    • SL_STATUS_INVALID_INDEX - Timer configuration structure member 'timer_num' has an invalid value.

For more information on status codes, see SL STATUS DOCUMENTATION.


Definition at line 233 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_ulp_timer.h

sl_si91x_ulp_timer_start#

sl_status_t sl_si91x_ulp_timer_start (ulp_timer_instance_t timer_num)

To start the ULP-Timer.

Parameters
[in]timer_num

Enum for ULP-timer number (0 to 3), see ulp_timer_instance_t for possible values.

This API is used to start the Ultra Low-Power (ULP) timer.

Note

  • The timer instance must not be in a running state when calling this API.

Returns

  • sl_status_t Status code indicating the result:

    • SL_STATUS_OK - Successfully started the timer instance.

    • SL_STATUS_INVALID_INDEX - The 'timer_num' parameter value is invalid.

For more information on status codes, see SL STATUS DOCUMENTATION.


Definition at line 256 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_ulp_timer.h

sl_si91x_ulp_timer_stop#

sl_status_t sl_si91x_ulp_timer_stop (ulp_timer_instance_t timer_num)

To stop the ULP-Timer instance.

Parameters
[in]timer_num

Enum for ULP-timer number (0 to 3), see ulp_timer_instance_t for possible values.

This API stops the Ultra Low-Power (ULP) timer instance but does not disable it. To disable the timer, use sl_si91x_ulp_timer_deinit.

Returns

  • sl_status_t Status code indicating the result:

    • SL_STATUS_OK - Successfully stopped the timer instance.

    • SL_STATUS_INVALID_INDEX - The 'timer_num' parameter value is invalid.

For more information on status codes, see SL STATUS DOCUMENTATION.


Definition at line 278 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_ulp_timer.h

sl_si91x_ulp_timer_restart#

sl_status_t sl_si91x_ulp_timer_restart (ulp_timer_instance_t timer_num)

To restart the ULP-Timer.

Parameters
[in]timer_num

Enum for ULP-timer number, see ulp_timer_instance_t for possible values.

This API restarts the Ultra Low-Power (ULP) timer instance. If the timer is running, it stops the timer first and then starts it again. If the timer is stopped, it simply starts the timer.

Returns

  • sl_status_t Status code indicating the result:

    • SL_STATUS_OK - Successfully restarted the timer instance.

    • SL_STATUS_INVALID_INDEX - The 'timer_num' parameter value is invalid.

For more information on status codes, see SL STATUS DOCUMENTATION.


Definition at line 301 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_ulp_timer.h

sl_si91x_ulp_timer_set_type#

sl_status_t sl_si91x_ulp_timer_set_type (ulp_timer_instance_t timer_num, ulp_timer_type_t timer_type)

To set the ULP-Timer type.

Parameters
[in]timer_num

Enum for ULP-timer number, see ulp_timer_instance_t for possible values.

[in]timer_type

Enum for ULP-timer type, see ulp_timer_type_t for possible values.

This API sets the ULP-Timer type, which includes 256 µs, 1 µs, and count-down types.

  • 1 microsecond type: The time unit is 1 µs.

  • 256 microsecond type: The time unit is 256 µs.

  • Count-down timer type: The time unit is one clock cycle period.

Note

  • This API should be used when the timer is stopped.

Returns

  • sl_status_t Status code indicating the result:

    • SL_STATUS_OK - Successfully set the timer type.

    • SL_STATUS_INVALID_TYPE - 'timer_type' parameter value is invalid.

    • SL_STATUS_INVALID_INDEX - 'timer_num' parameter value is invalid.

For more information on status codes, see SL STATUS DOCUMENTATION.


Definition at line 328 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_ulp_timer.h

sl_si91x_ulp_timer_set_direction#

sl_status_t sl_si91x_ulp_timer_set_direction (ulp_timer_instance_t timer_num, ulp_timer_direction_t timer_direction)

To set the ULP-Timer direction.

Parameters
[in]timer_num

Enum for ULP-timer number, see ulp_timer_instance_t for possible values.

[in]timer_direction

Enum for ULP-timer direction, see ulp_timer_direction_t for possible values.

This API sets the Ultra Low-Power (ULP) timer direction as either up-counting or down-counting. By default, it operates as a down-counter.

Note

  • The API should be used when the timer is stopped.

Returns

  • sl_status_t Status code indicating the result:

    • SL_STATUS_OK - Successfully set the timer direction.

    • SL_STATUS_INVALID_PARAMETER - The 'timer_direction' parameter value is invalid.

    • SL_STATUS_INVALID_INDEX - The 'timer_num' parameter value is invalid.

For more information on status codes, see SL STATUS DOCUMENTATION.


Definition at line 353 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_ulp_timer.h

sl_si91x_ulp_timer_set_mode#

sl_status_t sl_si91x_ulp_timer_set_mode (ulp_timer_instance_t timer_num, ulp_timer_mode_t timer_mode)

To set the ULP-Timer mode as one-shot or periodic.

Parameters
[in]timer_num

Enum for ULP-timer number, see ulp_timer_instance_t for possible values.

[in]timer_mode

Enum for ULP-timer mode, see ulp_timer_mode_t for possible values.

In a one-shot operation, the timer counts down to the timeout and then generates a single interrupt after which it returns to the idle state. In contrast, in periodic operation, the timer continuously generates interrupts at intervals equal to the timeout period.

Note

  • This API should be used before starting the timer.

Returns

  • sl_status_t Status code indicating the result:

    • SL_STATUS_OK - Successfully set the timer mode.

    • SL_STATUS_INVALID_MODE - The 'timer_mode' parameter value is invalid.

    • SL_STATUS_INVALID_INDEX - The 'timer_num' parameter value is invalid.

For more information on status codes, see SL STATUS DOCUMENTATION.


Definition at line 379 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_ulp_timer.h

sl_si91x_ulp_timer_set_count#

sl_status_t sl_si91x_ulp_timer_set_count (ulp_timer_instance_t timer_num, uint32_t timer_match_value)

To set the ULP-Timer match value.

Parameters
[in]timer_num

Enum for ULP-timer number, see ulp_timer_instance_t for possible values.

[in]timer_match_value

ULP-timer timeout value.

When the timer reaches the match value and if the interrupt is enabled, it will generate an interrupt to the processor.

  • For one microsecond type, match value = number of microseconds.

  • For 256 microsecond type, match value = (time in microseconds) / 256.

  • For normal up/down counter type, timer = (number of clock cycles per microsecond * time in microseconds).

Note

  • The API should be used when the timer is stopped.

Returns

  • sl_status_t Status code indicating the result:

    • SL_STATUS_OK - Successfully set the timer match value.

    • SL_STATUS_INVALID_INDEX - The 'timer_num' parameter value is invalid.

For more information on status codes, see SL STATUS DOCUMENTATION.


Definition at line 408 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_ulp_timer.h

sl_si91x_ulp_timer_get_count#

sl_status_t sl_si91x_ulp_timer_get_count (ulp_timer_instance_t timer_num, uint32_t * count_value)

To get the ULP-Timer current count.

Parameters
[in]timer_num

Enum for ULP-timer number, see ulp_timer_instance_t for possible values.

[out]count_value

Pointer to the variable which will store the current count of the timer.

If the counter is set to down-counting, the counter register bits indicate the time remaining until the timeout, initially read as 32'hFFFF_FFFF. If the counter is set to up-counting, these bits directly show the up-running counter/timer value. The timer current-count value is updated to the count-value variable provided by the user as the second argument.

Returns

  • sl_status_t Status code indicating the result:

    • SL_STATUS_OK - Successfully read the timer's current count value.

    • SL_STATUS_NULL_POINTER - The pointer to the 'count_value' parameter is a null pointer.

    • SL_STATUS_INVALID_INDEX - The 'timer_num' parameter value is invalid.

For more information on status codes, see SL STATUS DOCUMENTATION.


Definition at line 433 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_ulp_timer.h

sl_si91x_ulp_timer_get_type#

sl_status_t sl_si91x_ulp_timer_get_type (ulp_timer_instance_t timer_num, uint32_t * timer_type)

To get the ULP-Timer type.

Parameters
[in]timer_num

Enum for ULP-timer number, see ulp_timer_instance_t for possible values.

[out]timer_type

Pointer to the variable which will store the current type of the timer.

This API updates the timer type value to the timer_type variable, passed as reference by the user.

  • '0' for down-counter type

  • '1' for 1us type

  • '2' for 256us type

Returns

  • sl_status_t Status code indicating the result:

    • SL_STATUS_OK - Successfully read the timer's current type.

    • SL_STATUS_NULL_POINTER - The pointer to the 'timer_type' parameter is a null pointer.

    • SL_STATUS_INVALID_INDEX - The 'timer_num' parameter value is invalid.

For more information on status codes, see SL STATUS DOCUMENTATION.


Definition at line 459 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_ulp_timer.h

sl_si91x_ulp_timer_get_mode#

sl_status_t sl_si91x_ulp_timer_get_mode (ulp_timer_instance_t timer_num, uint32_t * timer_mode)

To get the ULP-Timer mode.

Parameters
[in]timer_num

Enum for ULP-timer number, see ulp_timer_instance_t for possible values.

[out]timer_mode

Pointer to the variable which will store the current mode of the timer, see ulp_timer_mode_t.

Updates the timer mode value to the timer_mode variable, passed as reference by the user.

  • '0' for one-shot mode

  • '1' for periodic mode

Returns

  • sl_status_t Status code indicating the result:

    • SL_STATUS_OK - Successfully read the timer's current mode.

    • SL_STATUS_NULL_POINTER - The pointer to the 'timer_mode' parameter is a null pointer.

    • SL_STATUS_INVALID_INDEX - The 'timer_num' parameter value is invalid.

For more information on status codes, see SL STATUS DOCUMENTATION.


Definition at line 484 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_ulp_timer.h

sl_si91x_ulp_timer_get_direction#

sl_status_t sl_si91x_ulp_timer_get_direction (ulp_timer_instance_t timer_num, uint32_t * timer_direction)

To get the ULP-Timer direction (up-counter or down-counter).

Parameters
[in]timer_num

Enum for ULP-timer number, see ulp_timer_instance_t for possible values.

[out]timer_direction

Pointer to the variable which will store the current direction of the timer, see ulp_timer_direction_t.

Updates the timer direction to the timer_direction variable, passed as reference by the user.

  • '0' for down-counting

  • '1' for up-counting

Returns

  • sl_status_t Status code indicating the result:

    • SL_STATUS_OK - Successfully read the timer's current direction.

    • SL_STATUS_NULL_POINTER - The pointer to 'timer_direction' parameter is a null pointer.

    • SL_STATUS_INVALID_INDEX - The 'timer_num' parameter value is invalid.

For more information on status codes, see SL STATUS DOCUMENTATION.


Definition at line 509 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_ulp_timer.h

sl_si91x_ulp_timer_register_timeout_callback#

sl_status_t sl_si91x_ulp_timer_register_timeout_callback (ulp_timer_instance_t timer_num, ulp_timer_callback_t on_timeout_callback)

To register the callback for the timer timeout interrupt and enable the interrupt.

Parameters
[in]timer_num

Enum for ULP-timer number, see ulp_timer_instance_t for possible values.

[in]on_timeout_callback

Function pointer to the callback function to be called when the timer timeout interrupt occurs.

This API registers the callback function for the timer timeout interrupt and enables the interrupt for the specified timer instance. If a callback is already registered, the user must first unregister the existing callback before registering a new one. Otherwise, it will return a SL_STATUS_BUSY error.

Returns

  • sl_status_t Status code indicating the result:

    • SL_STATUS_OK - Successfully registered the timer timeout callback.

    • SL_STATUS_BUSY - The callback is already registered, unregister the previous callback before registering a new one.

    • SL_STATUS_ALLOCATION_FAILED - Timer interrupt enabling failed.

    • SL_STATUS_NULL_POINTER - The pointer to 'callback_data_input' parameter is a null pointer.

    • SL_STATUS_INVALID_INDEX - The 'timer_num' parameter value is invalid.

For more information on status codes, see SL STATUS DOCUMENTATION.


Definition at line 531 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_ulp_timer.h

sl_si91x_ulp_timer_unregister_timeout_callback#

sl_status_t sl_si91x_ulp_timer_unregister_timeout_callback (ulp_timer_instance_t timer_num)

To unregister the callback for the timer interrupt and disable its interrupts.

Parameters
[in]timer_num

Enum for ULP-timer number, see ulp_timer_instance_t for possible values.

This API is used to unregister the existing callback interrupt for the specified timer instance.

Returns

  • sl_status_t Status code indicating the result:

    • SL_STATUS_OK - Successfully unregistered the timer timeout callback.

    • SL_STATUS_ALLOCATION_FAILED - Timer interrupt disabling failed.

    • SL_STATUS_INVALID_INDEX - The 'timer_num' parameter value is invalid.

For more information on status codes, see SL STATUS DOCUMENTATION.


Definition at line 552 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_ulp_timer.h

sl_si91x_ulp_timer_configure_soc_clock#

sl_status_t sl_si91x_ulp_timer_configure_soc_clock (boolean_t div_factor_type, uint16_t div_factor)

To configure and enable the SOC clock source for the timer.

Parameters
[in]div_factor_type

Value to divide the clock. Ensure that it should be an odd number if div_factor_type is 1, and vice versa.

[in]div_factor

Selects the type of divider for m4_soc_clk_2ulpss:

  • '0' Even Divider is selected

  • '1' Odd Divider is selected

This API is used to select the ULPSS processor clock source as the timer input clock source, which is greater than 100MHz (used for high-power mode). If div_factor_type value is 1, the div_factor should be an odd number; otherwise, it will throw an error. The div_factor_type selects the type of divider for m4_soc_clk_2ulpss:

  • '0' Even Divider is selected

  • '1' Odd Divider is selected Use this API in place of the timer init API.

Returns

  • sl_status_t Status code indicating the result:

    • SL_STATUS_OK - Success.

    • SL_STATUS_INVALID_PARAMETER - The 'div_factor' is not valid according to div_factor_type.

For more information on status codes, see SL STATUS DOCUMENTATION.


Definition at line 578 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_ulp_timer.h

sl_si91x_ulp_timer_configure_xtal_clock#

sl_status_t sl_si91x_ulp_timer_configure_xtal_clock (uint8_t xtal_pin)

To configure the XTAL clock when the clock source is an external XTAL clock.

Parameters
[in]xtal_pin

Pin number of UULP_GPIO. Possible values are 0 to 4.

This API enables the external XTAL clock source. It needs to be called before calling the sl_si91x_ulp_timer_configure_clock API.

Returns

  • sl_status_t Status code indicating the result:

    • SL_STATUS_OK - Success.

    • SL_STATUS_INVALID_PARAMETER - The 'xtal_pin' parameter value is invalid.

For more information on status codes, see SL STATUS DOCUMENTATION.


Definition at line 595 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_ulp_timer.h

sl_si91x_ulp_timer_deinit#

void sl_si91x_ulp_timer_deinit (void )

To de-initialize the ULP-Timer clock by disabling the peripheral clock.

Parameters
N/A

This API disables the peripheral clock for the ULP-Timer and unregisters the callback for all timer instances.

Note

  • Unregisters the callbacks of all timer instances.


Definition at line 610 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_ulp_timer.h

sl_si91x_ulp_timer_get_version#

sl_ulp_timer_version_t sl_si91x_ulp_timer_get_version (void )

To get the ULP-Timer API version.

Parameters
N/A

This API is used to retrieve the version information of the ULP-Timer API.

Returns


Definition at line 620 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_ulp_timer.h

Macro Definition Documentation#

SL_TIMER_MATCH_VALUE_DEFAULT#

#define SL_TIMER_MATCH_VALUE_DEFAULT
Value:
  20000000

default 1-second timer match-value for down-counter timer-type with 20Mhz clock


Definition at line 53 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_ulp_timer.h

SL_ULP_TIMER_CLK_TYPE_STATIC#

#define SL_ULP_TIMER_CLK_TYPE_STATIC
Value:
1

Static clock type for the ULP timer.


Definition at line 55 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_ulp_timer.h

SL_ULP_TIMER_CLK_TYPE_DYNAMIC#

#define SL_ULP_TIMER_CLK_TYPE_DYNAMIC
Value:
0

Dynamic clock type for the ULP timer.


Definition at line 56 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_ulp_timer.h