oveRTOS C++ API
C++20 RAII wrappers for the oveRTOS C API
Loading...
Searching...
No Matches
nvs.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/nvs.h>
17#include <ove/types.hpp>
18
19#ifdef CONFIG_OVE_NVS
20
21namespace ove {
22
30namespace nvs {
31
36[[nodiscard]] inline int init() {
37 return ove_nvs_init();
38}
39
43inline void deinit() {
44 ove_nvs_deinit();
45}
46
55[[nodiscard]] inline int read(const char *key, void *buf, size_t len,
56 size_t *out) {
57 return ove_nvs_read(key, buf, len, out);
58}
59
67[[nodiscard]] inline int write(const char *key, const void *data,
68 size_t len) {
69 return ove_nvs_write(key, data, len);
70}
71
77[[nodiscard]] inline int erase(const char *key) {
78 return ove_nvs_erase(key);
79}
80
81} /* namespace nvs */
82
83} /* namespace ove */
84
85#endif /* CONFIG_OVE_NVS */
int write(const char *key, const void *data, size_t len)
Writes a value associated with a key to NVS.
Definition nvs.hpp:67
void deinit()
Deinitialises the NVS subsystem and frees associated resources.
Definition nvs.hpp:43
int erase(const char *key)
Erases the value associated with a key from NVS.
Definition nvs.hpp:77
int init()
Initialises the NVS subsystem.
Definition nvs.hpp:36
int read(const char *key, void *buf, size_t len, size_t *out)
Reads the value associated with a key from NVS.
Definition nvs.hpp:55
Top-level namespace for all oveRTOS C++ abstractions.
Definition app.hpp:19
Common type definitions and concepts for the C++ wrapper layer.