Ultra Low-Power Timer#
Introduction#
Ultra-Low-Power (ULP) timers typically used to operate with extremely low power consumption. These timers are commonly found in battery-powered or energy-efficient devices where minimizing power usage is crucial to extending battery life.
ULP timers typically provide configurable settings, allowing developers to adjust parameters such as clock frequency, timer resolution, and interrupt behavior to meet the specific needs of their applications.
The ULP-Timer module supports 4 different instances ulp_timer_instance_t.
Each of the ULP-timers can be independently programmed to work in periodic or one-shot mode ulp_timer_mode_t.
Each of the ULP-timers can be independently configured as a 32-bit counter or as a microsecond timer ulp_timer_type_t.
Configuration#
By calling the sl_si91x_ulp_timer_init ulp-timer is initialized and its clocks are configured.
By using sl_si91x_ulp_timer_set_configuration ulp-timer parameters including match count, timer type, mode, timer direction can be configured.
For more information on configuring available parameters refer to 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.
These functions will initiate and configure the ULP-timer below, which is the flow for implementation.
Above functions allow for initializing the ULP-TIMER instance and generates interrupt upon expiration.
Other functions are called to change the timer type, direction and to unregister the callback.
Below section shows functions to read timer parameters:
Modules#
Enumerations#
Enumeration to represent ULP-timer instances.
Enumeration to represent ULP-timer modes.
Enumeration to represent ULP-timer types.
Enumeration to represent values of clock sources to select as Timer clock.
Typedefs#
Typedef for the function pointer of the callback function.
Renaming clock type enum.
Renaming clock type enum.
Variables#
true to enable static and false to enable dynamic clock type
true to enable and false to disable ULP timer in synchronous mode to ULPSS pclk
timer input clock source, refer ulp_timer_clk_input_source_t for possible values
true to wait and false to Skip waiting for switching timer clk
timer number, SL_ULP_TIMER_NUMBER for default values
timer mode, SL_ULP_TIMER_MODE for default values
timer type, SL_ULP_TIMER_TYPE for default values
timer match value SL_ULP_TIMER_MATCH_VALUE(delay time) in microseconds
timer direction, SL_ULP_TIMER_DIRECTION for default values
Release version number.
sqa version number
dev version number
Functions#
This API will initialize the ULP-Timer by enabling its clock source.
This API will configures and enables the ULP-Timer input clock source.
This API will configure the ULP-Timer parameters.
This API will start the ULP-Timer.
This API will stop the 'timer_num' instance of timer.
This API will restart an already running ULP-Timer.
This API will set the ULP-Timer type.
This API will set the ULP-Timer direction.
This API will set the ULP-Timer Mode as one-shot or periodic.
This API will sets the ULP-Timer match value.
This API will read the ULP-Timer current count.
This API will read the ULP-Timer type.
This API will reads the ULP-Timer mode.
This API will read the ULP-Timer direction (up-counter or down-counter).
This API will registers the callback for the timer timeout interrupt and enables the interrupt, as per instance.
This API will unregister the callback for the timer interrupt and disabling its interrupts as per timer instance.
This API will configure the ULPSS SOC clock from M4 SOC clock, to enable the SOC clock source.
This API will configure the XTAL clock, when clock source is external XTAL clock.
This API will de-Initializes the ULP-Timer clock by disabling the peripheral clock.
This API will get the ULP-timer API version.
Macros#
default 1-second timer match-value for down-counter timer-type with 20Mhz clock
Enumeration Documentation#
ulp_timer_instance_t#
ulp_timer_instance_t
Enumeration to represent ULP-timer instances.
Enumerator | |
---|---|
ULP_TIMER_0 | ULP Timer0 Instance. |
ULP_TIMER_1 | ULP Timer1 Instance. |
ULP_TIMER_2 | ULP Timer2 Instance. |
ULP_TIMER_3 | ULP Timer3 Instance. |
ULP_TIMER_LAST | Last member of enum for validation. |
67
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.
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 enum for validation. |
76
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.
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 enum for validation. |
83
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.
Enumerator | |
---|---|
ULP_TIMER_REF_CLK_SRC | ref 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_32MHZ_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 enum for validation. |
91
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.
61
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.
63
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.
64
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_ulp_timer.h
Variable Documentation#
ulp_timer_clk_type#
uint8_t ulp_timer_clk_src_config_t::ulp_timer_clk_type
true to enable static and false to enable dynamic clock type
103
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_ulp_timer.h
ulp_timer_sync_to_ulpss_pclk#
boolean_t ulp_timer_clk_src_config_t::ulp_timer_sync_to_ulpss_pclk
true to enable and false to disable ULP timer in synchronous mode to ULPSS pclk
105
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_ulp_timer.h
ulp_timer_clk_input_src#
uint8_t ulp_timer_clk_src_config_t::ulp_timer_clk_input_src
timer input clock source, refer ulp_timer_clk_input_source_t for possible values
107
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_ulp_timer.h
ulp_timer_skip_switch_time#
boolean_t ulp_timer_clk_src_config_t::ulp_timer_skip_switch_time
true to wait and false to Skip waiting for switching timer clk
108
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_ulp_timer.h
timer_num#
uint8_t ulp_timer_config_t::timer_num
timer number, SL_ULP_TIMER_NUMBER for default values
113
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_ulp_timer.h
timer_mode#
uint8_t ulp_timer_config_t::timer_mode
timer mode, SL_ULP_TIMER_MODE for default values
114
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_ulp_timer.h
timer_type#
uint8_t ulp_timer_config_t::timer_type
timer type, SL_ULP_TIMER_TYPE for default values
115
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_ulp_timer.h
timer_match_value#
uint32_t ulp_timer_config_t::timer_match_value
timer match value SL_ULP_TIMER_MATCH_VALUE(delay time) in microseconds
116
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_ulp_timer.h
timer_direction#
uint8_t ulp_timer_config_t::timer_direction
timer direction, SL_ULP_TIMER_DIRECTION for default values
117
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_ulp_timer.h
release#
uint8_t sl_ulp_timer_version_t::release
Release version number.
122
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_ulp_timer.h
major#
uint8_t sl_ulp_timer_version_t::major
sqa version number
123
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_ulp_timer.h
minor#
uint8_t sl_ulp_timer_version_t::minor
dev version number
124
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)
This API will initialize the ULP-Timer by enabling its clock source.
[in] | timer_clk_ptr | Pointer to timer_clk configuration structure |
It configures clock frequency, clock-type, enables/disables synchronization to ULPSS pclk & skips/allows waiting for timer clock switching.
Returns
status 0 if successful, else error code as follows:
SL_STATUS_INVALID_PARAMETER (0x0021) - Timer clock type or timer clock source values are invalid
SL_STATUS_INVALID_CONFIGURATION (0x0023) - Timer clock-source configuration structure members have invalid configurations.
SL_STATUS_NULL_POINTER (0x0022) - The parameter is a null pointer
SL_STATUS_OK (0x0000) - Success, timer clock-source parameters configured properly
141
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)
This API will configures and enables the ULP-Timer input clock source.
[in] | timer_clk_ptr | Pointer to timer_clk configuration structure ulp_timer_clk_src_config_t. |
It configures clock frequency, clock-type, enables/disables synchronization to ULPSS pclk & skips/allows waiting for timer clock switching. It is called inside sl_si91x_ulp_timer_init API.
Note
There are two XTAL Clk sources internal and external In order to enable the external XTAL clk source need to configure the NPSS_GPIO pins through sl_si91x_ulp_timer_configure_xtal_clock API i.e user need to call this API first.
In order to use SOC source user need to use sl_si91x_ulp_timer_configure_soc_clock API to configure the ULPSS SOC instead of clock configure API.
Returns
status 0 if successful, else error code as follows:
SL_STATUS_INVALID_PARAMETER (0x0021) - Timer clock type or timer clock source values are invalid
SL_STATUS_INVALID_CONFIGURATION (0x0023) - Timer clock-source configuration structure members have invalid configurations.
SL_STATUS_NULL_POINTER (0x0022) - The parameter is a null pointer
SL_STATUS_OK (0x0000) - Success, timer clock-source parameters configured properly
164
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)
This API will configure the ULP-Timer parameters.
[in] | timer_config_ptr | Pointer to the timer_configuration structure ulp_timer_config_t. |
It configures the parameters such as timer number, mode, type, match-value, and direction. Also configures the integral and fractional values of clock cycles per microseconds or per 256 microseconds as per the selected timer-type.
Pre-conditions:
Returns
status 0 if successful, else error code as follows:
SL_STATUS_NULL_POINTER (0x0022) - The parameter is a null pointer
SL_STATUS_INVALID_INDEX (0x0027) - Timer configuration structure member 'timer_num' has an invalid value.
SL_STATUS_INVALID_MODE (0x0024) - Timer configuration structure member 'timer_mode' has an invalid value.
SL_STATUS_INVALID_TYPE (0x0026) - Timer configuration structure member 'timer_type' has an invalid value.
SL_STATUS_INVALID_PARAMETER (0x0021) - Timer configuration structure member 'timer_direction' has an invalid value.
SL_STATUS_OK (0x0000) - Success, timer parameters are configured properly
185
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)
This API will start the ULP-Timer.
[in] | timer_num | enum for ULP-timer Number (0 to 3), ulp_timer_instance_t for possible values |
Note
Timer instance must not be in running state when calling this API.
Pre-conditions:
Returns
status 0 if successful, else error code as follows:
SL_STATUS_INVALID_INDEX (0x0027) - 'timer_num' parameter value is invalid.
SL_STATUS_OK (0x0000) - Successfully started the timer instance
200
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)
This API will stop the 'timer_num' instance of timer.
[in] | timer_num | enum for ULP-timer Number (0 to 3), ulp_timer_instance_t for possible values |
Sets the stop bit of timer control register, which is a self clearing bit. This will only stops the timer but not disables it. To disable it use sl_si91x_ulp_timer_deinit.
Returns
status 0 if successful, else error code as follows:
SL_STATUS_INVALID_INDEX (0x0027) - 'timer_num' parameter value is invalid.
SL_STATUS_OK (0x0000) - Successfully stopped the timer instance
217
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)
This API will restart an already running ULP-Timer.
[in] | timer_num | enum for ULP-timer Number, ulp_timer_instance_t for possible values |
ULP-Timer restart which means it will first stop the timer instance and then starts it again. This will just restart the currently running counter.
Returns
status 0 if successful, else error code as follows:
SL_STATUS_INVALID_INDEX (0x0027) - 'timer_num' parameter value is invalid.
SL_STATUS_OK (0x0000) - Successfully restarted the timer instance
234
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)
This API will set the ULP-Timer type.
[in] | timer_num | enum for ULP-timer Number, ulp_timer_instance_t for possible values |
[in] | timer_type | enum for ULP-timer Type, ulp_timer_type_t for possible values |
Timer types include 256 µs, 1 µs, and count-down.
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 timer is stopped.
Pre-conditions:
Returns
status 0 if successful, else error code as follows:
SL_STATUS_INVALID_INDEX (0x0027) - 'timer_num' parameter value is invalid.
SL_STATUS_INVALID_TYPE (0x0026) - 'timer_type' parameter value is invalid.
SL_STATUS_OK (0x0000) - Successfully set timer-type
254
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)
This API will set the ULP-Timer direction.
[in] | timer_num | enum for ULP-timer Number, ulp_timer_instance_t for possible values |
[in] | timer_direction | enum for ULP-timer direction, ulp_timer_direction_t for possible values |
ULP timer set direction will set the ULP-Timer direction as up-counting or down-counting, by default it works as down-counter. Note
This API should be used when timer is stopped.
Pre-conditions:
Returns
status 0 if successful, else error code as follows:
SL_STATUS_INVALID_INDEX (0x0027) - 'timer_num' parameter value is invalid.
SL_STATUS_INVALID_PARAMETER (0x0021) - 'timer_direction' parameter value is invalid.
SL_STATUS_OK (0x0000) - Successfully set timer-direction
272
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)
This API will set the ULP-Timer Mode as one-shot or periodic.
[in] | timer_num | enum for ULP-timer Number, ulp_timer_instance_t for possible values |
[in] | timer_mode | enum for ULP-timer mode, ulp_timer_mode_t for possible values |
In one shot operation, the timer counts till the timeout and then generates a single interrupt after which it returns to idle state. Where as in periodic operation the timer generates interrupts continously with interval equal to timeout. This API should be used when timer is stopped
Pre-conditions:
Returns
status 0 if successful, else error code as follows:
SL_STATUS_INVALID_INDEX (0x0027) - 'timer_num' parameter value is invalid.
SL_STATUS_INVALID_MODE (0x0024) - 'timer_mode' parameter value is invalid.
SL_STATUS_OK (0x0000) - Successfully set timer-mode
290
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)
This API will sets the ULP-Timer match value.
[in] | timer_num | enum for ULP-timer Number, ulp_timer_instance_t for possible values. |
[in] | timer_match_value | for ULP-timer timeout value |
When the timer reaches the match value & 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 microseconds * time in microseconds).
Note
This API should be used when timer is stopped.
Pre-conditions:
Returns
status 0 if successful, else error-code
SL_STATUS_INVALID_INDEX (0x0027) - 'timer_num' parameter value is invalid.
SL_STATUS_OK (0x0000) - Successfully set timer match value.
312
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)
This API will read the ULP-Timer current count.
[in] | timer_num | enum for ULP-timer Number, ulp_timer_instance_t for possible values. |
[in] | count_value | Pointer to variable which will store the current count of the timer |
If counter-down is set then counter register bits indicate time remaining before timeout (read as 32'hFFFF_FFFF initially). If counter-up is set then these bits directly gives out the up-running counter/timer value. Updates the timer current-count value to the count-value variable, passed as reference by user (2nd argument).
Returns
status 0 if successful, else error code as follows:
SL_STATUS_NULL_POINTER (0x0022) - 'Pointer to count_value' parameter is a null pointer.
SL_STATUS_INVALID_INDEX (0x0027) - 'timer_num' parameter value is invalid.
SL_STATUS_OK (0x0000) - Successfully read the timer's current count value
333
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)
This API will read the ULP-Timer type.
[in] | timer_num | enum for ULP-timer Number, ulp_timer_instance_t for possible values. |
[in] | timer_type | Pointer to variable which will store the current type of the timer |
Updates the timer type value to the timer_type variable, passed as reference by user.
'0' for down-counter type
'1' for 1us type
'2' for 256us type
Pre-conditions:
Returns
status 0 if successful, else error code as follows:
SL_STATUS_NULL_POINTER (0x0022) - 'Pointer to timer_type' parameter is a null pointer.
SL_STATUS_INVALID_INDEX (0x0027) - 'timer_num' parameter value is invalid.
SL_STATUS_OK (0x0000) - Successfully read the timer's current type
353
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)
This API will reads the ULP-Timer mode.
[in] | timer_num | enum for ULP-timer Number, ulp_timer_instance_t for possible values. |
[in] | timer_mode | Pointer to variable which will store the current mode of the timer |
Updates the timer mode value to the timer_mode variable, passed as reference by user.
'0' for one-shot mode
'1' for periodic mode
Returns
status 0 if successful, else error code as follows:
SL_STATUS_NULL_POINTER (0x0022) - 'Pointer to timer_mode' parameter is a null pointer.
SL_STATUS_INVALID_INDEX (0x0027) - 'timer_num' parameter value is invalid.
SL_STATUS_OK (0x0000) - Successfully read the timer's current mode
372
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)
This API will read the ULP-Timer direction (up-counter or down-counter).
[in] | timer_num | enum for ULP-timer Number, ulp_timer_instance_t for possible values. |
[in] | timer_direction | Pointer to variable which will store the current direction of the timer |
Updates the timer direction to the timer_direction variable, passed as reference by user.
'0' for down-counting
'1' for up-counting
Pre-conditions:
Returns
status 0 if successful, else error code as follows:
SL_STATUS_NULL_POINTER (0x0022) - 'Pointer to timer_direction' parameter is a null pointer.
SL_STATUS_INVALID_INDEX (0x0027) - 'timer_num' parameter value is invalid.
SL_STATUS_OK (0x0000) - Successfully read the timer's current direction
391
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)
This API will registers the callback for the timer timeout interrupt and enables the interrupt, as per instance.
[in] | timer_num | enum for ULP-timer Number, ulp_timer_instance_t for possible values. |
[in] | on_timeout_callback | (function pointer) Callback function pointer to be called when the timer timeout interrupt occurred. |
If any callback is already registered, the user needs to unregister the callback first before registering the callback else it will return call SL_STATUS_BUSY error.
Returns
status 0 if successful, else error code as follows:
SL_STATUS_NULL_POINTER (0x0022) - 'pointer to callback_data_input' parameter is a null pointer.
SL_STATUS_INVALID_INDEX (0x0027) - 'timer_num' parameter value is invalid.
SL_STATUS_ALLOCATION_FAILED (0x0019) - Timer interrupt enabling failed.
SL_STATUS_BUSY (0x0004) - The callback is already registered, unregister the previous callback before registering a new one.
SL_STATUS_OK (0x0000) - Successfully registered the timer timeout callback
413
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)
This API will unregister the callback for the timer interrupt and disabling its interrupts as per timer instance.
[in] | timer_num | enum for ULP-timer Number, ulp_timer_instance_t for possible values. |
Pre-conditions:
Returns
status 0 if successful, else error code as follows:
SL_STATUS_INVALID_INDEX (0x0027) - 'timer_num' parameter value is invalid.
SL_STATUS_ALLOCATION_FAILED (0x0019) - Timer interrupt disabling failed.
SL_STATUS_OK (0x0000) - Successfully unregistered the timer timeout callback
427
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)
This API will configure the ULPSS SOC clock from M4 SOC clock, to enable the SOC clock source.
[in] | div_factor_type | value to divide the clock, ensure that it should be an odd number if div_factor_type is 1 & vice versa |
[in] | div_factor | selects the type of divider for m4_soc_clk_2ulpss
|
This API is used to select the ULPSS processor clock source as timer input clock source which is greater than 100MHz(used for high-power mode) To divide the clock, ensure that it should be odd number if div_factor_type is 1 & viceversa 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 timer clock config API, when using SOC clock source with timer in high power mode
Returns
status 0 if successful, else error code as follows:
SL_STATUS_INVALID_PARAMETER(0x0021) - 'div_factor' is not according to div_factor_type
448
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)
This API will configure the XTAL clock, when clock source is external XTAL clock.
[in] | xtal_pin | : Pin number of NPSS_GPIO. Possible values are 0 to 4. |
To enable the external XTAL clk source need to call this API before calling sl_si91x_ulp_timer_configure_clock API.
Returns
status 0 if successful, else error code as follows:
SL_STATUS_INVALID_PARAMETER(0x0021) - 'xtal_pin' parameter value is invalid.
459
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 )
This API will de-Initializes the ULP-Timer clock by disabling the peripheral clock.
N/A |
It also Unregisters callback of all timer instances
Returns
none
Note
Unregisters the callbacks of all timer instances
472
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 )
This API will get the ULP-timer API version.
N/A |
This API is used to know the API version of ULP_TIMER.
Returns
sl_ulp_timer_version_t type version
481
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_DEFAULTValue:
20000000
default 1-second timer match-value for down-counter timer-type with 20Mhz clock
52
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_STATICValue:
1
54
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_DYNAMICValue:
0
55
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_ulp_timer.h