1.2.11.4.15 SYS_TIME_USToCount Function

C

uint32_t SYS_TIME_USToCount ( uint32_t us )

Summary

Convert the given time interval in microseconds to an equivalent counter value.

Description

This function converts a given time interval (measured in microseconds) to an equivalent 32-bit counter value, based on the configured hardware timer frequency as reported by SYS_TIME_FrequencyGet.

Precondition

The SYS_TIME_Initialize function should have been called before calling this function.

Parameters

ParamDescription
usTime interval in microseconds.

Returns

Number of hardware timer counts that will expire in the given time interval.

Example

uint32_t futureCounter = SYS_TIME_CounterGet() + SYS_TIME_USToCount(200);

Remarks

In tick-based mode, the returned count will be ceiled to the next timer tick. For example, if the timer tick is set to 700 usec and the requested time is 2000 usec, a count of 3 will be reported (corresponding to 2100 usec).