|
CDC Badge OS
Firmware for the CDC Badge v1.0 hardware security key
|
Shared RAII wrappers for firmware resources. More...
#include "esp_heap_caps.h"#include "freertos/FreeRTOS.h"#include "freertos/semphr.h"#include "nvs.h"#include <cstddef>#include <cstdint>#include <cstdio>#include <cstdlib>#include <memory>Go to the source code of this file.
Classes | |
| struct | cdc::core::CapsFreeDeleter |
| Deleter for buffers allocated via heap_caps_malloc. More... | |
| struct | cdc::core::CStdFreeDeleter |
| Deleter for buffers allocated via malloc/realloc. More... | |
| struct | cdc::core::FileCloseDeleter |
| Deleter for FILE* opened with std::fopen. More... | |
| class | cdc::core::NvsScope |
| RAII wrapper for an NVS handle. More... | |
| class | cdc::core::MutexGuard |
| RAII wrapper for a FreeRTOS semaphore / mutex. More... | |
| class | cdc::core::RecursiveMutexGuard |
| Scoped guard for a FreeRTOS recursive mutex. More... | |
Namespaces | |
| namespace | cdc |
| namespace | cdc::core |
Typedefs | |
| template<typename T> | |
| using | cdc::core::PsramUniquePtr = std::unique_ptr<T[], CapsFreeDeleter> |
| template<typename T> | |
| using | cdc::core::CStdUniquePtr = std::unique_ptr<T, CStdFreeDeleter> |
| unique_ptr for buffers allocated via realloc/malloc (e.g. esp_http_client body chunks). | |
| using | cdc::core::FilePtr = std::unique_ptr<std::FILE, FileCloseDeleter> |
| unique_ptr for FILE* handles. Destructor calls std::fclose. | |
Functions | |
| template<typename T> | |
| PsramUniquePtr< T > | cdc::core::psramAlloc (std::size_t count) noexcept |
Allocate count elements of T in PSRAM (8-bit capable region). | |
| FilePtr | cdc::core::openFile (const char *path, const char *mode) noexcept |
| Open a FILE* and wrap it in a FilePtr. | |
Shared RAII wrappers for firmware resources.
Single source of truth for resource ownership across the codebase. Each type wraps a raw handle so destructors run on every exit path and manual cleanup pairs disappear. Mirrors Rust's Box<T> + Drop idiom: ownership is unique, copying is forbidden, moving transfers the handle.
Definition in file Raii.h.