idfxx 1.0.0
Modern C++23 components for ESP-IDF
Loading...
Searching...
No Matches

Namespaces

namespace  app
 
namespace  chrono
 ESP-IDF C++ chrono utilities.
 
namespace  console
 
namespace  ds18x20
 DS18x20 1-Wire temperature sensor classes and utilities.
 
namespace  http
 
namespace  i2c
 I2C master driver classes.
 
namespace  lcd
 LCD driver classes.
 
namespace  log
 
namespace  net
 
namespace  netif
 
namespace  onewire
 1-Wire bus protocol classes and utilities.
 
namespace  ota
 
namespace  pwm
 
namespace  spi
 SPI driver classes.
 
namespace  wifi
 

Classes

class  button
 GPIO push-button with debounce, click, long press, and autorepeat support. More...
 
struct  caps_allocator
 STL-compatible allocator for capability-based memory regions. More...
 
class  chip_info
 Chip identification and hardware information. More...
 
class  error_category
 Error category for IDFXX and ESP-IDF error codes. More...
 
struct  event
 A typed event that pairs an event ID with its data type. More...
 
class  event_base
 Typed event base template. More...
 
class  event_group
 Type-safe inter-task event group for bit-level synchronization. More...
 
class  event_loop
 Base class for event loops. More...
 
class  flags
 Type-safe set of flags from a scoped enum. More...
 
class  gpio
 A GPIO pin. More...
 
struct  heap_block
 Information about a single heap block, passed to heap walk callbacks. More...
 
struct  heap_info
 Heap region statistics. More...
 
struct  heap_region
 Information about a heap region, passed to heap walk callbacks. More...
 
class  mac_address
 A MAC-48 (6-byte) hardware address. More...
 
class  nvs
 Non-Volatile Storage handle. More...
 
class  partition
 A flash partition. More...
 
class  queue
 Type-safe inter-task message queue. More...
 
class  random_device
 Hardware random number generator satisfying UniformRandomBitGenerator. More...
 
class  rotary_encoder
 Incremental rotary encoder driver. More...
 
class  task
 Task lifecycle management. More...
 
class  task_priority
 Type-safe wrapper for FreeRTOS task priority values. More...
 
class  timer
 High-resolution timer with microsecond precision. More...
 
class  user_event_loop
 User-created event loop with manual dispatch. More...
 

Concepts

concept  has_factory
 Concept for types that provide a static make() factory method returning result<T>.
 
concept  flag_enum
 Concept for enums that have opted into flag operators.
 
concept  receivable_event_data
 Concept for types that can be received as event data.
 
concept  event_data
 Concept for types that can be both received and posted as event data.
 

Typedefs

template<typename T >
using result = std::expected< T, std::error_code >
 result type wrapping a value or error code.
 
template<typename T >
using dram_allocator = caps_allocator< T, memory_caps::dram >
 STL-compatible allocator for internal DRAM.
 
template<typename T >
using spiram_allocator = caps_allocator< T, memory_caps::spiram >
 STL-compatible allocator for external PSRAM (SPI RAM).
 
template<typename T >
using dma_allocator = caps_allocator< T, memory_caps::dma >
 STL-compatible allocator for DMA-capable memory.
 
template<typename T , size_t Alignment>
using aligned_dram_allocator = caps_allocator< T, memory_caps::dram, Alignment >
 STL-compatible aligned allocator for internal DRAM.
 
template<typename T , size_t Alignment>
using aligned_spiram_allocator = caps_allocator< T, memory_caps::spiram, Alignment >
 STL-compatible aligned allocator for external PSRAM (SPI RAM).
 
template<typename T , size_t Alignment>
using aligned_dma_allocator = caps_allocator< T, memory_caps::dma, Alignment >
 STL-compatible aligned allocator for DMA-capable memory.
 
template<typename DataType >
using event_handler = typename event_handler_traits< DataType >::type
 Handler type for typed event listeners.
 
template<typename IdEnum >
using opaque_event_handler = std::move_only_function< void(event_base< IdEnum > base, IdEnum id, void *event_data) const >
 Callback type for wildcard event listeners.
 
using intr_levels = flags< intr_level >
 A set of interrupt priority levels.
 

Enumerations

enum class  core_id : unsigned int { core_id::core_0 = 0 }
 Identifies a specific CPU core. More...
 
enum class  errc : esp_err_t {
  fail = -1 ,
  invalid_arg = 0x102 ,
  invalid_state = 0x103 ,
  invalid_size = 0x104 ,
  not_found = 0x105 ,
  not_supported = 0x106 ,
  timeout = 0x107 ,
  invalid_response = 0x108 ,
  invalid_crc = 0x109 ,
  invalid_version = 0x10A ,
  invalid_mac = 0x10B ,
  not_finished = 0x10C ,
  not_allowed = 0x10D
}
 IDFXX error codes. More...
 
enum class  memory_caps : uint32_t {
  memory_caps::exec = MALLOC_CAP_EXEC ,
  memory_caps::access_32bit = MALLOC_CAP_32BIT ,
  memory_caps::access_8bit = MALLOC_CAP_8BIT ,
  memory_caps::dma = MALLOC_CAP_DMA ,
  memory_caps::spiram = MALLOC_CAP_SPIRAM ,
  memory_caps::internal = MALLOC_CAP_INTERNAL ,
  memory_caps::default_heap = MALLOC_CAP_DEFAULT ,
  memory_caps::iram = MALLOC_CAP_IRAM_8BIT ,
  memory_caps::retention = MALLOC_CAP_RETENTION ,
  memory_caps::rtc = MALLOC_CAP_RTCRAM ,
  memory_caps::dma_desc_ahb = MALLOC_CAP_DMA_DESC_AHB ,
  memory_caps::dma_desc_axi = MALLOC_CAP_DMA_DESC_AXI ,
  memory_caps::cache_aligned = MALLOC_CAP_CACHE_ALIGNED ,
  memory_caps::dram = internal | access_8bit
}
 Memory capability flags for heap allocations. More...
 
enum class  reset_reason : int {
  reset_reason::unknown = 0 ,
  reset_reason::power_on = 1 ,
  reset_reason::external = 2 ,
  reset_reason::software = 3 ,
  reset_reason::panic = 4 ,
  reset_reason::interrupt_watchdog = 5 ,
  reset_reason::task_watchdog = 6 ,
  reset_reason::watchdog = 7 ,
  reset_reason::deep_sleep = 8 ,
  reset_reason::brownout = 9 ,
  reset_reason::sdio = 10 ,
  reset_reason::usb = 11 ,
  reset_reason::jtag = 12 ,
  reset_reason::efuse = 13 ,
  reset_reason::power_glitch = 14 ,
  reset_reason::cpu_lockup = 15
}
 Reason for the most recent chip reset. More...
 
enum class  uart_port : int {
  uart_port::uart0 = UART_NUM_0 ,
  uart_port::uart1 = UART_NUM_1
}
 Identifies a UART port. More...
 
enum class  wait_mode {
  wait_mode::any ,
  wait_mode::all
}
 Specifies whether to wait for any or all of the requested bits. More...
 
enum class  chip_model : int {
  chip_model::esp32 = 1 ,
  chip_model::esp32s2 = 2 ,
  chip_model::esp32s3 = 9 ,
  chip_model::esp32c3 = 5 ,
  chip_model::esp32c2 = 12 ,
  chip_model::esp32c6 = 13 ,
  chip_model::esp32h2 = 16 ,
  chip_model::esp32p4 = 18 ,
  chip_model::esp32c5 = 23 ,
  chip_model::esp32c61 = 20
}
 Identifies the ESP chip model. More...
 
enum class  chip_feature : uint32_t {
  chip_feature::embedded_flash = 1u << 0 ,
  chip_feature::wifi = 1u << 1 ,
  chip_feature::ble = 1u << 4 ,
  chip_feature::bt_classic = 1u << 5 ,
  chip_feature::ieee802154 = 1u << 6 ,
  chip_feature::embedded_psram = 1u << 7
}
 Hardware feature flags for chip capabilities. More...
 
enum class  intr_level : int {
  level_1 = 1u << 1 ,
  level_2 = 1u << 2 ,
  level_3 = 1u << 3 ,
  level_4 = 1u << 4 ,
  level_5 = 1u << 5 ,
  level_6 = 1u << 6 ,
  nmi = 1u << 7
}
 Hardware interrupt priority levels. More...
 
enum class  intr_flag : int {
  none = 0 ,
  shared = 1u << 8 ,
  edge = 1u << 9 ,
  iram = 1u << 10 ,
  disabled = 1u << 11
}
 Interrupt behavioral flags. More...
 
enum class  mac_type : int {
  mac_type::wifi_sta = 0 ,
  mac_type::wifi_softap = 1 ,
  mac_type::bt = 2 ,
  mac_type::ethernet = 3 ,
  mac_type::base = 5 ,
  mac_type::efuse_factory = 6 ,
  mac_type::efuse_custom = 7
}
 Identifies which network interface a MAC address belongs to. More...
 

Functions

std::string to_string (core_id c)
 Returns a string representation of a CPU core identifier.
 
std::string to_string (task_priority p)
 Returns a string representation of a task priority.
 
const error_categorydefault_category () noexcept
 Returns a reference to the IDFXX error category singleton.
 
std::error_code make_error_code (errc e) noexcept
 Creates a std::error_code from an idfxx::errc value.
 
std::error_code make_error_code (esp_err_t e)
 Creates a std::error_code from a general esp_err_t value.
 
template<typename T , typename... Args>
requires has_factory<T, Args...>
result< std::unique_ptr< T > > make_unique (Args &&... args)
 Constructs a T via its make() factory and wraps it in a std::unique_ptr.
 
template<typename E >
requires std::is_error_code_enum_v<E>
constexpr std::unexpected< std::error_code > error (E e) noexcept
 Creates an unexpected error from an error code enum.
 
template<typename E >
requires std::is_error_condition_enum_v<E>
constexpr std::unexpected< std::error_code > error (E e) noexcept
 Creates an unexpected error from an error condition enum.
 
std::unexpected< std::error_code > error (esp_err_t e)
 Creates an unexpected error from an esp_err_t value.
 
std::unexpected< std::error_code > error (std::error_code ec) noexcept
 Creates an unexpected error from a std::error_code.
 
result< voidwrap (esp_err_t e)
 Wraps an esp_err_t into a result<void>.
 
template<typename T >
T unwrap (result< T > result)
 Throws a std::system_error if the result is an error.
 
template<>
void unwrap (result< void > result)
 
template<typename T , typename Callback >
requires std::invocable<Callback, std::error_code> && std::same_as<std::invoke_result_t<Callback, std::error_code>, void>
void abort_on_error (result< T > result, Callback &&on_error)
 Aborts the program if the result contains an error.
 
template<typename T >
void abort_on_error (result< T > result)
 Aborts the program if the result contains an error.
 
template<flag_enum E>
 flags (E) -> flags< E >
 Class template argument deduction guide.
 
template<flag_enum E>
constexpr flags< Eoperator| (E a, E b) noexcept
 Combines two enum values into a flags object.
 
template<flag_enum E>
constexpr flags< Eoperator& (E a, E b) noexcept
 Intersects two enum values into a flags object.
 
template<flag_enum E>
constexpr flags< Eoperator^ (E a, E b) noexcept
 Toggles two enum values into a flags object.
 
template<flag_enum E>
constexpr flags< Eoperator~ (E a) noexcept
 Computes the bitwise complement of an enum value.
 
template<flag_enum E>
constexpr auto to_underlying (flags< E > f) noexcept
 Returns the underlying integral value of a flags object.
 
template<flag_enum E>
std::string to_string (flags< E > f)
 Returns a hexadecimal string representation of a flags value.
 
size_t heap_total_size (flags< memory_caps > caps) noexcept
 Returns the total size of heap regions matching the given capabilities.
 
size_t heap_free_size (flags< memory_caps > caps) noexcept
 Returns the current free size of heap regions matching the given capabilities.
 
size_t heap_largest_free_block (flags< memory_caps > caps) noexcept
 Returns the largest free block in heap regions matching the given capabilities.
 
size_t heap_minimum_free_size (flags< memory_caps > caps) noexcept
 Returns the minimum free size since boot for heap regions matching the given capabilities.
 
heap_info get_heap_info (flags< memory_caps > caps) noexcept
 Returns detailed heap statistics for regions matching the given capabilities.
 
voidheap_malloc (size_t size, flags< memory_caps > caps) noexcept
 Allocates memory from heap regions matching the given capabilities.
 
voidheap_calloc (size_t n, size_t size, flags< memory_caps > caps) noexcept
 Allocates zero-initialized memory from heap regions matching the given capabilities.
 
voidheap_realloc (void *ptr, size_t size, flags< memory_caps > caps) noexcept
 Reallocates memory from heap regions matching the given capabilities.
 
void heap_free (void *ptr) noexcept
 Frees memory previously allocated by heap allocation functions.
 
voidheap_aligned_alloc (size_t alignment, size_t size, flags< memory_caps > caps) noexcept
 Allocates aligned memory from heap regions matching the given capabilities.
 
voidheap_aligned_calloc (size_t alignment, size_t n, size_t size, flags< memory_caps > caps) noexcept
 Allocates aligned, zero-initialized memory from heap regions matching the given capabilities.
 
template<typename T , typename U , flags< memory_caps > Caps, size_t Alignment>
constexpr bool operator== (const caps_allocator< T, Caps, Alignment > &, const caps_allocator< U, Caps, Alignment > &) noexcept
 Equality comparison for caps_allocator.
 
template<typename F >
void heap_walk (flags< memory_caps > caps, F &&walker)
 Walk all heap blocks in regions matching the given capabilities.
 
template<typename F >
void heap_walk_all (F &&walker)
 Walk all heap blocks across all heaps.
 
bool heap_check_integrity (flags< memory_caps > caps, bool print_errors=false) noexcept
 Check integrity of all heaps with the given capabilities.
 
bool heap_check_integrity_all (bool print_errors=false) noexcept
 Check integrity of all heaps.
 
void heap_dump (flags< memory_caps > caps) noexcept
 Dump the structure of all heaps with matching capabilities.
 
void heap_dump_all () noexcept
 Dump the structure of all heaps.
 
std::string to_string (net::ip4_addr addr)
 Returns the dotted-decimal string representation of an IPv4 address.
 
std::string to_string (net::ip6_addr addr)
 Returns the string representation of an IPv6 address.
 
std::string to_string (net::ip4_info info)
 Returns the string representation of IPv4 network information.
 
uint32_t random () noexcept
 Returns a hardware-generated random 32-bit value.
 
void fill_random (std::span< uint8_t > buf) noexcept
 Fills a buffer with hardware-generated random bytes.
 
void fill_random (std::span< std::byte > buf) noexcept
 Fills a buffer with hardware-generated random bytes.
 
template<typename Rep , typename Period >
void delay (const std::chrono::duration< Rep, Period > &duration)
 Delay for the specified duration.
 
template<typename Clock , typename Duration >
void delay_until (const std::chrono::time_point< Clock, Duration > &target)
 Delays until the specified time point.
 
void yield () noexcept
 Yields execution to other ready tasks of equal priority.
 
void yield_from_isr (bool higher_priority_task_woken=true) noexcept
 Requests a context switch from ISR context.
 
std::string to_string (reset_reason r)
 Returns a string representation of a reset reason.
 
reset_reason last_reset_reason () noexcept
 Returns the reason for the most recent chip reset.
 
void restart ()
 Restart the chip immediately.
 
void register_shutdown_handler (void(*handler)())
 Registers a function to be called during chip shutdown/restart.
 
void unregister_shutdown_handler (void(*handler)())
 Unregisters a previously registered shutdown handler.
 
result< voidtry_register_shutdown_handler (void(*handler)())
 Registers a function to be called during chip shutdown/restart.
 
result< voidtry_unregister_shutdown_handler (void(*handler)())
 Unregisters a previously registered shutdown handler.
 
std::size_t free_heap_size () noexcept
 Returns the current free heap size in bytes.
 
std::size_t free_internal_heap_size () noexcept
 Returns the current free internal heap size in bytes.
 
std::size_t minimum_free_heap_size () noexcept
 Returns the minimum free heap size recorded since boot.
 
std::string to_string (uart_port p)
 Returns a string representation of a UART port identifier.
 
result< voidtry_configure_gpios (const gpio::config &cfg, std::vector< gpio > gpios)
 Configures multiple GPIOs with the same settings.
 
template<typename... Gpios>
result< voidtry_configure_gpios (const gpio::config &cfg, Gpios &&... gpios)
 Configures multiple GPIOs with the same settings.
 
void configure_gpios (const gpio::config &cfg, std::vector< gpio > gpios)
 Configures multiple GPIOs with the same settings.
 
template<typename... Gpios>
void configure_gpios (const gpio::config &cfg, Gpios &&... gpios)
 Configures multiple GPIOs with the same settings.
 
std::string to_string (gpio g)
 Returns a string representation of a GPIO pin.
 
std::string to_string (gpio::level l)
 Returns a string representation of a GPIO level.
 
constexpr gpio::level operator~ (gpio::level l) noexcept
 Inverts a GPIO level.
 
std::string to_string (http::method m)
 Returns a string representation of an HTTP method.
 
std::string to_string (http::auth_type t)
 Returns a string representation of an HTTP authentication type.
 
std::string to_string (http::transport t)
 Returns a string representation of an HTTP transport type.
 
std::string to_string (http::event_id id)
 Returns a string representation of an HTTP event identifier.
 
std::string to_string (chip_model m)
 Returns a string representation of a chip model.
 
std::string to_string (const mac_address &addr)
 Returns a colon-separated string representation of a MAC address.
 
mac_address read_mac (mac_type type)
 Reads the MAC address for a specific interface.
 
mac_address base_mac_address ()
 Returns the base MAC address.
 
result< mac_addresstry_read_mac (mac_type type)
 Reads the MAC address for a specific interface.
 
result< mac_addresstry_base_mac_address ()
 Returns the base MAC address.
 
void set_base_mac_address (const mac_address &addr)
 Sets the base MAC address.
 
void set_interface_mac_address (const mac_address &addr, mac_type type)
 Sets the MAC address for a specific interface.
 
result< voidtry_set_base_mac_address (const mac_address &addr)
 Sets the base MAC address.
 
result< voidtry_set_interface_mac_address (const mac_address &addr, mac_type type)
 Sets the MAC address for a specific interface.
 
result< mac_addresstry_default_mac ()
 Returns the factory MAC address from eFuse.
 
result< mac_addresstry_custom_mac ()
 Returns the custom MAC address from eFuse.
 
result< mac_addresstry_derive_local_mac (const mac_address &universal_mac)
 Derives a local MAC address from a universal MAC address.
 
std::string to_string (i2c::port p)
 Returns a string representation of an I2C port.
 
const netif::error_categorynetif_category () noexcept
 Returns a reference to the netif error category singleton.
 
std::unexpected< std::error_code > netif_error (esp_err_t e)
 Creates an unexpected error from an ESP-IDF error code, mapping to netif error codes where possible.
 
std::string to_string (netif::dns_type t)
 Returns the string representation of a DNS server type.
 
const nvs::error_categorynvs_category () noexcept
 Returns a reference to the NVS error category singleton.
 
std::error_code make_error_code (nvs::errc e) noexcept
 Creates an error code from an idfxx::nvs::errc value.
 
std::unexpected< std::error_code > nvs_error (esp_err_t e)
 Creates an unexpected error from an ESP-IDF error code, mapping to NVS error codes where possible.
 
constexpr enum partition::subtype app_ota (unsigned i)
 Computes an OTA app subtype from a slot index.
 
const wifi::error_categorywifi_category () noexcept
 Returns a reference to the WiFi error category singleton.
 
std::unexpected< std::error_code > wifi_error (esp_err_t e)
 Creates an unexpected error from an ESP-IDF error code, mapping to WiFi error codes where possible.
 
std::string to_string (flags< wifi::role > roles)
 Returns a string representation of active WiFi roles.
 
std::string to_string (wifi::auth_mode m)
 Returns a string representation of a WiFi authentication mode.
 
std::string to_string (wifi::cipher_type c)
 Returns a string representation of a WiFi cipher type.
 
std::string to_string (wifi::disconnect_reason r)
 Returns a string representation of a WiFi disconnect reason.
 

Variables

template<typename E >
constexpr bool enable_flags_operators = false
 Opt-in trait for enabling flag operators on an enum.
 
template<>
constexpr bool enable_flags_operators< memory_caps > = true
 
constexpr intr_levels intr_level_lowmed = intr_level::level_1 | intr_level::level_2 | intr_level::level_3
 Low and medium priority levels (1-3). These can be handled in C / C++.
 
constexpr intr_levels intr_level_high
 High priority levels (4-6 and NMI). These require assembly handlers.
 
constexpr intr_levels intr_level_all = intr_level_lowmed | intr_level_high
 All interrupt levels.
 
GPIO Constants

Predefined GPIO instances for direct use.

Available GPIOs depend on the target chip.

constexpr gpio gpio_nc = gpio_constant<GPIO_NUM_NC>::value
 
constexpr gpio gpio_0 = gpio_constant<0>::value
 
constexpr gpio gpio_1 = gpio_constant<1>::value
 
constexpr gpio gpio_2 = gpio_constant<2>::value
 
constexpr gpio gpio_3 = gpio_constant<3>::value
 
constexpr gpio gpio_4 = gpio_constant<4>::value
 
constexpr gpio gpio_5 = gpio_constant<5>::value
 
constexpr gpio gpio_6 = gpio_constant<6>::value
 
constexpr gpio gpio_7 = gpio_constant<7>::value
 
constexpr gpio gpio_8 = gpio_constant<8>::value
 
constexpr gpio gpio_9 = gpio_constant<9>::value
 
constexpr gpio gpio_10 = gpio_constant<10>::value
 
constexpr gpio gpio_11 = gpio_constant<11>::value
 
constexpr gpio gpio_12 = gpio_constant<12>::value
 
constexpr gpio gpio_13 = gpio_constant<13>::value
 
constexpr gpio gpio_14 = gpio_constant<14>::value
 
constexpr gpio gpio_15 = gpio_constant<15>::value
 
constexpr gpio gpio_16 = gpio_constant<16>::value
 
constexpr gpio gpio_17 = gpio_constant<17>::value
 
constexpr gpio gpio_18 = gpio_constant<18>::value
 
constexpr gpio gpio_19 = gpio_constant<19>::value
 
constexpr gpio gpio_20 = gpio_constant<20>::value
 
constexpr gpio gpio_21 = gpio_constant<21>::value
 
constexpr gpio gpio_22 = gpio_constant<22>::value
 
constexpr gpio gpio_23 = gpio_constant<23>::value
 
constexpr gpio gpio_24 = gpio_constant<24>::value
 
constexpr gpio gpio_25 = gpio_constant<25>::value
 
constexpr gpio gpio_26 = gpio_constant<26>::value
 
constexpr gpio gpio_27 = gpio_constant<27>::value
 
constexpr gpio gpio_28 = gpio_constant<28>::value
 
constexpr gpio gpio_29 = gpio_constant<29>::value
 
constexpr gpio gpio_30 = gpio_constant<30>::value
 
constexpr gpio gpio_31 = gpio_constant<31>::value
 
constexpr gpio gpio_32 = gpio_constant<32>::value
 
constexpr gpio gpio_33 = gpio_constant<33>::value
 
constexpr gpio gpio_34 = gpio_constant<34>::value
 
constexpr gpio gpio_35 = gpio_constant<35>::value
 
constexpr gpio gpio_36 = gpio_constant<36>::value
 
constexpr gpio gpio_37 = gpio_constant<37>::value
 
constexpr gpio gpio_38 = gpio_constant<38>::value
 
constexpr gpio gpio_39 = gpio_constant<39>::value
 
constexpr gpio gpio_40 = gpio_constant<40>::value
 
constexpr gpio gpio_41 = gpio_constant<41>::value
 
constexpr gpio gpio_42 = gpio_constant<42>::value
 
constexpr gpio gpio_43 = gpio_constant<43>::value
 
constexpr gpio gpio_44 = gpio_constant<44>::value
 
constexpr gpio gpio_45 = gpio_constant<45>::value
 
constexpr gpio gpio_46 = gpio_constant<46>::value
 
constexpr gpio gpio_47 = gpio_constant<47>::value
 
constexpr gpio gpio_48 = gpio_constant<48>::value
 

Typedef Documentation

◆ intr_levels

A set of interrupt priority levels.

Definition at line 55 of file intr_alloc.hpp.

◆ result

template<typename T >
using idfxx::result = typedef std::expected<T, std::error_code>

result type wrapping a value or error code.

Template Parameters
TThe success value type.

Definition at line 120 of file error.hpp.

Enumeration Type Documentation

◆ errc

IDFXX error codes.

These error codes are compatible with ESP-IDF error codes and can be used with std::error_code through the IDFXX error category.

Enumerator
fail 

Generic failure.

invalid_arg 

Invalid argument.

invalid_state 

Invalid state.

invalid_size 

Invalid size.

not_found 

Requested resource not found.

not_supported 

Operation or feature not supported.

timeout 

Operation timed out.

invalid_response 

Received response was invalid.

invalid_crc 

CRC or checksum was invalid.

invalid_version 

Version was invalid.

invalid_mac 

MAC address was invalid.

not_finished 

Operation has not fully completed.

not_allowed 

Operation is not allowed.

Definition at line 46 of file error.hpp.

◆ intr_flag

Interrupt behavioral flags.

Type-safe interrupt behavioral flags. These control sharing behavior and handler requirements, but not priority levels.

Bit values occupy bits 8-11, which do not overlap with intr_level values (bits 1-7), so they can be safely combined via to_underlying(levels) | to_underlying(flags).

Enumerator
none 

No flags / default.

shared 

Interrupt can be shared between ISRs.

edge 

Edge-triggered interrupt.

iram 

ISR can be called if cache is disabled.

disabled 

Return from ISR with interrupts disabled.

Definition at line 78 of file intr_alloc.hpp.

◆ intr_level

Hardware interrupt priority levels.

Type-safe interrupt priority levels using bit-flag encoding for use with intr_levels. Priority levels 1-3 (low/medium) can use C / C++ handlers. Levels 4-6 and NMI require assembly handlers and must pass NULL as the handler function.

Bit values match the ESP_INTR_FLAG_LEVEL* constants, occupying bits 1-7. These do not overlap with intr_flag values (bits 8-11), so they can be safely combined via to_underlying(levels) | to_underlying(flags).

Enumerator
level_1 

Level 1 interrupt (lowest priority)

level_2 

Level 2 interrupt.

level_3 

Level 3 interrupt.

level_4 

Level 4 interrupt.

level_5 

Level 5 interrupt.

level_6 

Level 6 interrupt.

nmi 

Level 7 / NMI (highest priority)

Definition at line 37 of file intr_alloc.hpp.

Function Documentation

◆ abort_on_error() [1/2]

template<typename T >
void idfxx::abort_on_error ( result< T result)
inline

Aborts the program if the result contains an error.

Template Parameters
TThe success value type.
Parameters
resultThe result to check.

Definition at line 359 of file error.hpp.

◆ abort_on_error() [2/2]

template<typename T , typename Callback >
requires std::invocable<Callback, std::error_code> && std::same_as<std::invoke_result_t<Callback, std::error_code>, void>
void idfxx::abort_on_error ( result< T result,
Callback &&  on_error 
)
inline

Aborts the program if the result contains an error.

This overload invokes an optional callback before aborting, allowing for error logging or cleanup. The callback is invoked inline without type erasure, enabling zero-overhead error handling.

Warning
For std::function or std::move_only_function, ensure the callback is not null to avoid std::bad_function_call.
Template Parameters
TThe success value type.
CallbackThe callback type (deduced).
Parameters
resultThe result to check.
on_errorFunction called with the error code before aborting. Must be a valid callable (not null for function wrappers).

Definition at line 337 of file error.hpp.

◆ app_ota()

constexpr enum partition::subtype idfxx::app_ota ( unsigned  i)
constexpr

Computes an OTA app subtype from a slot index.

Parameters
iOTA slot index (0-15).
Returns
The corresponding app OTA subtype.

Definition at line 516 of file partition.hpp.

◆ default_category()

const error_category & idfxx::default_category ( )
noexcept

Returns a reference to the IDFXX error category singleton.

This follows the standard library pattern (like std::generic_category()).

Returns
Reference to the singleton error_category instance.

Referenced by make_error_code().

◆ error() [1/4]

template<typename E >
requires std::is_error_code_enum_v<E>
constexpr std::unexpected< std::error_code > idfxx::error ( E  e)
constexprnoexcept

Creates an unexpected error from an error code enum.

Convenience helper for returning errors from functions that return idfxx::result<T>. Works with any registered error code enum (idfxx::errc, nvs::errc, etc.) via ADL make_error_code.

Template Parameters
EAn error code enum type registered via std::is_error_code_enum.
Parameters
eThe error code enum value.
Returns
An unexpected value suitable for returning from result-returning functions.
}
return 42;
}
constexpr std::unexpected< std::error_code > error(E e) noexcept
Creates an unexpected error from an error code enum.
Definition error.hpp:187
@ invalid_state
Invalid state.
std::expected< T, std::error_code > result
result type wrapping a value or error code.
Definition error.hpp:120

Definition at line 187 of file error.hpp.

Referenced by idfxx::queue< T >::make(), make_unique(), idfxx::event_loop::try_listener_add(), idfxx::event_loop::try_listener_add(), idfxx::i2c::master_device::try_probe(), idfxx::timer::try_restart(), idfxx::user_event_loop::try_run(), idfxx::pwm::timer::try_set_period(), idfxx::timer::try_start_once(), idfxx::timer::try_start_once(), idfxx::timer::try_start_once(), idfxx::timer::try_start_once(), idfxx::timer::try_start_once(), idfxx::timer::try_start_once(), idfxx::timer::try_start_periodic(), idfxx::timer::try_start_periodic(), idfxx::timer::try_start_periodic(), idfxx::timer::try_stop(), and wrap().

◆ error() [2/4]

template<typename E >
requires std::is_error_condition_enum_v<E>
constexpr std::unexpected< std::error_code > idfxx::error ( E  e)
constexprnoexcept

Creates an unexpected error from an error condition enum.

Convenience helper for returning errors from functions that return idfxx::result<T>. Works with any registered error condition enum (std::errc, etc.) via ADL make_error_code.

Template Parameters
EAn error condition enum type registered via std::is_error_condition_enum.
Parameters
eThe error condition enum value.
Returns
An unexpected value suitable for returning from result-returning functions.
idfxx::result<void> try_lock() {
return idfxx::error(std::errc::resource_deadlock_would_occur);
}
return {};
}

Definition at line 213 of file error.hpp.

References make_error_code().

◆ error() [3/4]

std::unexpected< std::error_code > idfxx::error ( esp_err_t  e)
inline

Creates an unexpected error from an esp_err_t value.

Convenience helper for returning errors from functions that return idfxx::result<T>. Converts the ESP-IDF error code to a std::error_code using make_error_code.

Throws std::bad_alloc (or aborts) on ESP_ERR_NO_MEM.

Parameters
eThe ESP-IDF error code.
Returns
An unexpected value suitable for returning from result-returning functions.

Definition at line 250 of file error.hpp.

References make_error_code().

◆ error() [4/4]

std::unexpected< std::error_code > idfxx::error ( std::error_code  ec)
inlinenoexcept

Creates an unexpected error from a std::error_code.

Convenience helper for propagating errors between result types with different value types.

Parameters
ecThe error code.
Returns
An unexpected value suitable for returning from result-returning functions.
if (!r) {
return idfxx::error(r.error());
}
return 42;
}

Definition at line 273 of file error.hpp.

◆ flags()

template<flag_enum E>
idfxx::flags ( E  ) -> flags< E >

Class template argument deduction guide.

Allows flags to be constructed without explicit template arguments:

auto f = flags{my_flags::read}; // deduces flags<my_flags>
Type-safe set of flags from a scoped enum.
Definition flags.hpp:88

◆ make_error_code() [1/3]

std::error_code idfxx::make_error_code ( errc  e)
inlinenoexcept

Creates a std::error_code from an idfxx::errc value.

Definition at line 101 of file error.hpp.

References default_category().

Referenced by error(), error(), and idfxx::wifi::make_error_code().

◆ make_error_code() [2/3]

std::error_code idfxx::make_error_code ( esp_err_t  e)

Creates a std::error_code from a general esp_err_t value.

Maps common ESP-IDF error codes to corresponding idfxx::errc values, or returns an std::error_code with idfxx::errc::fail for unknown ESP-IDF error codes. Throws std::bad_alloc (or aborts) on ESP_ERR_NO_MEM.

◆ make_error_code() [3/3]

std::error_code idfxx::make_error_code ( nvs::errc  e)
inlinenoexcept

Creates an error code from an idfxx::nvs::errc value.

Definition at line 363 of file nvs.hpp.

References nvs_category().

◆ make_unique()

template<typename T , typename... Args>
requires has_factory<T, Args...>
result< std::unique_ptr< T > > idfxx::make_unique ( Args &&...  args)

Constructs a T via its make() factory and wraps it in a std::unique_ptr.

Convenience helper for obtaining heap-allocated, polymorphically usable objects from result-based factory methods.

Template Parameters
TThe type to construct. Must have a static make() method returning result<T>.
ArgsThe argument types forwarded to T::make().
Parameters
argsArguments forwarded to T::make().
Returns
A result containing a unique_ptr<T>, or an error.
auto r = idfxx::make_unique<ili9341>(panel_io, config);
if (r) {
std::unique_ptr<panel> p = std::move(*r);
}

Definition at line 157 of file error.hpp.

References error().

◆ netif_category()

const netif::error_category & idfxx::netif_category ( )
noexcept

Returns a reference to the netif error category singleton.

Returns
Reference to the singleton netif::error_category instance.

Referenced by idfxx::netif::make_error_code().

◆ netif_error()

std::unexpected< std::error_code > idfxx::netif_error ( esp_err_t  e)

Creates an unexpected error from an ESP-IDF error code, mapping to netif error codes where possible.

Converts the ESP-IDF error code to a netif-specific error code if a mapping exists, otherwise falls back to the default IDFXX error category.

Parameters
eThe ESP-IDF error code.
Returns
An unexpected value suitable for returning from result-returning functions.

◆ nvs_category()

const nvs::error_category & idfxx::nvs_category ( )
noexcept

Returns a reference to the NVS error category singleton.

Returns
Reference to the singleton nvs::error_category instance.

Referenced by make_error_code().

◆ nvs_error()

std::unexpected< std::error_code > idfxx::nvs_error ( esp_err_t  e)

Creates an unexpected error from an ESP-IDF error code, mapping to NVS error codes where possible.

Converts the ESP-IDF error code to an NVS-specific error code if a mapping exists, otherwise falls back to the default IDFXX error category.

Parameters
eThe ESP-IDF error code.
Returns
An unexpected value suitable for returning from result-returning functions.

◆ operator&()

template<flag_enum E>
constexpr flags< E > idfxx::operator& ( E  a,
E  b 
)
constexprnoexcept

Intersects two enum values into a flags object.

Parameters
aFirst flag value.
bSecond flag value.
Returns
A flags object containing the intersection.

Definition at line 307 of file flags.hpp.

◆ operator^()

template<flag_enum E>
constexpr flags< E > idfxx::operator^ ( E  a,
E  b 
)
constexprnoexcept

Toggles two enum values into a flags object.

Parameters
aFirst flag value.
bSecond flag value.
Returns
A flags object with toggled bits.

Definition at line 320 of file flags.hpp.

◆ operator|()

template<flag_enum E>
constexpr flags< E > idfxx::operator| ( E  a,
E  b 
)
constexprnoexcept

Combines two enum values into a flags object.

Enables natural syntax for combining flag enum values without explicitly constructing flags objects.

Parameters
aFirst flag value.
bSecond flag value.
Returns
A flags object containing both flags.

Definition at line 294 of file flags.hpp.

◆ operator~()

template<flag_enum E>
constexpr flags< E > idfxx::operator~ ( E  a)
constexprnoexcept

Computes the bitwise complement of an enum value.

Parameters
aThe flag value to complement.
Returns
A flags object with all bits inverted.

Definition at line 332 of file flags.hpp.

◆ to_string() [1/14]

template<flag_enum E>
std::string idfxx::to_string ( flags< E f)
inline

Returns a hexadecimal string representation of a flags value.

Template Parameters
EThe flag enum type (must satisfy flag_enum concept).
Parameters
fThe flags value to convert.
Returns
A string in the form "0x..." representing the underlying value in hexadecimal.

Definition at line 358 of file flags.hpp.

References to_underlying().

◆ to_string() [2/14]

std::string idfxx::to_string ( flags< wifi::role roles)

Returns a string representation of active WiFi roles.

Parameters
rolesThe active roles.
Returns
"none", "sta", "ap", "sta|ap", or "unknown(N)" for unrecognized values.

◆ to_string() [3/14]

std::string idfxx::to_string ( http::auth_type  t)

Returns a string representation of an HTTP authentication type.

Parameters
tThe authentication type to convert.
Returns
"NONE", "BASIC", "DIGEST", or "unknown(N)" for unrecognized values.

◆ to_string() [4/14]

std::string idfxx::to_string ( http::event_id  id)

Returns a string representation of an HTTP event identifier.

Parameters
idThe event identifier to convert.
Returns
"ERROR", "ON_CONNECTED", etc., or "unknown(N)" for unrecognized values.

References to_string().

◆ to_string() [5/14]

std::string idfxx::to_string ( http::method  m)

Returns a string representation of an HTTP method.

Parameters
mThe HTTP method to convert.
Returns
"GET", "POST", etc., or "unknown(N)" for unrecognized values.

◆ to_string() [6/14]

std::string idfxx::to_string ( http::transport  t)

Returns a string representation of an HTTP transport type.

Parameters
tThe transport type to convert.
Returns
"UNKNOWN", "TCP", "SSL", or "unknown(N)" for unrecognized values.

◆ to_string() [7/14]

std::string idfxx::to_string ( i2c::port  p)
inline

Returns a string representation of an I2C port.

Parameters
pThe port identifier to convert.
Returns
"I2C0", "I2C1" (when available), "LP_I2C0" (when available), or "unknown(N)" for unrecognized values.

Definition at line 1678 of file master.hpp.

References idfxx::i2c::i2c0.

◆ to_string() [8/14]

std::string idfxx::to_string ( net::ip4_addr  addr)

Returns the dotted-decimal string representation of an IPv4 address.

Parameters
addrThe IPv4 address to convert.
Returns
A string like "192.168.1.1".

◆ to_string() [9/14]

std::string idfxx::to_string ( net::ip4_info  info)

Returns the string representation of IPv4 network information.

Parameters
infoThe IP info to convert.
Returns
A string like "ip=192.168.1.1, netmask=255.255.255.0, gw=192.168.1.1".

◆ to_string() [10/14]

std::string idfxx::to_string ( net::ip6_addr  addr)

Returns the string representation of an IPv6 address.

Uses RFC 5952 compressed format with :: for the longest run of zero groups.

Parameters
addrThe IPv6 address to convert.
Returns
A string like "fe80::1".

◆ to_string() [11/14]

std::string idfxx::to_string ( netif::dns_type  t)

Returns the string representation of a DNS server type.

Parameters
tThe DNS type to convert.
Returns
"main", "backup", "fallback", or "unknown(N)".

References to_string().

◆ to_string() [12/14]

std::string idfxx::to_string ( wifi::auth_mode  m)

Returns a string representation of a WiFi authentication mode.

Parameters
mThe authentication mode to convert.
Returns
"OPEN", "WPA2_PSK", etc., or "unknown(N)" for unrecognized values.

◆ to_string() [13/14]

std::string idfxx::to_string ( wifi::cipher_type  c)

Returns a string representation of a WiFi cipher type.

Parameters
cThe cipher type to convert.
Returns
"NONE", "CCMP", etc., or "unknown(N)" for unrecognized values.

◆ to_string() [14/14]

std::string idfxx::to_string ( wifi::disconnect_reason  r)

Returns a string representation of a WiFi disconnect reason.

Parameters
rThe disconnect reason to convert.
Returns
A human-readable reason string, or "unknown(N)" for unrecognized values.

◆ to_underlying()

template<flag_enum E>
constexpr auto idfxx::to_underlying ( flags< E f)
constexprnoexcept

Returns the underlying integral value of a flags object.

Free function equivalent of flags<E>::value().

Template Parameters
EThe flag enum type (must satisfy flag_enum concept).
Parameters
fThe flags value.
Returns
The underlying integral value.

Definition at line 346 of file flags.hpp.

Referenced by idfxx::caps_allocator< T, Caps, Alignment >::allocate(), idfxx::event_group< E >::clear(), idfxx::event_group< E >::clear_from_isr(), get_heap_info(), heap_aligned_alloc(), heap_aligned_calloc(), heap_calloc(), heap_check_integrity(), heap_dump(), heap_free_size(), heap_largest_free_block(), heap_malloc(), heap_minimum_free_size(), heap_realloc(), heap_total_size(), heap_walk(), idfxx::queue< T >::make(), idfxx::queue< T >::queue(), idfxx::event_group< E >::set(), idfxx::event_group< E >::set_from_isr(), and to_string().

◆ unwrap() [1/2]

template<typename T >
T idfxx::unwrap ( result< T result)
inline

Throws a std::system_error if the result is an error.

Template Parameters
TThe success value type.
Parameters
resultThe result to check.
Returns
The success value.
Note
Only available when CONFIG_COMPILER_CXX_EXCEPTIONS is enabled in menuconfig.
Exceptions
std::system_errorif the result is an error.

Definition at line 307 of file error.hpp.

Referenced by idfxx::http::client::close(), idfxx::http::server::close_session(), idfxx::nvs::commit(), idfxx::pwm::timer::configure(), idfxx::pwm::timer::configure(), configure_gpios(), configure_gpios(), idfxx::ds18x20::device::copy_scratchpad(), idfxx::netif::interface::create_ip6_linklocal(), idfxx::event_loop::create_system(), idfxx::netif::deinit(), idfxx::nvs::flash::deinit(), idfxx::nvs::flash::deinit(), idfxx::event_loop::destroy_system(), idfxx::task::detach(), idfxx::netif::interface::dhcp_client_start(), idfxx::netif::interface::dhcp_client_stop(), idfxx::netif::interface::dhcp_server_start(), idfxx::netif::interface::dhcp_server_stop(), idfxx::lcd::panel::display_on(), idfxx::http::request::end_chunked(), idfxx::nvs::flash::erase(), idfxx::nvs::flash::erase(), idfxx::nvs::erase(), idfxx::nvs::flash::erase(), idfxx::nvs::erase_all(), idfxx::partition::erase_range(), idfxx::pwm::output::fade_to(), idfxx::pwm::output::fade_to_duty_ticks(), idfxx::pwm::output::fade_to_pulse_width(), idfxx::pwm::output::fade_with_step(), idfxx::http::client::fetch_headers(), idfxx::http::client::flush_response(), idfxx::nvs::flash::generate_keys(), idfxx::nvs::get_blob(), idfxx::netif::interface::get_dns(), idfxx::gpio::get_drive_capability(), idfxx::netif::interface::get_hostname(), idfxx::netif::interface::get_ip6_global(), idfxx::netif::interface::get_ip6_linklocal(), idfxx::netif::interface::get_mac(), idfxx::ds18x20::device::get_resolution(), idfxx::nvs::get_string(), idfxx::nvs::get_value(), idfxx::gpio::hold_disable(), idfxx::gpio::hold_enable(), idfxx::netif::init(), idfxx::nvs::flash::init(), idfxx::nvs::flash::init(), idfxx::nvs::flash::init(), idfxx::nvs::flash::init(), idfxx::nvs::flash::init(), idfxx::nvs::flash::init(), idfxx::nvs::flash::init(), idfxx::nvs::flash::init(), idfxx::nvs::flash::init(), idfxx::gpio::install_isr_service(), idfxx::gpio::isr_handler_add(), idfxx::gpio::isr_handler_add(), idfxx::gpio::isr_handler_remove(), idfxx::task::join(), idfxx::task::join(), idfxx::task::join_until(), idfxx::task::kill(), idfxx::event_loop::listener_add(), idfxx::event_loop::listener_add(), idfxx::event_loop::listener_remove(), idfxx::ds18x20::device::measure(), idfxx::ds18x20::device::measure_and_read(), idfxx::ds18x20::measure_and_read_multi(), idfxx::lcd::panel::mirror(), idfxx::partition::mmap(), idfxx::netif::interface::napt_enable(), idfxx::task::notify(), idfxx::http::server::on(), idfxx::http::server::on_any(), idfxx::http::server::on_delete(), idfxx::http::server::on_get(), idfxx::http::server::on_head(), idfxx::http::server::on_patch(), idfxx::http::server::on_post(), idfxx::http::server::on_put(), idfxx::http::client::open(), idfxx::pwm::timer::pause(), idfxx::queue< T >::peek(), idfxx::queue< T >::peek(), idfxx::queue< T >::peek_until(), idfxx::http::client::perform(), idfxx::event_loop::post(), idfxx::event_loop::post(), idfxx::event_loop::post(), idfxx::event_loop::post(), idfxx::onewire::bus::power(), idfxx::i2c::master_device::probe(), idfxx::i2c::master_bus::probe(), idfxx::gpio::pulldown_disable(), idfxx::gpio::pulldown_enable(), idfxx::gpio::pullup_disable(), idfxx::gpio::pullup_enable(), idfxx::onewire::bus::read(), idfxx::partition::read(), idfxx::partition::read(), idfxx::http::client::read(), idfxx::http::client::read(), idfxx::onewire::bus::read(), idfxx::partition::read_raw(), idfxx::partition::read_raw(), idfxx::i2c::master_device::read_register(), idfxx::i2c::master_device::read_register(), idfxx::i2c::master_device::read_register(), idfxx::i2c::master_device::read_register(), idfxx::i2c::master_device::read_register(), idfxx::i2c::master_device::read_register(), idfxx::i2c::master_device::read_register(), idfxx::i2c::master_device::read_register(), idfxx::i2c::master_device::read_register(), idfxx::i2c::master_device::read_register(), idfxx::ds18x20::device::read_scratchpad(), idfxx::nvs::flash::read_security_cfg(), idfxx::ds18x20::device::read_temperature(), idfxx::queue< T >::receive(), idfxx::queue< T >::receive(), idfxx::i2c::master_device::receive(), idfxx::i2c::master_device::receive(), idfxx::i2c::master_device::receive(), idfxx::i2c::master_device::receive(), idfxx::i2c::master_device::receive(), idfxx::i2c::master_device::receive(), idfxx::queue< T >::receive_until(), idfxx::http::request::recv(), idfxx::http::request::recv(), idfxx::http::request::recv_body(), idfxx::pwm::timer::reset(), idfxx::timer::restart(), idfxx::pwm::timer::resume(), idfxx::task::resume(), idfxx::user_event_loop::run(), idfxx::ds18x20::scan_devices(), idfxx::onewire::bus::search(), idfxx::onewire::bus::search(), idfxx::onewire::bus::select(), idfxx::queue< T >::send(), idfxx::queue< T >::send(), idfxx::http::request::send(), idfxx::http::request::send(), idfxx::http::request::send_chunk(), idfxx::queue< T >::send_to_front(), idfxx::queue< T >::send_to_front(), idfxx::queue< T >::send_to_front_until(), idfxx::queue< T >::send_until(), idfxx::nvs::set_blob(), idfxx::nvs::set_blob(), idfxx::gpio::set_direction(), idfxx::netif::interface::set_dns(), idfxx::gpio::set_drive_capability(), idfxx::pwm::output::set_duty(), idfxx::pwm::output::set_duty_ticks(), idfxx::pwm::output::set_duty_ticks(), idfxx::pwm::timer::set_frequency(), idfxx::netif::interface::set_hostname(), idfxx::netif::interface::set_ip4_info(), idfxx::netif::interface::set_mac(), idfxx::pwm::timer::set_period(), idfxx::task::set_priority(), idfxx::gpio::set_pull_mode(), idfxx::pwm::output::set_pulse_width(), idfxx::http::client::set_redirection(), idfxx::ds18x20::device::set_resolution(), idfxx::nvs::set_string(), idfxx::http::client::set_url(), idfxx::nvs::set_value(), idfxx::partition::sha256(), idfxx::onewire::bus::skip_rom(), idfxx::gpio::sleep_set_direction(), idfxx::pwm::start(), idfxx::pwm::start(), idfxx::pwm::start(), idfxx::pwm::start(), idfxx::timer::start_once(), idfxx::timer::start_once(), idfxx::timer::start_once(), idfxx::timer::start_once(), idfxx::timer::start_once(), idfxx::timer::start_once(), idfxx::timer::start_periodic(), idfxx::timer::start_periodic(), idfxx::timer::start_periodic(), idfxx::timer::stop(), idfxx::pwm::stop(), idfxx::pwm::output::stop(), idfxx::task::suspend(), idfxx::lcd::panel::swap_xy(), idfxx::event_group< E >::sync(), idfxx::event_group< E >::sync(), idfxx::event_group< E >::sync_until(), idfxx::i2c::master_device::transmit(), idfxx::i2c::master_device::transmit(), idfxx::i2c::master_device::transmit(), idfxx::i2c::master_device::transmit(), idfxx::http::server::unregister_handler(), idfxx::event_group< E >::wait(), idfxx::event_group< E >::wait(), idfxx::event_group< E >::wait_until(), idfxx::gpio::wakeup_disable(), idfxx::gpio::wakeup_enable(), idfxx::partition::write(), idfxx::partition::write(), idfxx::http::client::write(), idfxx::onewire::bus::write(), idfxx::http::client::write(), idfxx::onewire::bus::write(), idfxx::partition::write_raw(), idfxx::partition::write_raw(), idfxx::i2c::master_device::write_register(), idfxx::i2c::master_device::write_register(), idfxx::i2c::master_device::write_register(), idfxx::i2c::master_device::write_register(), idfxx::i2c::master_device::write_register(), idfxx::i2c::master_device::write_register(), idfxx::i2c::master_device::write_register(), idfxx::i2c::master_device::write_register(), idfxx::i2c::master_device::write_registers(), idfxx::i2c::master_device::write_registers(), idfxx::i2c::master_device::write_registers(), idfxx::i2c::master_device::write_registers(), and idfxx::ds18x20::device::write_scratchpad().

◆ unwrap() [2/2]

template<>
void idfxx::unwrap ( result< void result)
inline

Definition at line 313 of file error.hpp.

◆ wifi_category()

const wifi::error_category & idfxx::wifi_category ( )
noexcept

Returns a reference to the WiFi error category singleton.

Returns
Reference to the singleton wifi::error_category instance.

References wifi_category().

Referenced by idfxx::wifi::make_error_code(), and wifi_category().

◆ wifi_error()

std::unexpected< std::error_code > idfxx::wifi_error ( esp_err_t  e)

Creates an unexpected error from an ESP-IDF error code, mapping to WiFi error codes where possible.

Converts the ESP-IDF error code to a WiFi-specific error code if a mapping exists, otherwise falls back to the default IDFXX error category.

Parameters
eThe ESP-IDF error code.
Returns
An unexpected value suitable for returning from result-returning functions.

◆ wrap()

result< void > idfxx::wrap ( esp_err_t  e)
inline

Wraps an esp_err_t into a result<void>.

Throws std::bad_alloc (or aborts) on ESP_ERR_NO_MEM.

Parameters
eThe esp_err_t value to wrap.
Returns
A result representing success or failure.

Definition at line 286 of file error.hpp.

References error().

Referenced by idfxx::timer::try_restart(), idfxx::user_event_loop::try_run(), idfxx::timer::try_start_once(), idfxx::timer::try_start_once(), idfxx::timer::try_start_periodic(), idfxx::timer::try_stop(), and idfxx::netif::interface::wrap().

Variable Documentation

◆ enable_flags_operators

template<typename E >
constexpr bool idfxx::enable_flags_operators = false
inlineconstexpr

Opt-in trait for enabling flag operators on an enum.

Specialize this to true for enum types that should support bitwise operators and work with flags<E>.

Template Parameters
EThe enum type.
See also
flag_enum

Definition at line 56 of file flags.hpp.

◆ intr_level_all

constexpr intr_levels idfxx::intr_level_all = intr_level_lowmed | intr_level_high
inlineconstexpr

All interrupt levels.

Definition at line 65 of file intr_alloc.hpp.

◆ intr_level_high

constexpr intr_levels idfxx::intr_level_high
inlineconstexpr
Initial value:
=
intr_level::level_4 | intr_level::level_5 | intr_level::level_6 | intr_level::nmi

High priority levels (4-6 and NMI). These require assembly handlers.

Definition at line 61 of file intr_alloc.hpp.

◆ intr_level_lowmed

constexpr intr_levels idfxx::intr_level_lowmed = intr_level::level_1 | intr_level::level_2 | intr_level::level_3
inlineconstexpr

Low and medium priority levels (1-3). These can be handled in C / C++.

Definition at line 58 of file intr_alloc.hpp.

Referenced by idfxx::gpio::try_install_isr_service().