1.2.11.4.20 SYS_TIME_TimerCounterGet Function
C
SYS_TIME_RESULT SYS_TIME_TimerCounterGet ( SYS_TIME_HANDLE handle, uint32_t *count );
Summary
Gets the elapsed counter value of a software timer.
Description
This function gets the elapsed counter value of the software timer identified by the handle given.
Precondition
The SYS_TIME_Initialize must have been called and a valid handle to the software timer must be available.
Parameters
Param | Description |
---|---|
handle | Handle to a software timer instance. |
count | Address of the variable to receive the value of the given software timer's elapsed counter. This parameter is ignored when the return value is not SYS_TIME_SUCCES. |
Returns
SYS_TIME_SUCCESS if the operation succeeds.
SYS_TIME_ERROR if the operation fails (due, for example, to an to an invalid handle).
Example
Given a "timer" handle, the following example will get the given software timer's elapsed counter value.
uint32_t count; if (SYS_TIME_TimerCounterGet(timer, &count) != SYS_TIME_SUCCESS) { // Handle error }
Remarks
The counter value may be stale immediately upon function return, depending upon timer frequency and system performance.