oveRTOS C++ API
C++20 RAII wrappers for the oveRTOS C API
Loading...
Searching...
No Matches
console.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/console.h>
17#include <ove/types.hpp>
18
19#ifdef CONFIG_OVE_CONSOLE
20
21namespace ove {
22
30namespace console {
31
36inline int init() {
37 return ove_console_init();
38}
39
40/* Some C libraries (NuttX, glibc) define getchar/putchar as macros;
41 undefine them so the C++ inline wrappers compile cleanly. */
42#ifdef getchar
43#undef getchar
44#endif
45#ifdef putchar
46#undef putchar
47#endif
48
54inline int getchar() {
55 return ove_console_getchar();
56}
57
62inline void putchar(int c) {
63 ove_console_putchar(c);
64}
65
71inline void write(const char *data, unsigned int len) {
72 ove_console_write(data, len);
73}
74
75} /* namespace console */
76
77} /* namespace ove */
78
79#endif /* CONFIG_OVE_CONSOLE */
void write(const char *data, unsigned int len)
Writes a buffer of bytes to the console output.
Definition console.hpp:71
int getchar()
Reads one character from the console, blocking until one is available.
Definition console.hpp:54
int init()
Initialises the console subsystem.
Definition console.hpp:36
void putchar(int c)
Writes a single character to the console output.
Definition console.hpp:62
Top-level namespace for all oveRTOS C++ abstractions.
Definition app.hpp:19
Common type definitions and concepts for the C++ wrapper layer.