Config Timer#
Introduction#
Configurable timers can be used for modulated signal output, event capture on the GPIOs in input mode, and clock and event counting. They can be configured to operate in the Pulse Width Modulation (PWM) mode, which drives a pulse width modulated wave on the outputs in accordance with the ON and OFF periods that are programmed.
Timers are often built-in peripherals found in micro-controllers and microprocessors. They function independently of the CPU and other peripherals, allowing them to maintain track of time and conduct timing-related tasks without requiring CPU intervention.
Configuration#
Few parameters need to be defined in order to configure the config-timer. These include the timer mode, counter direction, counter buffer, soft reset trigger, counter trigger, and counter sync trigger.
To Configures Config-timer parameters such as 32-bit or 16-bit mode sl_config_timer_mode_t, periodic mode (Enable/Disable), Counter trigger (Enable/Disable), soft reset (Enable/Disable), buffer enable (Enable/Disable), sets direction for counter0 sl_counter0_direction_t and counter1 sl_counter1_direction_t after making the required configuration in sl_config_timer_config_t need to call the API sl_si91x_config_timer_set_configuration().
For more information on configuring available parameters refer to the respective peripheral example readme document.
Usage#
After specifying the CT Structures, the common configurable Timer (CT) functions can be called by giving an instance of sl_config_timer_config_t. These routines will start and configure the CT below, which is the pipeline for implementation.
sl_si91x_config_timer_set_initial_count (Optional)
Modules#
sl_config_timer_interrupt_flags_t
Enumerations#
Enumeration to represent timer modes.
Enumeration to represent timer counter numbers.
Enumeration to represent timer counter directions.
Enumeration to represent timer-config parameters values.
Enumeration to represent timer OCU-config parameters 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 parameters structure type.
Renaming MCPWM callback structure.
Typedef for the function pointer of the interrupt callback function.
Functions#
This API will initialize config-timer peripheral.
This API will set Config-timer mode as 32-bit or 16-bit counters.
This API will configures Config-timer parameters.
This API will reset config-timer parameters and sets default parameter values.
This API will set Config-timer OCU (Output Compare Unit) configurations.
This API will reset config-timer OCU (Output Compare Unit) parameters.
This API will set Config-timer OCU mode control params.
This API will set the Config-timer WFG mode configurations.
This API will set Config-timer initial count as per timer mode.
This API will set the Config-timer match-count as per timer mode and counter-number.
API to calculate and return the match value of the timer for desired time period.
This API will get Config-timer current count.
This API will reset Config-timer counter register value.
This API will start selected config-timer counter.
This API will select config timer input events.
This API will configure config-timer.
This API will register callback of config timer interrupts.
This API will unregister timer interrupt callback.
This API will Resume halt operation of Config-timer counter.
This API Gets Config-timer count value when capture occurs.
This API will synchronize counter output with other channels, as per sync_counter_value.
This API is used to configure config timer output events for ADC trigger.
This API de-initialize config-timer by disabling its clock.
This API will get Config timer API version and it returns the same.
Enumeration Documentation#
sl_config_timer_mode_t#
sl_config_timer_mode_t
Enumeration to represent timer modes.
Enumerator | |
---|---|
SL_COUNTER_16BIT | enum for CT 16-bit mode |
SL_COUNTER_32BIT | enum for CT 32-bit mode |
SL_COUNTER_MODE_LAST | Last member of enum for validation. |
67
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 enum for validation. |
74
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 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 enum for validation. |
81
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_config_timer.h
sl_counter1_direction_t#
sl_counter1_direction_t
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 enum for validation. |
88
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-config parameters values.
Enumerator | |
---|---|
SL_COUNTER_MODE_32 | enum for CT 32-bit mode value |
SL_COUNTER0_SOFT_RESET_ENABLE | enum for counter-0 soft reset enable value |
SL_COUNTER0_PERIODIC_ENABLE | enum for counter-0 periodic mode enable value |
SL_COUNTER0_TRIGGER_ENABLE | enum for counter-0 software trigger enable value |
SL_COUNTER0_SYNC_TRIGGER_ENABLE | enum for counter-0 sync trigger enable value |
SL_COUNTER0_BUFFER_ENABLE | enum for counter-0 buffer enable value |
SL_COUNTER0_UP_DIRECTION | enum for counter-0 up-direction enable value |
SL_COUNTER0_DOWN_DIRECTION | enum for counter-0 down-direction enable value |
SL_COUNTER0_UP_DOWN_DIRECTION | enum for counter-0 up-down direction enable value |
SL_COUNTER1_SOFT_RESET_ENABLE | enum for counter-1 soft reset enable value |
SL_COUNTER1_PERIODIC_ENABLE | enum for counter-1 periodic mode enable value |
SL_COUNTER1_TRIGGER_ENABLE | enum for counter-1 software trigger enable value |
SL_COUNTER1_SYNC_TRIGGER_ENABLE | enum for counter-1 sync trigger enable value |
SL_COUNTER1_BUFFER_ENABLE | enum for counter-1 buffer enable value |
SL_COUNTER1_UP_DIRECTION | enum for counter-1 up-direction enable value |
SL_COUNTER1_DOWN_DIRECTION | enum for counter-1 up-direction enable value |
SL_COUNTER1_UP_DOWN_DIRECTION | enum for counter-1 up-direction enable value |
SL_COUNTER_PARAM_LAST | Last member of enum for validation. |
96
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-config parameters values.
Enumerator | |
---|---|
SL_COUNTER0_OCU_OUTPUT_ENABLE | enum for counter-0 output enable value |
SL_COUNTER0_OCU_DMA_ENABLE | enum for counter-0 OCU-DMA mode enable value |
SL_COUNTER0_OCU_8BIT_ENABLE | enum for counter-0 OCU-8bit mode enable value |
SL_COUNTER0_OCU_SYNC_ENABLE | enum for counter-0 OCU-sync mode enable value |
SL_COUNTER1_OCU_OUTPUT_ENABLE | enum for counter-1 output enable value |
SL_COUNTER1_OCU_DMA_ENABLE | enum for counter-1 OCU-DMA mode enable value |
SL_COUNTER1_OCU_8BIT_ENABLE | enum for counter-1 OCU-8bit mode enable value |
SL_COUNTER1_OCU_SYNC_ENABLE | enum for counter-1 OCU-sync mode enable value |
SL_OCU_OUTPUT0_TOGGLE_HIGH | enum for counter-0 output toggle high |
SL_OCU_OUTPUT0_TOGGLE_LOW | enum for counter-0 output toggle low |
SL_OCU_OUTPUT1_TOGGLE_HIGH | enum for counter-1 output toggle high select value |
SL_OCU_OUTPUT1_TOGGLE_LOW | enum for counter-1 output toggle low select value |
SL_OCU_PARAM_LAST | Last member of enum for validation. |
118
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 | enum for no input event |
SL_EVENT0_RISING_EDGE | enum for input-0 rising edge event |
SL_EVENT1_RISING_EDGE | enum for input-1 rising edge event |
SL_EVENT2_RISING_EDGE | enum for input-2 rising edge event |
SL_EVENT3_RISING_EDGE | enum for input-3 rising edge event |
SL_EVENT0_FALLING_EDGE | enum for input-0 falling edge event |
SL_EVENT1_FALLING_EDGE | enum for input-1 falling edge event |
SL_EVENT2_FALLING_EDGE | enum for input-2 falling edge event |
SL_EVENT3_FALLING_EDGE | enum for input-3 falling edge event |
SL_EVENT0_RISING_FALLING_EDGE | enum for input-0 rising-falling edge event |
SL_EVENT1_RISING_FALLING_EDGE | enum for input-1 rising-falling edge event |
SL_EVENT2_RISING_FALLING_EDGE | enum for input-2 rising-falling edge event |
SL_EVENT3_RISING_FALLING_EDGE | enum for input-3 rising-falling edge event |
SL_EVENT0_LEVEL0 | enum for input-0 Level-0 event |
SL_EVENT1_LEVEL0 | enum for input-0 Level-0 event |
SL_EVENT2_LEVEL0 | enum for input-0 Level-0 event |
SL_EVENT3_LEVEL0 | enum for input-0 Level-0 event |
SL_EVENT0_LEVEL1 | enum for input-0 Level-0 event |
SL_EVENT1_LEVEL1 | enum for input-0 Level-0 event |
SL_EVENT2_LEVEL1 | enum for input-0 Level-0 event |
SL_EVENT3_LEVEL1 | enum for input-0 Level-0 event |
SL_AND_EVENT | enum for and-event |
SL_OR_EVENT | enum for or-event |
SL_EVENT0_RISING_EDGE_AND_EVENT | enum for input-0 rising edge and-event |
SL_EVENT0_RISING_EDGE_OR_EVENT | enum for input-0 rising edge or-event |
SL_EVENT1_RISING_EDGE_AND_EVENT | enum for input-1 rising edge and-event |
SL_EVENT1_RISING_EDGE_OR_EVENT | enum for input-1 rising edge or-event |
SL_EVENT2_RISING_EDGE_AND_EVENT | enum for input-2 rising edge and-event |
SL_EVENT2_RISING_EDGE_OR_EVENT | enum for input-2 rising edge or-event |
SL_EVENT3_RISING_EDGE_AND_EVENT | enum for input-3 rising edge and-event |
SL_EVENT3_RISING_EDGE_OR_EVENT | enum for input-3 rising edge or-event |
SL_EVENT0_RISING_EDGE_REGISTERED_AND_EVENT | enum for input-0 rising edge registered and-event |
SL_EVENT0_RISING_EDGE_REGISTERED_OR_EVENT | enum for input-0 rising edge registered or-event |
SL_EVENT1_RISING_EDGE_REGISTERED_AND_EVENT | enum for input-1 rising edge registered and-event |
SL_EVENT1_RISING_EDGE_REGISTERED_OR_EVENT | enum for input-1 rising edge registered or-event |
SL_EVENT2_RISING_EDGE_REGISTERED_AND_EVENT | enum for input-2 rising edge registered and-event |
SL_EVENT2_RISING_EDGE_REGISTERED_OR_EVENT | enum for input-2 rising edge registered or-event |
SL_EVENT3_RISING_EDGE_REGISTERED_AND_EVENT | enum for input-3 rising edge registered and-event |
SL_EVENT3_RISING_EDGE_REGISTERED_OR_EVENT | enum for input-3 rising edge registered or-event |
SL_CT_EVENT_LAST | Last member of enum for validation. |
135
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 enum for validation. |
179
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 |
192
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.
55
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 parameters structure type.
56
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.
57
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 |
64
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 )
This API will initialize config-timer peripheral.
N/A |
Configures its output GPIO pins and clock as 16 MHz.
Returns
none
302
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)
This API will set Config-timer mode as 32-bit or 16-bit counters.
[in] | mode | sl_config_timer_mode_t for possible values |
In 32-bit mode Counter_1 and Counter_0 will be merged and used as a single 32 bit counter. In this mode, Counter_0 modes/triggers/enables will be used.
Pre-conditions:
Returns
status 0 if successful, else error-code as follow
SL_STATUS_INVALID_MODE (0x0024) - 'mode' parameter value is invalid.
SL_STATUS_OK (0x0000) - Success, timer-mode is set properly
315
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)
This API will configures Config-timer parameters.
[in] | timer_config_ptr | Pointer to CT config structure sl_config_timer_config_t |
This API will set 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 is enabled to start the counter. Sync trigger enables the counter to run/active when sync is found. Buffer enable will copy buffer data to Counter Match register. Soft reset valid only when the counter is in two 16 bit counters mode, this resets the counter on the write.
Pre-condition:
Returns
status 0 if successful, else error-code as follow
SL_STATUS_NULL_POINTER (0x0022) - The parameter is null pointer.
SL_STATUS_INVALID_PARAMETER (0x0021) - Counter direction parameter has invalid value.
SL_STATUS_OK (0x0000) - Success, timer configurations are set properly
335
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 )
This API will reset config-timer parameters and sets default parameter values.
N/A |
This sets 16-bit mode, up-counter direction Disables periodic mode, soft reset, buffer, sync and software trigger of counters.
Returns
none
345
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)
This API will set Config-timer OCU (Output Compare Unit) configurations.
[in] | ocu_config_ptr | Pointer to CT OCU-config structure sl_config_timer_ocu_config_t |
It enables outputs in OCU mode, OCU-DMA mode, channel sync with OCU outputs, 8-bit mode for OCU outputs for both counters.
Returns
status 0 if successful, else error-code as follow
SL_STATUS_NULL_POINTER (0x0022) - The parameter is null pointer.
SL_STATUS_OK (0x0000) - Success, OCU configurations are set properly.
359
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 )
This API will reset config-timer OCU (Output Compare Unit) parameters.
N/A |
this will set 16-bit mode, sets up-counter direction also disables DMA mode, channel sync and 8-bit mode for OCU outputs.
Returns
none
369
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)
This API will set Config-timer OCU mode control params.
[in] | ocu_params | Pointer to CT OCU-config structure sl_config_timer_ocu_control_t |
This Config-timer OCU mode control params Sets first and next threshold values for counter outputs. It also enables the DMA support for counters.
Returns
status 0 if successful, else error-code as follow
SL_STATUS_NULL_POINTER (0x0022) - The parameter is null pointer.
SL_STATUS_OK (0x0000) - Success, OCU mode control params are set properly.
386
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)
This API will set the Config-timer WFG mode configurations.
[in] | wfg_config_ptr | Pointer to CT wfg-config structure sl_config_timer_wfg_config_t |
This API will configures the Config-timer WFG mode configurations Such as select toggle high, low and peak for counter-0 & counter-1 outputs.
Pre-condition:
Returns
status 0 if successful, else error-code as follow SL_STATUS_NULL_POINTER (0x0022) - The parameter is null pointer. SL_STATUS_OK (0x0000) - Success, WFG mode configurations are set properly.
401
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)
This API will set Config-timer initial count as per timer mode.
[in] | mode | sl_config_timer_mode_t for possible values |
[in] | counter0_initial_value | (uint16_t) |
[in] | counter1_initial_value | (uint16_t) |
Configurable timer mode are mentioned below:
For 32-bit mode, counter0_initial_value is passes to CT count register. For 32-bit mode pass counter1 initial-value as zero.
For 16-bit mode counters, ORed value of both initial value is passed to the register.
Returns
status 0 if successful, else error-code as follow SL_STATUS_INVALID_MODE (0x0024) - 'mode' parameter value is invalid. SL_STATUS_OK (0x0000) - Success, initial-count is set properly
421
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)
This API will set the Config-timer match-count as per 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 mode is 32-bit, use counter0 If mode is 16-bit as per passed counter number it updates the match value For 16-bit mode it takes 16-bit match-value only, else through error
Pre-conditions:
l_si91x_config_timer_set_configuration();
Returns
status 0 if successful, else error-code as follow
SL_STATUS_INVALID_MODE (0x0024) - 'mode' parameter value is invalid.
SL_STATUS_INVALID_PARAMETER 0x0021) - 'counter_number' parameter value is invalid.
SL_STATUS_OK (0x0000) - Success, match-value is set properly.
441
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)
API to calculate and return the match value of the timer for desired time period.
[in] | time_period_in_us | : Time period in microseconds |
[out] | match_value | : Gets match value of the timer for desired time period |
Returns
status 0 if successful, else error-code as follow
SL_STATUS_INVALID_COUNT (0x002B) - Count is invalid.
SL_STATUS_OK (0x0000) - Success.
454
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)
This API will get Config-timer current count.
[in] | mode | sl_counter_number_t for possible values |
[in] | counter_number | sl_config_timer_mode_t for possible values |
[in] | count_value | *(uint32_t), pointer to the variable to store count value |
This API will get Config-timer current count as per timer mode and counter-number and it updates the count value to count_value variable input parameter.
Pre-conditions:
l_si91x_config_timer_set_configuration();
Returns
status 0 if successful, else error code SL_STATUS_INVALID_MODE (0x0024) - 'mode' parameter value is invalid.
SL_STATUS_INVALID_PARAMETER 0x0021) - 'counter_number' parameter value is invalid.
SL_STATUS_NULL_POINTER (0x0022) - The parameter 'count_value' is null pointer.
SL_STATUS_OK (0x0000) - Success, count-value is read properly
479
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)
This API will reset Config-timer counter register value.
[in] | counter_number | sl_counter_number_t for possible values |
Note
Resets the Count values of selected counter.
Pre-conditions:
l_si91x_config_timer_set_configuration();
Returns
status 0 if successful, else error-code as follow
SL_STATUS_INVALID_PARAMETER 0x0021) - 'counter_number' parameter value is invalid.
SL_STATUS_OK (0x0000) - Success, counter resets properly
497
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)
This API will start selected config-timer counter.
[in] | counter_number | sl_counter_number_t for possible values |
Note
This API triggers the 'counter_number' counter.
Pre-conditions:
l_si91x_config_timer_set_configuration(),keep software trigger disable here
Returns
status 0 if successful, else error-code as follow
SL_STATUS_INVALID_PARAMETER 0x0021) - 'counter_number' parameter value is invalid.
SL_STATUS_OK (0x0000) - Success, timer started properly
512
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)
This API will select config timer input events.
[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 will select config timer input events for triggering selected timer-actions. Different timer actions are start, stop, continue, halt, increment, capture, interrupt and output.
Pre-conditions:
sl_si91x_config_timer_set_configuration(), keep software trigger disable here
sl_si91x_config_timer_register_callback(), keep event interrupt flag enable for respective counter
Returns
status 0 if successful, else error-code as follow
SL_STATUS_INVALID_PARAMETER 0x0021) - Selected input event or action parameter value is invalid.
SL_STATUS_OK (0x0000) - Success, input event is set properly
533
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)
This API will configure config-timer.
[in] | event_config_handle | Pointer to CT configure action events structure sl_config_action_event_t |
This configures config timer input-event's AND-event and OR-event for triggering selected timer-action. Different timer actions are start, stop, continue, halt, increment, capture, interrupt and output.
Pre-condition:
sl_si91x_config_timer_set_configuration(), keep software trigger disable here
sl_si91x_config_timer_register_callback(), keep event interrupt flag enable for respective counter
sl_si91x_config_timer_select_action_event(), first selects the input event for respective action for respective counter
Returns
status 0 if successful, else error-code as follow SL_STATUS_NULL_POINTER (0x0022) - The parameter is null pointer. SL_STATUS_INVALID_PARAMETER 0x0021) - and-event or or-event or event-valid-bits value is invalid. SL_STATUS_OK (0x0000) - Success, AND event & OR event set properly
558
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_value, sl_config_timer_interrupt_flags_t * interrupt_flags)
This API will register callback of config timer interrupts.
[in] | on_config_timer_callback | (function pointer) Callback function pointer to be called when timer interrupt occurred sl_config_timer_callback_t |
[in] | callback_flag_value | (void *) pointer to interrupt flag value variable sl_config_timer_callback_t |
[in] | interrupt_flags | pointer to interrupt flags structure sl_config_timer_interrupt_flags_t |
Enabling respective interrupts as per selected interrupt flag.
Pre-conditions:
sl_si91x_config_timer_set_configuration(), keep software trigger disable here
sl_si91x_config_timer_unregister_timeout_callback(), if already registered for any interrupt
Returns
status 0 if successful, else error-code as follow
SL_STATUS_NULL_POINTER (0x0022) - parameter is a null pointer.
SL_STATUS_BUSY (0x0004) - The callback is already registered, unregister previous callback before registering new one.
SL_STATUS_OK (0x0000) - Successfully registered timer timer-out callback.
580
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)
This API will unregister timer interrupt callback.
[in] | interrupt_flags | pointer to interrupt flags structure sl_config_timer_interrupt_flags_t |
Disables interrupts as per selected interrupt flag.
Pre-conditions:
sl_si91x_config_timer_register_callback(), first register particular interrupt flag
Returns
status 0 if successful, else error-code as follow SL_STATUS_NULL_POINTER (0x0022) - parameter is a null pointer. SL_STATUS_OK (0x0000) - Successfully unregistered timer interrupt callback.
595
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)
This API will Resume halt operation of Config-timer counter.
[in] | counter_number | sl_counter_number_t for possible values |
Counter will start running from the count where it was halted previously.
Pre-conditions:
Returns
status 0 if successful, else error-code as follow
SL_STATUS_INVALID_PARAMETER 0x0021) - 'counter_number' parameter value is invalid.
SL_STATUS_OK (0x0000) - Success, halt operation resumed properly
613
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)
This API Gets Config-timer count value when capture occurs.
[in] | counter_number | sl_counter_number_t for possible values |
[in] | capture_value | (uint16_t*), pointer to the variable to store count value at capture event. |
Updates the capture count value of timer to capture_value variable input parameter.
Pre-conditions:
l_si91x_config_timer_set_configuration();
sl_si91x_config_timer_select_action_event(), first select events for capture action
Returns
status 0 if successful, else error-code as follow
SL_STATUS_NULL_POINTER (0x0022) - The parameter 'capture_value' is null pointer.
SL_STATUS_INVALID_PARAMETER 0x0021) - 'counter_number' parameter value is invalid.
SL_STATUS_OK (0x0000) - Success, capture count-value is read properly
631
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)
This API will synchronize counter output with other channels, as per sync_counter_value.
[in] | counter_number | sl_counter_number_t for possible values |
[in] | sync_counter_value | (uint8_t) |
Pre-conditions:
l_si91x_config_timer_set_configuration();
Returns
status 0 if successful, else error-code as follow SL_STATUS_INVALID_PARAMETER 0x0021) - 'counter_number' parameter value is invalid. SL_STATUS_OK (0x0000) - Success, counter output synced properly
647
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)
This API is used 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.
Pre-conditions:
sl_si91x_config_timer_init(); l_si91x_config_timer_set_configuration();
Returns
status 0 if successful, else error-code as follow
SL_STATUS_INVALID_PARAMETER 0x0021) - 'pin_1' or 'pin_2' parameter value is invalid.
SL_STATUS_OK (0x0000) - Success, ADC trigger events set properly
665
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_config_timer.h
sl_si91x_config_timer_set_wfg_compare_values#
sl_status_t sl_si91x_config_timer_set_wfg_compare_values (sl_counter_number_t counter_number, sl_config_timer_ocu_params_t * ocu_params)
N/A | counter_number | |
N/A | ocu_params |
668
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 )
This API de-initialize config-timer by disabling its clock.
N/A |
Returns
none
Note
Unregisters the callback and disables all config timer interrupts.
677
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 )
This API will get Config timer API version and it returns the same.
N/A |
Returns
(sl_config_version_t) type structure
685
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_config_timer.h