HF Interface Wrapper 0.1.0-dev
Embedded C++ hardware abstraction layer
Loading...
Searching...
No Matches
EspTypes_Base.h File Reference

ESP32 base type definitions for hardware abstraction. More...

#include "../../utils/McuSelect.h"
#include "HardwareTypes.h"
#include <atomic>
#include <cstdint>
Include dependency graph for EspTypes_Base.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define HF_TICKS_FROM_MS(ms)   (pdMS_TO_TICKS(ms))
 Convert milliseconds to RTOS ticks for operations.
 
#define HF_MS_FROM_TICKS(ticks)   ((ticks) * portTICK_PERIOD_MS)
 
#define HF_US_TO_TICKS(us)   ((us) / (portTICK_PERIOD_MS * 1000))
 
#define HF_TICKS_TO_US(ticks)   ((ticks) * portTICK_PERIOD_MS * 1000)
 

Typedefs

using hf_timeout_ms_t = uint32_t
 Timeout value in milliseconds.
 
using hf_timestamp_us_t = uint64_t
 High-resolution timing types for operations.
 
using hf_timestamp_ns_t = uint64_t
 Nanosecond timestamp.
 
using hf_duration_us_t = uint32_t
 Duration in microseconds.
 
using hf_duration_ns_t = uint32_t
 Duration in nanoseconds.
 

Enumerations

enum class  hf_power_domain_t : uint8_t {
  HF_POWER_DOMAIN_CPU = 0 , HF_POWER_DOMAIN_RTC_PERIPH , HF_POWER_DOMAIN_XTAL , HF_POWER_DOMAIN_MODEM ,
  HF_POWER_DOMAIN_VDDSDIO , HF_POWER_DOMAIN_TOP
}
 ESP32 power domain configuration for operations. More...
 
enum class  hf_sleep_mode_t : uint8_t { HF_SLEEP_MODE_NONE = 0 , HF_SLEEP_MODE_LIGHT , HF_SLEEP_MODE_DEEP , HF_SLEEP_MODE_HIBERNATION }
 ESP32 sleep mode types. More...
 

Variables

static constexpr hf_timeout_ms_t HF_TIMEOUT_NEVER = 0xFFFFFFFF
 
static constexpr hf_timeout_ms_t HF_TIMEOUT_IMMEDIATE = 0
 
static constexpr hf_timeout_ms_t HF_TIMEOUT_DEFAULT = 1000
 
static constexpr uint32_t HF_ADC_DEFAULT_SAMPLING_FREQ = 1000U
 
static constexpr size_t HF_ADC_DMA_BUFFER_SIZE_DEFAULT = 1024U
 

Detailed Description

ESP32 base type definitions for hardware abstraction.

This header defines the common base types and includes that are shared across all ESP32 peripheral type definitions. Clean and minimal approach.

Author
Nebiyu Tadesse
Date
2025
Note
This file should be included by all EspTypes_*.h files.
All interface classes must use only these types.

Macro Definition Documentation

◆ HF_MS_FROM_TICKS

#define HF_MS_FROM_TICKS ( ticks)    ((ticks) * portTICK_PERIOD_MS)

◆ HF_TICKS_FROM_MS

#define HF_TICKS_FROM_MS ( ms)    (pdMS_TO_TICKS(ms))

Convert milliseconds to RTOS ticks for operations.

Parameters
msMilliseconds to convert
Returns
RTOS ticks (implementation-specific)

◆ HF_TICKS_TO_US

#define HF_TICKS_TO_US ( ticks)    ((ticks) * portTICK_PERIOD_MS * 1000)

◆ HF_US_TO_TICKS

#define HF_US_TO_TICKS ( us)    ((us) / (portTICK_PERIOD_MS * 1000))

Typedef Documentation

◆ hf_duration_ns_t

using hf_duration_ns_t = uint32_t

Duration in nanoseconds.

◆ hf_duration_us_t

using hf_duration_us_t = uint32_t

Duration in microseconds.

◆ hf_timeout_ms_t

using hf_timeout_ms_t = uint32_t

Timeout value in milliseconds.

◆ hf_timestamp_ns_t

using hf_timestamp_ns_t = uint64_t

Nanosecond timestamp.

◆ hf_timestamp_us_t

using hf_timestamp_us_t = uint64_t

High-resolution timing types for operations.

Microsecond timestamp

Enumeration Type Documentation

◆ hf_power_domain_t

enum class hf_power_domain_t : uint8_t
strong

ESP32 power domain configuration for operations.

Enumerator
HF_POWER_DOMAIN_CPU 

CPU power domain.

HF_POWER_DOMAIN_RTC_PERIPH 

RTC peripherals power domain.

HF_POWER_DOMAIN_XTAL 

Crystal oscillator domain.

HF_POWER_DOMAIN_MODEM 

RF/WiFi/BT modem domain.

HF_POWER_DOMAIN_VDDSDIO 

SDIO power domain.

HF_POWER_DOMAIN_TOP 

SoC top domain.

◆ hf_sleep_mode_t

enum class hf_sleep_mode_t : uint8_t
strong

ESP32 sleep mode types.

Enumerator
HF_SLEEP_MODE_NONE 

No sleep mode.

HF_SLEEP_MODE_LIGHT 

Light sleep mode.

HF_SLEEP_MODE_DEEP 

Deep sleep mode.

HF_SLEEP_MODE_HIBERNATION 

Hibernation mode (lowest power)

Variable Documentation

◆ HF_ADC_DEFAULT_SAMPLING_FREQ

constexpr uint32_t HF_ADC_DEFAULT_SAMPLING_FREQ = 1000U
staticconstexpr

◆ HF_ADC_DMA_BUFFER_SIZE_DEFAULT

constexpr size_t HF_ADC_DMA_BUFFER_SIZE_DEFAULT = 1024U
staticconstexpr

◆ HF_TIMEOUT_DEFAULT

constexpr hf_timeout_ms_t HF_TIMEOUT_DEFAULT = 1000
staticconstexpr

◆ HF_TIMEOUT_IMMEDIATE

constexpr hf_timeout_ms_t HF_TIMEOUT_IMMEDIATE = 0
staticconstexpr

◆ HF_TIMEOUT_NEVER

constexpr hf_timeout_ms_t HF_TIMEOUT_NEVER = 0xFFFFFFFF
staticconstexpr