Config Timer#
Introduction#
Configurable timers are versatile peripherals that can be used for a variety of tasks, such as:
Modulated signal output
Event capture on GPIOs in input mode
Clock and event counting These timers can operate in Pulse Width Modulation (PWM) mode, driving a PWM wave on the outputs based on programmed ON and OFF periods. Timers are typically built-in peripherals found in microcontrollers and microprocessors. They function independently of the CPU and other peripherals, allowing them to keep track of time and perform timing-related tasks without requiring CPU intervention.
Configuration#
To configure the config-timer, several parameters need to be defined:
Timer mode (32-bit or 16-bit) sl_config_timer_mode_t
Periodic mode (Enable/Disable)
Counter trigger (Enable/Disable)
Soft reset (Enable/Disable)
Buffer enable (Enable/Disable)
Counter direction for counter0 sl_counter0_direction_t
Counter direction for counter1 sl_counter1_direction_t These configurations are set in the sl_config_timer_config_t structure, and the API sl_si91x_config_timer_set_configuration() must be called to apply them. For more detailed information on configuring the available parameters, see the respective peripheral example README document.
Usage#
After defining the Config Timer (CT) structures, the following common Config Timer functions can be called, using an instance of sl_config_timer_config_t structure:
sl_si91x_config_timer_init - Initializes the config timer.
sl_si91x_config_timer_set_configuration - Sets the configuration for the config timer.
sl_si91x_config_timer_set_initial_count (Optional) - Sets the initial count value.
sl_si91x_config_timer_set_match_count - Sets the match count value.
sl_si91x_config_timer_register_callback - Registers a callback for timer events.
sl_si91x_config_timer_start_on_software_trigger - Starts the timer with a software trigger.
sl_si91x_config_timer_deinit - De-initializes the config timer. These functions will initiate and configure the Config Timer according to the specified parameters, following the implementation pipeline.
Modules#
sl_config_timer_interrupt_flags_t
Enumerations#
Enumeration to represent timer modes.
Enumeration to represent timer counter numbers.
Enumeration to represent timer counter 0 directions.
Enumeration to represent timer counter 1 directions.
Enumeration to represent timer configuration parameter values.
Enumeration to represent timer OCU configuration parameter values.
Enumeration to represent various timer input events.
Enumeration to represent various timer actions.
Enumeration to represent various timer interrupt flag values.
Typedefs#
Renaming OCU (Output Compare Unit) parameters structure type.
Renaming WFG (Waveform Generator) parameters structure type.
Renaming MCPWM callback structure.
Typedef for the function pointer of the interrupt callback function.
Functions#
To initialize the config-timer peripheral.
To set the config-timer mode as 32 or 16-bit counters.
To configure Config-timer parameters.
To reset config-timer parameters and set default values.
To set Config-timer OCU (Output Compare Unit) configurations.
To reset config-timer OCU (Output Compare Unit) parameters.
To set Config-timer OCU mode control parameters.
To set Config-timer WFG (Waveform Generator) mode configurations.
To set the Config-timer initial count based on the timer mode.
To set the Config-timer match-count based on the timer mode and counter number.
To calculate and return the match value of the timer for the desired time period.
To get the Config-timer current count.
To reset the Config-timer counter register value.
To start the selected config-timer counter on a software trigger.
To select config timer input events for triggering selected timer actions.
To configure the config timer action events.
To register a callback for config timer interrupts.
To unregister the timer interrupt callback.
Configures the timer to resume or halt on a specific event.
To get the Config-timer count value when a capture event occurs.
To synchronize counter output with other channels.
To configure config timer output events for ADC trigger.
To de-initialize the config-timer by disabling its clock.
To get the config timer API version.
Enumeration Documentation#
sl_config_timer_mode_t#
sl_config_timer_mode_t
Enumeration to represent timer modes.
Enumerator | |
---|---|
SL_COUNTER_16BIT | 16-bit counter mode. |
SL_COUNTER_32BIT | 32-bit counter mode. |
SL_COUNTER_MODE_LAST | Last member of the enumeration for validation. |
70
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_config_timer.h
sl_counter_number_t#
sl_counter_number_t
Enumeration to represent timer counter numbers.
Enumerator | |
---|---|
SL_COUNTER_0 | Enum for CT counter-0. |
SL_COUNTER_1 | Enum for CT counter-1. |
SL_COUNTER_NUMBER_LAST | Last member of the enumeration for validation. |
79
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_config_timer.h
sl_counter0_direction_t#
sl_counter0_direction_t
Enumeration to represent timer counter 0 directions.
Enumerator | |
---|---|
SL_COUNTER0_UP | CT counter-0 up-counting operation. |
SL_COUNTER0_DOWN | CT counter-0 down-counting operation. |
SL_COUNTER0_UP_DOWN | CT counter-0 up-down counting operation. |
SL_COUNTER0_DIRECTION_LAST | Last member of the enumeration for validation. |
88
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_config_timer.h
sl_counter1_direction_t#
sl_counter1_direction_t
Enumeration to represent timer counter 1 directions.
Enumerator | |
---|---|
SL_COUNTER1_UP | CT counter-1 up-counting operation. |
SL_COUNTER1_DOWN | CT counter-1 down-counting operation. |
SL_COUNTER1_UP_DOWN | CT counter-1 up-down counting operation. |
SL_COUNTER1_DIRECTION_LAST | Last member of the enumeration for validation. |
98
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_config_timer.h
sl_config_timer_config_values_t#
sl_config_timer_config_values_t
Enumeration to represent timer configuration parameter values.
Enumerator | |
---|---|
SL_COUNTER_MODE_32 | 32-bit mode value for the counter. |
SL_COUNTER0_SOFT_RESET_ENABLE | Soft reset enable value for counter-0. |
SL_COUNTER0_PERIODIC_ENABLE | Periodic mode enable value for counter-0. |
SL_COUNTER0_TRIGGER_ENABLE | Software trigger enable value for counter-0. |
SL_COUNTER0_SYNC_TRIGGER_ENABLE | Sync trigger enable value for counter-0. |
SL_COUNTER0_BUFFER_ENABLE | Buffer enable value for counter-0. |
SL_COUNTER0_UP_DIRECTION | Up-direction enable value for counter-0. |
SL_COUNTER0_DOWN_DIRECTION | Down-direction enable value for counter-0. |
SL_COUNTER0_UP_DOWN_DIRECTION | Up-down direction enable value for counter-0. |
SL_COUNTER1_SOFT_RESET_ENABLE | Soft reset enable value for counter-1. |
SL_COUNTER1_PERIODIC_ENABLE | Periodic mode enable value for counter-1. |
SL_COUNTER1_TRIGGER_ENABLE | Software trigger enable value for counter-1. |
SL_COUNTER1_SYNC_TRIGGER_ENABLE | Sync trigger enable value for counter-1. |
SL_COUNTER1_BUFFER_ENABLE | Buffer enable value for counter-1. |
SL_COUNTER1_UP_DIRECTION | Up-direction enable value for counter-1. |
SL_COUNTER1_DOWN_DIRECTION | Down-direction enable value for counter-1. |
SL_COUNTER1_UP_DOWN_DIRECTION | Up-down direction enable value for counter-1. |
SL_COUNTER_PARAM_LAST | Last member of the enumeration for validation. |
108
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_config_timer.h
sl_config_timer_ocu_config_values_t#
sl_config_timer_ocu_config_values_t
Enumeration to represent timer OCU configuration parameter values.
Enumerator | |
---|---|
SL_COUNTER0_OCU_OUTPUT_ENABLE | Counter-0 output enable value. |
SL_COUNTER0_OCU_DMA_ENABLE | Counter-0 OCU-DMA mode enable value. |
SL_COUNTER0_OCU_8BIT_ENABLE | Counter-0 OCU 8-bit mode enable value. |
SL_COUNTER0_OCU_SYNC_ENABLE | Counter-0 OCU sync mode enable value. |
SL_COUNTER1_OCU_OUTPUT_ENABLE | Counter-1 output enable value. |
SL_COUNTER1_OCU_DMA_ENABLE | Counter-1 OCU-DMA mode enable value. |
SL_COUNTER1_OCU_8BIT_ENABLE | Counter-1 OCU 8-bit mode enable value. |
SL_COUNTER1_OCU_SYNC_ENABLE | Counter-1 OCU sync mode enable value. |
SL_OCU_OUTPUT0_TOGGLE_HIGH | Counter-0 output toggle high select value. |
SL_OCU_OUTPUT0_TOGGLE_LOW | Counter-0 output toggle low select value. |
SL_OCU_OUTPUT1_TOGGLE_HIGH | Counter-1 output toggle high select value. |
SL_OCU_OUTPUT1_TOGGLE_LOW | Counter-1 output toggle low select value. |
SL_OCU_PARAM_LAST | Last member of the enumeration for validation. |
132
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_config_timer.h
sl_config_timer_event_t#
sl_config_timer_event_t
Enumeration to represent various timer input events.
Enumerator | |
---|---|
SL_NO_EVENT | No input event. |
SL_EVENT0_RISING_EDGE | Input-0 rising edge event. |
SL_EVENT1_RISING_EDGE | Input-1 rising edge event. |
SL_EVENT2_RISING_EDGE | Input-2 rising edge event. |
SL_EVENT3_RISING_EDGE | Input-3 rising edge event. |
SL_EVENT0_FALLING_EDGE | Input-0 falling edge event. |
SL_EVENT1_FALLING_EDGE | Input-1 falling edge event. |
SL_EVENT2_FALLING_EDGE | Input-2 falling edge event. |
SL_EVENT3_FALLING_EDGE | Input-3 falling edge event. |
SL_EVENT0_RISING_FALLING_EDGE | Input-0 rising-falling edge event. |
SL_EVENT1_RISING_FALLING_EDGE | Input-1 rising-falling edge event. |
SL_EVENT2_RISING_FALLING_EDGE | Input-2 rising-falling edge event. |
SL_EVENT3_RISING_FALLING_EDGE | Input-3 rising-falling edge event. |
SL_EVENT0_LEVEL0 | Input-0 Level-0 event. |
SL_EVENT1_LEVEL0 | Input-1 Level-0 event. |
SL_EVENT2_LEVEL0 | Input-2 Level-0 event. |
SL_EVENT3_LEVEL0 | Input-3 Level-0 event. |
SL_EVENT0_LEVEL1 | Input-0 Level-1 event. |
SL_EVENT1_LEVEL1 | Input-1 Level-1 event. |
SL_EVENT2_LEVEL1 | Input-2 Level-1 event. |
SL_EVENT3_LEVEL1 | Input-3 Level-1 event. |
SL_AND_EVENT | AND event. |
SL_OR_EVENT | OR event. |
SL_EVENT0_RISING_EDGE_AND_EVENT | Input-0 rising edge AND event. |
SL_EVENT0_RISING_EDGE_OR_EVENT | Input-0 rising edge OR event. |
SL_EVENT1_RISING_EDGE_AND_EVENT | Input-1 rising edge AND event. |
SL_EVENT1_RISING_EDGE_OR_EVENT | Input-1 rising edge OR event. |
SL_EVENT2_RISING_EDGE_AND_EVENT | Input-2 rising edge AND event. |
SL_EVENT2_RISING_EDGE_OR_EVENT | Input-2 rising edge OR event. |
SL_EVENT3_RISING_EDGE_AND_EVENT | Input-3 rising edge AND event. |
SL_EVENT3_RISING_EDGE_OR_EVENT | Input-3 rising edge OR event. |
SL_EVENT0_RISING_EDGE_REGISTERED_AND_EVENT | Input-0 rising edge registered AND event. |
SL_EVENT0_RISING_EDGE_REGISTERED_OR_EVENT | Input-0 rising edge registered OR event. |
SL_EVENT1_RISING_EDGE_REGISTERED_AND_EVENT | Input-1 rising edge registered AND event. |
SL_EVENT1_RISING_EDGE_REGISTERED_OR_EVENT | Input-1 rising edge registered OR event. |
SL_EVENT2_RISING_EDGE_REGISTERED_AND_EVENT | Input-2 rising edge registered AND event. |
SL_EVENT2_RISING_EDGE_REGISTERED_OR_EVENT | Input-2 rising edge registered OR event. |
SL_EVENT3_RISING_EDGE_REGISTERED_AND_EVENT | Input-3 rising edge registered AND event. |
SL_EVENT3_RISING_EDGE_REGISTERED_OR_EVENT | Input-3 rising edge registered OR event. |
SL_CT_EVENT_LAST | Last member of the enumeration for validation. |
151
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_config_timer.h
sl_config_timer_action_t#
sl_config_timer_action_t
Enumeration to represent various timer actions.
Enumerator | |
---|---|
START | Enum for timer-start action. |
STOP | Enum for timer-stop action. |
CONTINUE | Enum for timer-continue action. |
HALT | Enum for timer-halt action. |
INCREMENT | Enum for timer-increment action. |
CAPTURE | Enum for timer-capture action. |
INTERRUPT | Enum for timer-interrupt action. |
OUTPUT | Enum for timer-output action. |
ACTION_LAST | Last member of the enumeration for validation. |
197
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_config_timer.h
sl_config_timer_interrupt_flags_values_t#
sl_config_timer_interrupt_flags_values_t
Enumeration to represent various timer interrupt flag values.
Enumerator | |
---|---|
SL_CT_EVENT_INTR_0_FLAG | Enum for counter-0 event interrupt enable value. |
SL_CT_FIFO_0_FULL_FLAG | Enum for counter-0 FIFO full interrupt enable value. |
SL_CT_COUNTER_0_IS_ZERO_FLAG | Enum for counter-0 zero-count-value interrupt enable value. |
SL_CT_COUNTER_0_IS_PEAK_FLAG | Enum for counter-0 match-value interrupt enable value. |
SL_CT_EVENT_INTR_1_FLAG | Enum for counter-1 event interrupt enable value. |
SL_CT_FIFO_1_FULL_FLAG | Enum for counter-1 FIFO full interrupt enable value. |
SL_CT_COUNTER_1_IS_ZERO_FLAG | Enum for counter-1 zero-count-value interrupt enable value. |
SL_CT_COUNTER_1_IS_PEAK_FLAG | Enum for counter-1 match-value interrupt enable value. |
212
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_config_timer.h
Typedef Documentation#
sl_config_timer_ocu_params_t#
typedef OCU_PARAMS_T sl_config_timer_ocu_params_t
Renaming OCU (Output Compare Unit) parameters structure type.
56
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_config_timer.h
sl_config_timer_wfg_config_t#
typedef WFG_PARAMS_T sl_config_timer_wfg_config_t
Renaming WFG (Waveform Generator) parameters structure type.
57
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_config_timer.h
sl_config_timer_pwm_callback_t#
typedef RSI_CT_CALLBACK_T sl_config_timer_pwm_callback_t
Renaming MCPWM callback structure.
58
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_config_timer.h
sl_config_timer_callback_t#
typedef void(* sl_config_timer_callback_t) (void *callback_flag) )(void *callback_flag)
Typedef for the function pointer of the interrupt callback function.
N/A | callback_flag | (void *) parameter for updating flag values |
65
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_config_timer.h
Function Documentation#
sl_si91x_config_timer_init#
void sl_si91x_config_timer_init (void )
To initialize the config-timer peripheral.
N/A |
Configures its output GPIO pins and clock to 16 MHz.
332
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_config_timer.h
sl_si91x_config_timer_set_mode#
sl_status_t sl_si91x_config_timer_set_mode (sl_config_timer_mode_t mode)
To set the config-timer mode as 32 or 16-bit counters.
[in] | mode | sl_config_timer_mode_t for possible values. |
In 32-bit mode, Counter_1 and Counter_0 are merged and used as a single 32-bit counter. In this mode, Counter_0 modes/triggers/enables are used.
Pre-conditions:
Returns
Status code indicating the result:
SL_STATUS_OK - Success, timer mode is set properly.
SL_STATUS_INVALID_MODE - 'mode' parameter value is invalid.
For more information on status codes, see SL STATUS DOCUMENTATION.
353
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_config_timer.h
sl_si91x_config_timer_set_configuration#
sl_status_t sl_si91x_config_timer_set_configuration (sl_config_timer_config_t * timer_config_ptr)
To configure Config-timer parameters.
[in] | timer_config_ptr | Pointer to CT config structure sl_config_timer_config_t |
This API sets the Config-timer parameters such as 32-bit or 16-bit mode, periodic mode, counter trigger enable, soft reset enable, buffer enable, sync trigger enable, and sets direction for counter0 and counter1. Counter trigger enable starts the counter. Sync trigger enables the counter to run/activate when sync is found. Buffer enable copies buffer data to the Counter Match register. Soft reset is valid only when the counter is in two 16-bit counters mode, and resets the counter on the write.
Pre-conditions:
Returns
Status code indicating the result:
SL_STATUS_OK - Success, timer configurations are set properly.
SL_STATUS_INVALID_PARAMETER - Counter direction parameter has an invalid value.
SL_STATUS_NULL_POINTER - The parameter is a null pointer.
For more information on status codes, see SL STATUS DOCUMENTATION.
381
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_config_timer.h
sl_si91x_config_timer_reset_configuration#
void sl_si91x_config_timer_reset_configuration (void )
To reset config-timer parameters and set default values.
N/A |
This API sets the config-timer to 16-bit mode, up-counter direction, and disables periodic mode, soft reset, buffer, sync, and software trigger of counters.
390
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_config_timer.h
sl_si91x_config_timer_set_ocu_configuration#
sl_status_t sl_si91x_config_timer_set_ocu_configuration (sl_config_timer_ocu_config_t * ocu_config_ptr)
To set Config-timer OCU (Output Compare Unit) configurations.
[in] | ocu_config_ptr | Pointer to CT OCU-config structure sl_config_timer_ocu_config_t |
This API enables outputs in OCU mode, OCU-DMA mode, channel sync with OCU outputs, and 8-bit mode for OCU outputs for both counters.
Returns
Status code indicating the result:
SL_STATUS_OK - Success, OCU configurations are set properly.
SL_STATUS_NULL_POINTER - The parameter is a null pointer.
For more information on status codes, see SL STATUS DOCUMENTATION.
412
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_config_timer.h
sl_si91x_config_timer_reset_ocu_configuration#
void sl_si91x_config_timer_reset_ocu_configuration (void )
To reset config-timer OCU (Output Compare Unit) parameters.
N/A |
This API sets the config-timer to 16-bit mode, sets the up-counter direction, and disables DMA mode, channel sync, and 8-bit mode for OCU outputs.
421
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_config_timer.h
sl_si91x_config_timer_set_ocu_control#
sl_status_t sl_si91x_config_timer_set_ocu_control (sl_config_timer_ocu_control_t * ocu_params)
To set Config-timer OCU mode control parameters.
[in] | ocu_params | Pointer to CT OCU-config structure sl_config_timer_ocu_control_t |
This API sets Config-timer OCU mode control parameters such as first and next threshold values for counter outputs. It also enables the DMA support for counters.
Returns
Status code indicating the result:
SL_STATUS_OK - Success, OCU mode control parameters are set properly.
SL_STATUS_NULL_POINTER - The parameter is a null pointer.
For more information on status codes, see SL STATUS DOCUMENTATION.
443
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_config_timer.h
sl_si91x_config_timer_set_wfg_configuration#
sl_status_t sl_si91x_config_timer_set_wfg_configuration (sl_config_timer_wfg_config_t * wfg_config_ptr)
To set Config-timer WFG (Waveform Generator) mode configurations.
[in] | wfg_config_ptr | Pointer to CT WFG-config structure sl_config_timer_wfg_config_t |
This API configures the Config-timer WFG mode settings such as selecting toggle high, low, and peak for counter-0 and counter-1 outputs.
Pre-conditions:
Returns
Status code indicating the result:
SL_STATUS_OK - Success, WFG mode configurations are set properly.
SL_STATUS_NULL_POINTER - The parameter is a null pointer.
For more information on status codes, see SL STATUS DOCUMENTATION.
464
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_config_timer.h
sl_si91x_config_timer_set_initial_count#
sl_status_t sl_si91x_config_timer_set_initial_count (sl_config_timer_mode_t mode, uint32_t counter0_initial_value, uint32_t counter1_initial_value)
To set the Config-timer initial count based on the timer mode.
[in] | mode | sl_config_timer_mode_t for possible values |
[in] | counter0_initial_value | (uint32_t) |
[in] | counter1_initial_value | (uint32_t) |
Configurable timer modes are mentioned below:
For 32-bit mode, counter0_initial_value is passed to the CT count register. For 32-bit mode, pass counter1_initial_value as zero.
For 16-bit mode counters, the ORed value of both initial values is passed to the register.
Returns
Status code indicating the result:
SL_STATUS_OK - Success, initial count is set properly.
SL_STATUS_INVALID_MODE - 'mode' parameter value is invalid.
For more information on status codes, see SL STATUS DOCUMENTATION.
490
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_config_timer.h
sl_si91x_config_timer_set_match_count#
sl_status_t sl_si91x_config_timer_set_match_count (sl_config_timer_mode_t mode, sl_counter_number_t counter_number, uint32_t match_value)
To set the Config-timer match-count based on the timer mode and counter number.
[in] | mode | sl_counter_number_t for possible values |
[in] | counter_number | sl_config_timer_mode_t for possible values |
[in] | match_value | (uint32_t) |
If the mode is 32-bit, use counter0. If the mode is 16-bit, as per the passed counter number, it updates the match value. For 16-bit mode, it takes a 16-bit match-value only, else throws an error.
Returns
Status code indicating the result:
SL_STATUS_OK - Success, match-value is set properly.
SL_STATUS_INVALID_PARAMETER - 'counter_number' parameter value is invalid.
SL_STATUS_INVALID_MODE - 'mode' parameter value is invalid.
For more information on status codes, see SL STATUS DOCUMENTATION.
518
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_config_timer.h
sl_si91x_config_timer_get_match_value#
sl_status_t sl_si91x_config_timer_get_match_value (uint32_t time_period_in_us, uint32_t * match_value)
To calculate and return the match value of the timer for the desired time period.
[in] | time_period_in_us | Time period in microseconds. |
[out] | match_value | Gets the match value of the timer for the desired time period. |
This API calculates the match value based on the provided time period in microseconds.
Returns
Status code indicating the result:
SL_STATUS_OK - Success.
SL_STATUS_INVALID_COUNT - Count is invalid.
For more information on status codes, see SL STATUS DOCUMENTATION.
538
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_config_timer.h
sl_si91x_config_timer_get_count#
sl_status_t sl_si91x_config_timer_get_count (sl_config_timer_mode_t mode, sl_counter_number_t counter_number, uint32_t * count_value)
To get the Config-timer current count.
[in] | mode | sl_counter_number_t for possible values |
[in] | counter_number | sl_config_timer_mode_t for possible values |
[out] | count_value | Pointer to the variable to store the count value |
This API retrieves the Config-timer current count based on the timer mode and counter number, and updates the count value to the count_value variable input parameter.
Returns
Status code indicating the result:
SL_STATUS_OK - Success, count value is read properly.
SL_STATUS_INVALID_PARAMETER - 'counter_number' parameter value is invalid.
SL_STATUS_NULL_POINTER - The parameter 'count_value' is a null pointer.
SL_STATUS_INVALID_MODE - 'mode' parameter value is invalid.
For more information on status codes, see SL STATUS DOCUMENTATION.
564
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_config_timer.h
sl_si91x_config_timer_reset_counter#
sl_status_t sl_si91x_config_timer_reset_counter (sl_counter_number_t counter_number)
To reset the Config-timer counter register value.
[in] | counter_number | sl_counter_number_t for possible values |
This API resets the count values of the selected counter.
Returns
Status code indicating the result:
SL_STATUS_OK - Success, counter resets properly.
SL_STATUS_INVALID_PARAMETER - 'counter_number' parameter value is invalid.
For more information on status codes, see SL STATUS DOCUMENTATION.
587
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_config_timer.h
sl_si91x_config_timer_start_on_software_trigger#
sl_status_t sl_si91x_config_timer_start_on_software_trigger (sl_counter_number_t counter_number)
To start the selected config-timer counter on a software trigger.
[in] | counter_number | sl_counter_number_t for possible values |
Note
This API triggers the 'counter_number' counter.
Pre-conditions:
sl_si91x_config_timer_set_configuration(), keep software trigger disabled here
Returns
Status code indicating the result:
SL_STATUS_OK - Success, timer started properly.
SL_STATUS_INVALID_PARAMETER - 'counter_number' parameter value is invalid.
For more information on status codes, see SL STATUS DOCUMENTATION.
608
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_config_timer.h
sl_si91x_config_timer_select_action_event#
sl_status_t sl_si91x_config_timer_select_action_event (sl_config_timer_action_t action, sl_config_timer_event_t select_event_counter0, sl_config_timer_event_t select_event_counter1)
To select config timer input events for triggering selected timer actions.
[in] | action | sl_config_timer_action_t for possible values |
[in] | select_event_counter0 | sl_config_timer_event_t for possible values, (selects input event for triggering counter-0 action) |
[in] | select_event_counter1 | sl_config_timer_event_t for possible values, (selects input event for triggering counter-1 action) |
This API selects config timer input events for triggering selected timer actions. Different timer actions include start, stop, continue, halt, increment, capture, interrupt, and output.
Pre-conditions:
sl_si91x_config_timer_set_configuration(), keep software trigger disabled here
sl_si91x_config_timer_register_callback(), keep event interrupt flag enabled for respective counter
Returns
Status code indicating the result:
SL_STATUS_OK - Success, input event is set properly.
SL_STATUS_INVALID_PARAMETER - Selected input event or action parameter value is invalid.
For more information on status codes, see SL STATUS DOCUMENTATION.
637
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_config_timer.h
sl_si91x_config_timer_configure_action_event#
sl_status_t sl_si91x_config_timer_configure_action_event (sl_config_action_event_t * event_config_handle)
To configure the config timer action events.
[in] | event_config_handle | Pointer to CT configure action events structure sl_config_action_event_t |
This API configures the config timer input-event's AND-event and OR-event for triggering selected timer actions. Different timer actions include start, stop, continue, halt, increment, capture, interrupt, and output.
Pre-conditions:
sl_si91x_config_timer_set_configuration(), keep software trigger disabled here
sl_si91x_config_timer_register_callback(), keep event interrupt flag enabled for respective counter
sl_si91x_config_timer_select_action_event(), first selects the input event for respective action for respective counter
Returns
Status code indicating the result:
SL_STATUS_OK - Success, AND event & OR event set properly.
SL_STATUS_INVALID_PARAMETER - and-event or or-event or event-valid-bits value is invalid.
SL_STATUS_NULL_POINTER - The parameter is a null pointer.
For more information on status codes, see SL STATUS DOCUMENTATION.
668
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_config_timer.h
sl_si91x_config_timer_register_callback#
sl_status_t sl_si91x_config_timer_register_callback (sl_config_timer_callback_t on_config_timer_callback, void * callback_flag, sl_config_timer_interrupt_flags_t * interrupt_flags)
To register a callback for config timer interrupts.
[in] | on_config_timer_callback | (function pointer) Callback function pointer to be called when a timer interrupt occurs sl_config_timer_callback_t |
[in] | callback_flag | (void *) Pointer to the interrupt flag value variable sl_config_timer_callback_t |
[in] | interrupt_flags | Pointer to the interrupt flags structure sl_config_timer_interrupt_flags_t |
This API registers a callback function for config timer interrupts by enabling the respective interrupts as per the selected interrupt flag.
Pre-conditions:
sl_si91x_config_timer_set_configuration(), keep software trigger disabled here
sl_si91x_config_timer_unregister_timeout_callback(), if already registered for any interrupt
Returns
Status code indicating the result:
SL_STATUS_OK - Successfully registered timer timeout callback.
SL_STATUS_BUSY - The callback is already registered, unregister the previous callback before registering a new one.
SL_STATUS_NULL_POINTER - Parameter is a null pointer.
For more information on status codes, see SL STATUS DOCUMENTATION.
696
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_config_timer.h
sl_si91x_config_timer_unregister_callback#
sl_status_t sl_si91x_config_timer_unregister_callback (sl_config_timer_interrupt_flags_t * interrupt_flags)
To unregister the timer interrupt callback.
[in] | interrupt_flags | Pointer to the interrupt flags structure sl_config_timer_interrupt_flags_t |
This API disables interrupts as per the selected interrupt flag and unregisters the previously registered timer interrupt callback.
Pre-conditions:
sl_si91x_config_timer_register_callback(), first register a particular interrupt flag.
Returns
Status code indicating the result:
SL_STATUS_OK - Successfully unregistered timer interrupt callback.
SL_STATUS_NULL_POINTER - Parameter is a null pointer.
For more information on status codes, see SL STATUS DOCUMENTATION.
719
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_config_timer.h
sl_si91x_config_timer_resume_halt_event#
sl_status_t sl_si91x_config_timer_resume_halt_event (sl_counter_number_t counter_number)
Configures the timer to resume or halt on a specific event.
[in] | counter_number | The counter number that triggers the timer to resume or halt. |
This API configures the timer to either resume or halt based on a specified event.
Returns
sl_status_t Status code indicating the result:
SL_STATUS_OK (0x0000) - Success.
SL_STATUS_FAIL (0x0001) - Function failed.
SL_STATUS_INVALID_PARAMETER (0x0021) - Invalid parameter is passed.
SL_STATUS_NULL_POINTER (0x0022) - Null pointer is passed.
For more information on status codes, see SL STATUS DOCUMENTATION.
738
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_config_timer.h
sl_si91x_config_timer_read_capture#
sl_status_t sl_si91x_config_timer_read_capture (sl_counter_number_t counter_number, uint16_t * capture_value)
To get the Config-timer count value when a capture event occurs.
[in] | counter_number | sl_counter_number_t for possible values |
[out] | capture_value | Pointer to the variable to store the count value at capture event (uint16_t*). |
This API updates the capture count value of the timer to the capture_value variable input parameter.
Pre-conditions:
sl_si91x_config_timer_select_action_event(), first select events for capture action
Returns
Status code indicating the result:
SL_STATUS_OK - Success, capture count value is read properly.
SL_STATUS_INVALID_PARAMETER - 'counter_number' parameter value is invalid.
SL_STATUS_NULL_POINTER - The parameter 'capture_value' is a null pointer.
For more information on status codes, see SL STATUS DOCUMENTATION.
762
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_config_timer.h
sl_si91x_config_timer_set_counter_sync#
sl_status_t sl_si91x_config_timer_set_counter_sync (sl_counter_number_t counter_number, uint8_t sync_counter_value)
To synchronize counter output with other channels.
[in] | counter_number | sl_counter_number_t for possible values |
[in] | sync_counter_value | The value to synchronize the counter output (uint8_t). |
This API synchronizes the counter output with other channels as per the sync_counter_value.
Returns
Status code indicating the result:
SL_STATUS_OK - Success, counter output synced properly.
SL_STATUS_INVALID_PARAMETER - 'counter_number' parameter value is invalid.
For more information on status codes, see SL STATUS DOCUMENTATION.
784
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_config_timer.h
sl_si91x_config_timer_set_output_adc_pin#
sl_status_t sl_si91x_config_timer_set_output_adc_pin (uint8_t pin1, uint8_t pin2)
To configure config timer output events for ADC trigger.
[in] | pin1 | Counter0 output event for ADC trigger (0 to 31) sl_config_timer_event_t |
[in] | pin2 | Counter1 output event for ADC trigger (0 to 31) sl_config_timer_event_t |
Configures events for counter0 and counter1 outputs to trigger ADC.
Returns
Status code indicating the result:
SL_STATUS_OK - Success, ADC trigger events set properly.
SL_STATUS_INVALID_PARAMETER - 'pin1' or 'pin2' parameter value is invalid.
For more information on status codes, see SL STATUS DOCUMENTATION.
806
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_config_timer.h
sl_si91x_config_timer_deinit#
void sl_si91x_config_timer_deinit (void )
To de-initialize the config-timer by disabling its clock.
N/A |
This API de-initializes the config-timer by disabling its clock. It also unregisters the callback and disables all config timer interrupts.
Note
Ensure that no timer operations are pending before calling this API.
841
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_config_timer.h
sl_si91x_config_timer_get_version#
sl_config_timer_version_t sl_si91x_config_timer_get_version (void )
To get the config timer API version.
N/A |
This API retrieves the version information of the config timer API.
Returns
Version structure ( sl_config_timer_version_t) containing the version details.
851
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_config_timer.h