Loading...
Searching...
No Matches
dpl_time.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2020 Inria
3 * SPDX-License-Identifier: LGPL-2.1-only
4 */
5
6#pragma once
7
18
19#include "os/os_time.h"
20
21#ifdef __cplusplus
22extern "C" {
23#endif
24
30static inline dpl_time_t dpl_time_get(void)
31{
32 return os_time_get();
33}
34
43static inline dpl_error_t dpl_time_ms_to_ticks(uint32_t ms, dpl_time_t *out_ticks)
44{
45 return (dpl_error_t) os_time_ms_to_ticks(ms, out_ticks);
46}
47
56static inline dpl_error_t dpl_time_ticks_to_ms(dpl_time_t ticks, uint32_t *out_ms)
57{
58 return (dpl_error_t) os_time_ticks_to_ms(ticks, out_ms);
59}
60
68static inline dpl_time_t dpl_time_ms_to_ticks32(uint32_t ms)
69{
70 return os_time_ms_to_ticks32(ms);
71}
72
81{
82 return os_time_ticks_to_ms32(ticks);
83}
84
90static inline void dpl_time_delay(dpl_time_t ticks)
91{
92 return os_time_delay(ticks);
93}
94
95#ifdef __cplusplus
96}
97#endif
os_error_t dpl_error_t
dpl error type
Definition dpl_error.h:47
static void dpl_time_delay(dpl_time_t ticks)
Wait until the number of ticks has elapsed, BLOICKING.
Definition dpl_time.h:90
static dpl_time_t dpl_time_get(void)
Returns the low 32 bits of cputime.
Definition dpl_time.h:30
static dpl_error_t dpl_time_ms_to_ticks(uint32_t ms, dpl_time_t *out_ticks)
Converts the given number of milliseconds into cputime ticks.
Definition dpl_time.h:43
static dpl_time_t dpl_time_ticks_to_ms32(dpl_time_t ticks)
Convert the given number of ticks into milliseconds.
Definition dpl_time.h:80
static dpl_time_t dpl_time_ms_to_ticks32(uint32_t ms)
Converts the given number of milliseconds into cputime ticks.
Definition dpl_time.h:68
static dpl_error_t dpl_time_ticks_to_ms(dpl_time_t ticks, uint32_t *out_ms)
Convert the given number of ticks into milliseconds.
Definition dpl_time.h:56
os_time_t dpl_time_t
dpl time type
Definition dpl_types.h:53
mynewt-core time abstraction
static os_time_t os_time_ms_to_ticks32(uint32_t ms)
Converts the given number of milliseconds into cputime ticks.
Definition os_time.h:76
static os_time_t os_time_get(void)
Returns the low 32 bits of cputime.
Definition os_time.h:36
static void os_time_delay(os_time_t ticks)
Wait until the number of ticks has elapsed, BLOICKING.
Definition os_time.h:98
static os_time_t os_time_ticks_to_ms32(os_time_t ticks)
Convert the given number of ticks into milliseconds.
Definition os_time.h:88
static os_error_t os_time_ticks_to_ms(os_time_t ticks, uint32_t *out_ms)
Convert the given number of ticks into milliseconds.
Definition os_time.h:63
static os_error_t os_time_ms_to_ticks(uint32_t ms, os_time_t *out_ticks)
Converts the given number of milliseconds into cputime ticks.
Definition os_time.h:49