AFBR-S50 API Reference Manual v1.5.6
AFBR-S50 Time-of-Flight Sensor SDK for Embedded Software
Loading...
Searching...
No Matches
time.h File Reference

This file is part of the AFBR-S50 API. More...

#include "platform/argus_timer.h"
#include <assert.h>
#include <stdint.h>
#include <stdbool.h>
Include dependency graph for time.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

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.
 

Detailed Description

This file is part of the AFBR-S50 API.

This file provides utility functions for timing necessities.

Copyright (c) 2023, Broadcom Inc. All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.