AFBR-S50 API Reference Manual v1.5.6
AFBR-S50 Time-of-Flight Sensor SDK for Embedded Software
|
Timer utilities for time measurement duties. More...
Data Structures | |
struct | ltc_t |
A data structure to represent current time. More... | |
Functions | |
uint32_t | Time_ToUSec (ltc_t const *t) |
Converts ltc_t to microseconds (uint32_t). | |
uint32_t | Time_ToMSec (ltc_t const *t) |
Converts ltc_t to milliseconds (uint32_t). | |
uint32_t | Time_ToSec (ltc_t const *t) |
Converts ltc_t to seconds (uint32_t). | |
void | Time_FromUSec (ltc_t *t, uint32_t t_usec) |
Converts microseconds (uint32_t) to ltc_t. | |
void | Time_FromMSec (ltc_t *t, uint32_t t_msec) |
Converts milliseconds (uint32_t) to ltc_t. | |
void | Time_FromSec (ltc_t *t, uint32_t t_sec) |
Converts seconds (uint32_t) to ltc_t. | |
bool | Time_GreaterEqual (ltc_t const *t1, ltc_t const *t2) |
Checks if /p t1 is greater or equal that /p t2. | |
void | Time_GetNow (ltc_t *t_now) |
Obtains the elapsed time since MCU startup. | |
ltc_t | Time_Now (void) |
Obtains the elapsed time since MCU startup. | |
uint32_t | Time_GetNowUSec (void) |
Obtains the elapsed microseconds since MCU startup. | |
uint32_t | Time_GetNowMSec (void) |
Obtains the elapsed milliseconds (rounded) since MCU startup. | |
uint32_t | Time_GetNowSec (void) |
Obtains the elapsed seconds (rounded) since MCU startup. | |
void | Time_Diff (ltc_t *t_diff, ltc_t const *t_start, ltc_t const *t_end) |
Obtains the time difference between two given time points. | |
uint32_t | Time_DiffUSec (ltc_t const *t_start, ltc_t const *t_end) |
Obtains the time difference between two given time points in microseconds. | |
uint32_t | Time_DiffMSec (ltc_t const *t_start, ltc_t const *t_end) |
Obtains the time difference between two given time points in milliseconds. | |
uint32_t | Time_DiffSec (ltc_t const *t_start, ltc_t const *t_end) |
Obtains the time difference between two given time points in seconds. | |
void | Time_GetElapsed (ltc_t *t_elapsed, ltc_t const *t_start) |
Obtains the elapsed time since a given time point. | |
uint32_t | Time_GetElapsedUSec (ltc_t const *t_start) |
Obtains the elapsed microseconds since a given time point. | |
uint32_t | Time_GetElapsedMSec (ltc_t const *t_start) |
Obtains the elapsed milliseconds since a given time point. | |
uint32_t | Time_GetElapsedSec (ltc_t const *t_start) |
Obtains the elapsed seconds since a given time point. | |
void | Time_Add (ltc_t *t, ltc_t const *t1, ltc_t const *t2) |
Adds two ltc_t values. | |
void | Time_AddUSec (ltc_t *t, ltc_t const *t1, uint32_t t2_usec) |
Adds a given time in microseconds to an ltc_t value. | |
void | Time_AddMSec (ltc_t *t, ltc_t const *t1, uint32_t t2_msec) |
Adds a given time in milliseconds to an ltc_t value. | |
void | Time_AddSec (ltc_t *t, ltc_t const *t1, uint32_t t2_sec) |
Adds a given time in seconds to an ltc_t value. | |
bool | Time_CheckWithin (ltc_t const *t_start, ltc_t const *t_end, ltc_t const *t) |
Checks if /p t is within the time interval /p t_start and /p t_end. | |
bool | Time_CheckTimeout (ltc_t const *t_start, ltc_t const *t_timeout) |
Checks if timeout is reached from a given starting time. | |
bool | Time_CheckTimeoutUSec (ltc_t const *t_start, uint32_t const t_timeout_usec) |
Checks if timeout is reached from a given starting time. | |
bool | Time_CheckTimeoutMSec (ltc_t const *t_start, uint32_t const t_timeout_msec) |
Checks if timeout is reached from a given starting time. | |
bool | Time_CheckTimeoutSec (ltc_t const *t_start, uint32_t const t_timeout_sec) |
Checks if timeout is reached from a given starting time. | |
void | Time_Delay (ltc_t const *dt) |
Time delay for a given time period. | |
void | Time_DelayUSec (uint32_t dt_usec) |
Time delay for a given time period in microseconds. | |
void | Time_DelayMSec (uint32_t dt_msec) |
Time delay for a given time period in milliseconds. | |
void | Time_DelaySec (uint32_t dt_sec) |
Time delay for a given time period in seconds. | |
Timer utilities for time measurement duties.
This module provides time measurement utility functions like delay or time measurement methods, or time math functions.
Adds two ltc_t values.
Result is defined as t = t1 + t2. The results are wrapped around at maximum values just like integers. The references for t, t1 and t2 may point to the same instance(s).
t | Return value: t = t1 + t2. |
t1 | 1st operand. |
t2 | 2nd operand. |
Adds a given time in milliseconds to an ltc_t value.
Result is defined as t = t1 + t2. The results are wrapped around at maximum values just like integers. The references for t and t1 may point to the same instance.
t | Return value: t = t1 + t2. |
t1 | 1st operand. |
t2_msec | 2nd operand in milliseconds. |
Adds a given time in seconds to an ltc_t value.
Result is defined as t = t1 + t2. The results are wrapped around at maximum values just like integers. The references for t and t1 may point to the same instance.
t | Return value: t = t1 + t2. |
t1 | 1st operand. |
t2_sec | 2nd operand in seconds. |
Adds a given time in microseconds to an ltc_t value.
Result is defined as t = t1 + t2. The results are wrapped around at maximum values just like integers. The references for t and t1 may point to the same instance.
t | Return value: t = t1 + t2. |
t1 | 1st operand. |
t2_usec | 2nd operand in microseconds. |
Checks if timeout is reached from a given starting time.
Checks if a specified time (/p t_timeout) has elapsed since a specified start time (/p t_start). Handles overflow/wraparound of time values at the maximum value.
t_start | Start time. |
t_timeout | Timeout period. |
|
inline |
Checks if timeout is reached from a given starting time.
Handles overflow.
t_start | Start time. |
t_timeout_msec | Timeout period in milliseconds. |
|
inline |
Checks if timeout is reached from a given starting time.
Handles overflow.
t_start | Start time. |
t_timeout_sec | Timeout period in seconds. |
|
inline |
Checks if timeout is reached from a given starting time.
Handles overflow.
t_start | Start time. |
t_timeout_usec | Timeout period in microseconds. |
Checks if /p t is within the time interval /p t_start and /p t_end.
The interval is from /p t_start to /p t_end. The function returns true if /p t >= /p t_start AND /p t < /p t_end. If /p t_end is before /p t_start, /p t_end is consider to be wrapped around and the condition inverts (i.e. the function returns true if /p < /p t_end OR /p t >= t_start.
t_start | The start of the time interval. |
t_end | The end of the time interval. |
t | The time to be checked if it is with the interval. |
|
inline |
Time delay for a given time period.
dt | Delay time. |
|
inline |
Time delay for a given time period in milliseconds.
dt_msec | Delay time in milliseconds. |
|
inline |
Time delay for a given time period in seconds.
dt_sec | Delay time in seconds. |
|
inline |
Time delay for a given time period in microseconds.
dt_usec | Delay time in microseconds. |
Obtains the time difference between two given time points.
Result is defined as t_diff = t_end - t_start. Note: since no negative time differences are supported, t_end has to be later/larger than t_start. Otherwise, the result is undefined!
t_diff | Returned time difference. |
t_start | Start time point. |
t_end | End time point. |
Obtains the time difference between two given time points in milliseconds.
Result is defined as t_diff = t_end - t_start. Refers to Time_Diff() and handles overflow. Wrap around effect due to uint32_t result format!!
t_start | Start time point. |
t_end | End time point. |
Obtains the time difference between two given time points in seconds.
Result is defined as t_diff = t_end - t_start. Refers to Time_Diff() and handles overflow.
t_start | Start time point. |
t_end | End time point. |
Obtains the time difference between two given time points in microseconds.
Result is defined as t_diff = t_end - t_start. Refers to Time_Diff() and handles overflow such that to large values are limited by 0xFFFFFFFF µs.
t_start | Start time point. |
t_end | End time point. |
|
inline |
|
inline |
|
inline |
Obtains the elapsed time since a given time point.
Calculates the currently elapsed time since a specified start time (/p t_start).
Note that /p t_start must be in the past! Otherwise, the behavior is undefined!
t_elapsed | Returns the elapsed time since /p t_start. |
t_start | Start time point. |
|
inline |
Obtains the elapsed milliseconds since a given time point.
Wrap around effect due to uint32_t result format!!
t_start | Start time point. |
|
inline |
Obtains the elapsed seconds since a given time point.
t_start | Start time point. |
|
inline |
Obtains the elapsed microseconds since a given time point.
Wrap around effect due to uint32_t result format!!
t_start | Start time point. |
|
inline |
Obtains the elapsed time since MCU startup.
t_now | returned current time |
|
inline |
Obtains the elapsed milliseconds (rounded) since MCU startup.
Wrap around effect due to uint32_t result format!!
|
inline |
Obtains the elapsed seconds (rounded) since MCU startup.
|
inline |
Obtains the elapsed microseconds since MCU startup.
Wrap around effect due to uint32_t result format!!
Checks if /p t1 is greater or equal that /p t2.
Handles overflow.
t1 | 1st operand. |
t2 | 2nd operand. |
|
inline |
Obtains the elapsed time since MCU startup.
|
inline |
Converts ltc_t to milliseconds (uint32_t).
The specified time value (type ltc_t) is converted to milliseconds. The value is truncated to UINT32_MAX value if the result would exceed UINT32_MAX milliseconds. The returned value is correctly rounded to the nearest value.
t | Input ltc_t structure. |
|
inline |
|
inline |