1.2.11.4.16 SYS_TIME_MSToCount Function

C

uint32_t SYS_TIME_MSToCount ( uint32_t ms )

Summary

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

Description

This function converts a given time interval (measured in milliseconds) 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
msTime interval in milliseconds.

Returns

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

Example

uint32_t futureCounter = SYS_TIME_CounterGet() + SYS_TIME_MSToCount(10);

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 2 msec, a count of 3 will be reported (corresponding to 2.1 msec).