Timer¶
-
group
group_abstraction_rtos_timer
APIs for creating and working with Timers.
Unnamed Group
-
cy_rslt_t
cy_rtos_init_timer
(cy_timer_t *timer, cy_timer_trigger_type_t type, cy_timer_callback_t fun, cy_timer_callback_arg_t arg)¶ Create a new timer.
This function initializes a timer object.
note
The timer is not active until start is called.
note
The callback may be (likely will be) called from a different thread.
- Parameters
timer – [out] Pointer to the timer handle to initialize
type – [in] Type of timer (periodic or once)
fun – [in] The function
arg – [in] Argument to pass along to the callback function
- Returns
The status of the creation request. [CY_RSLT_SUCCESS, CY_RTOS_GENERAL_ERROR]
-
cy_rslt_t
cy_rtos_start_timer
(cy_timer_t *timer, cy_time_t num_ms)¶ Start a timer.
- Parameters
timer – [in] Pointer to the timer handle
num_ms – [in] The number of milliseconds to wait before the timer fires
- Returns
The status of the creation request. [CY_RSLT_SUCCESS, CY_RTOS_GENERAL_ERROR]
-
cy_rslt_t
cy_rtos_stop_timer
(cy_timer_t *timer)¶ Stop a timer.
- Parameters
timer – [in] Pointer to the timer handle
- Returns
The status of the creation request. [CY_RSLT_SUCCESS, CY_RTOS_GENERAL_ERROR]
-
cy_rslt_t
cy_rtos_is_running_timer
(cy_timer_t *timer, bool *state)¶ Returns state of a timer.
- Parameters
timer – [in] Pointer to the timer handle
state – [out] Return value for state, true if running, false otherwise
- Returns
The status of the creation request. [CY_RSLT_SUCCESS, CY_RTOS_GENERAL_ERROR]
-
cy_rslt_t
cy_rtos_deinit_timer
(cy_timer_t *timer)¶ Deinit the timer.
This function deinitializes the timer and frees all consumed resources.
- Parameters
timer – [in] Pointer to the timer handle
- Returns
The status of the creation request. [CY_RSLT_SUCCESS, CY_RTOS_GENERAL_ERROR]
Typedefs
-
typedef void (*
cy_timer_callback_t
)(cy_timer_callback_arg_t arg)¶ The callback function to be called by a timer.
Enums
-
enum
cy_timer_trigger_type_t
¶ cy_timer_trigger_type_t: The type of timer.
Values:
-
enumerator
CY_TIMER_TYPE_PERIODIC
¶ called periodically until stopped
-
enumerator
CY_TIMER_TYPE_ONCE
¶ called once only
-
enumerator
cy_timer_type_periodic
¶ - Deprecated:
replaced by CY_TIMER_TYPE_PERIODIC
-
enumerator
cy_timer_type_once
¶ - Deprecated:
replaced by CY_TIMER_TYPE_ONCE
-
enumerator
-
cy_rslt_t