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 
20 #ifndef DPL_DPL_TIME_H
21 #define DPL_DPL_TIME_H
22 
23 #include "os/os_time.h"
24 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
34 static inline dpl_time_t dpl_time_get(void)
35 {
36  return os_time_get();
37 }
38 
47 static inline dpl_error_t dpl_time_ms_to_ticks(uint32_t ms, dpl_time_t *out_ticks)
48 {
49  return (dpl_error_t) os_time_ms_to_ticks(ms, out_ticks);
50 }
51 
60 static inline dpl_error_t dpl_time_ticks_to_ms(dpl_time_t ticks, uint32_t *out_ms)
61 {
62  return (dpl_error_t) os_time_ticks_to_ms(ticks, out_ms);
63 }
64 
72 static inline dpl_time_t dpl_time_ms_to_ticks32(uint32_t ms)
73 {
74  return os_time_ms_to_ticks32(ms);
75 }
76 
85 {
86  return os_time_ticks_to_ms32(ticks);
87 }
88 
94 static inline void dpl_time_delay(dpl_time_t ticks)
95 {
96  return os_time_delay(ticks);
97 }
98 
99 #ifdef __cplusplus
100 }
101 #endif
102 
103 #endif /* DPL_DPL_TIME_H */
os_error_t dpl_error_t
dpl error type
Definition: dpl_error.h:51
static void dpl_time_delay(dpl_time_t ticks)
Wait until the number of ticks has elapsed, BLOICKING.
Definition: dpl_time.h:94
static dpl_time_t dpl_time_get(void)
Returns the low 32 bits of cputime.
Definition: dpl_time.h:34
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:47
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:84
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:72
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:60
os_time_t dpl_time_t
dpl time type
Definition: dpl_types.h:57
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:80
static os_time_t os_time_get(void)
Returns the low 32 bits of cputime.
Definition: os_time.h:40
static void os_time_delay(os_time_t ticks)
Wait until the number of ticks has elapsed, BLOICKING.
Definition: os_time.h:102
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:92
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:67
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:53