dpl_time.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2020 Inria
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser
5  * General Public License v2.1. See the file LICENSE in the top level
6  * directory for more details.
7  */
8 
9 #pragma once
10 
22 #include "os/os_time.h"
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
33 static inline dpl_time_t dpl_time_get(void)
34 {
35  return os_time_get();
36 }
37 
46 static inline dpl_error_t dpl_time_ms_to_ticks(uint32_t ms, dpl_time_t *out_ticks)
47 {
48  return (dpl_error_t) os_time_ms_to_ticks(ms, out_ticks);
49 }
50 
59 static inline dpl_error_t dpl_time_ticks_to_ms(dpl_time_t ticks, uint32_t *out_ms)
60 {
61  return (dpl_error_t) os_time_ticks_to_ms(ticks, out_ms);
62 }
63 
71 static inline dpl_time_t dpl_time_ms_to_ticks32(uint32_t ms)
72 {
73  return os_time_ms_to_ticks32(ms);
74 }
75 
84 {
85  return os_time_ticks_to_ms32(ticks);
86 }
87 
93 static inline void dpl_time_delay(dpl_time_t ticks)
94 {
95  return os_time_delay(ticks);
96 }
97 
98 #ifdef __cplusplus
99 }
100 #endif
os_error_t dpl_error_t
dpl error type
Definition: dpl_error.h:50
static void dpl_time_delay(dpl_time_t ticks)
Wait until the number of ticks has elapsed, BLOICKING.
Definition: dpl_time.h:93
static dpl_time_t dpl_time_get(void)
Returns the low 32 bits of cputime.
Definition: dpl_time.h:33
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:46
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:83
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:71
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:59
os_time_t dpl_time_t
dpl time type
Definition: dpl_types.h:56
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:79
static os_time_t os_time_get(void)
Returns the low 32 bits of cputime.
Definition: os_time.h:39
static void os_time_delay(os_time_t ticks)
Wait until the number of ticks has elapsed, BLOICKING.
Definition: os_time.h:101
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:91
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:66
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:52