Solaris Software
Loading...
Searching...
No Matches
time.c
Go to the documentation of this file.
1/**
2 * @file time.c
3 * @brief HAL time functions implementation. Dispatches through the registered HAL port.
4 */
5
6/* ----------------------------------------------------------------
7 * INCLUDES
8 * ---------------------------------------------------------------- */
9#include "spp/hal/hal.h"
10#include "spp/hal/time/time.h"
11
12/* ----------------------------------------------------------------
13 * PUBLIC FUNCTIONS
14 * ---------------------------------------------------------------- */
16{
17 const SPP_HalPort_t *p_port = SPP_HAL_getPort();
18 if ((p_port == NULL) || (p_port->time.getTimeMs == NULL))
19 {
20 return 0U;
21 }
22 return p_port->time.getTimeMs();
23}
24
26{
27 const SPP_HalPort_t *p_port = SPP_HAL_getPort();
28 if ((p_port == NULL) || (p_port->time.getTimeUs == NULL))
29 {
30 return 0U;
31 }
32 return p_port->time.getTimeUs();
33}
34
36{
37 const SPP_HalPort_t *p_port = SPP_HAL_getPort();
38 if ((p_port != NULL) && (p_port->time.delayMs != NULL))
39 {
40 p_port->time.delayMs(ms);
41 }
42}
const SPP_HalPort_t * SPP_HAL_getPort(void)
Returns the registered HAL port.
Definition hal.c:52
This file contains the structs that contain all the pointers to the functions that are used by the SP...
spp_uint32_t(*) getTimeUs(void)
Return the current hardware time in microseconds.
Definition hal.h:216
spp_uint32_t(*) getTimeMs(void)
Return the current hardware time in milliseconds.
Definition hal.h:207
void(*) delayMs(spp_uint32_t ms)
Block for the requested number of milliseconds.
Definition hal.h:226
Ports struct that contains all the pointers to the Ports functions.
Definition hal.h:234
SPP_HALTime_t time
Definition hal.h:238
spp_uint32_t SPP_HAL_TIME_getTimeMs(void)
Return the current hardware time in milliseconds.
Definition time.c:15
spp_uint32_t SPP_HAL_TIME_getTimeUs(void)
Return the current hardware time in microseconds.
Definition time.c:25
void SPP_HAL_TIME_delayMs(spp_uint32_t ms)
Block for the requested number of milliseconds.
Definition time.c:35
SPP HAL time API — dispatches through the registered HAL port.
uint32_t spp_uint32_t
Definition types.h:31