oveRTOS C++ API
C++20 RAII wrappers for the oveRTOS C API
Loading...
Searching...
No Matches
time.hpp
Go to the documentation of this file.
1/*
2 * Copyright (C) 2026 Kamil Lulko <kamil.lulko@gmail.com>
3 *
4 * SPDX-License-Identifier: GPL-3.0-or-later
5 *
6 * This file is part of oveRTOS.
7 */
8
14#pragma once
15
16#include <ove/time.h>
17#include <ove/types.hpp>
18#include <ove/error.hpp>
19
20#ifdef CONFIG_OVE_TIME
21
22namespace ove::time
23{
24
37[[nodiscard]] inline Result<uint64_t> get_us() noexcept
38{
39 uint64_t out = 0;
40 const int rc = ove_time_get_us(&out);
41 return from_rc(rc, out);
42}
43
48inline void delay_ms(uint32_t ms)
49{
50 ove_time_delay_ms(ms);
51}
52
57inline void delay_us(uint32_t us)
58{
59 ove_time_delay_us(us);
60}
61
62} /* namespace ove::time */
63
64#endif /* CONFIG_OVE_TIME */
Strong ove::Error type, Result<T> alias, and std::error_code interop for the oveRTOS C++ binding.
Thin C++ wrappers around the oveRTOS time and delay API.
Definition time.hpp:23
void delay_us(uint32_t us)
Blocks the calling task for at least the specified number of microseconds.
Definition time.hpp:57
void delay_ms(uint32_t ms)
Blocks the calling task for at least the specified number of milliseconds.
Definition time.hpp:48
Result< uint64_t > get_us() noexcept
Returns the current system time in microseconds.
Definition time.hpp:37
Result< void > from_rc(int rc) noexcept
Lifts a substrate rc-code into a Result<void>.
Definition error.hpp:254
std::expected< T, Error > Result
std::expected-based result alias.
Definition error.hpp:139
Common type definitions and concepts for the C++ wrapper layer.