HF Interface Wrapper 0.1.0-dev
Embedded C++ hardware abstraction layer
Loading...
Searching...
No Matches
GPIO Module

All GPIO-related types, enums, and functions for digital I/O operations. More...

Files

file  BaseGpio.h
 Unified GPIO base class for all digital GPIO implementations.
 
file  EspGpio.h
 Advanced MCU-specific implementation of the unified BaseGpio class with ESP32C6/ESP-IDF v5.5+ features.
 

Classes

struct  InterruptStatus
 GPIO interrupt status structure. More...
 
struct  hf_gpio_statistics_t
 GPIO operation statistics. More...
 
struct  hf_gpio_diagnostics_t
 GPIO diagnostic information. More...
 
class  BaseGpio
 Unified GPIO base class for all digital GPIO implementations. More...
 

Macros

#define HF_GPIO_ERR_LIST(X)
 HardFOC GPIO error codes macro list.
 

Typedefs

using InterruptCallback
 GPIO interrupt callback function type.
 

Enumerations

enum class  hf_gpio_err_t : hf_u8_t {
  hf_gpio_err_t::X , hf_gpio_err_t::GPIO_SUCCESS = 0 , hf_gpio_err_t::GPIO_ERR_FAILURE = 1 , hf_gpio_err_t::GPIO_ERR_NOT_INITIALIZED = 2 ,
  hf_gpio_err_t::GPIO_ERR_ALREADY_INITIALIZED = 3 , hf_gpio_err_t::GPIO_ERR_INVALID_PARAMETER = 4 , hf_gpio_err_t::GPIO_ERR_NULL_POINTER = 5 , hf_gpio_err_t::GPIO_ERR_OUT_OF_MEMORY = 6 ,
  hf_gpio_err_t::GPIO_ERR_INVALID_PIN = 7 , hf_gpio_err_t::GPIO_ERR_PIN_NOT_FOUND = 8 , hf_gpio_err_t::GPIO_ERR_PIN_NOT_CONFIGURED = 9 , hf_gpio_err_t::GPIO_ERR_PIN_ALREADY_REGISTERED = 10 ,
  hf_gpio_err_t::GPIO_ERR_PIN_ACCESS_DENIED = 11 , hf_gpio_err_t::GPIO_ERR_PIN_BUSY = 12 , hf_gpio_err_t::GPIO_ERR_HARDWARE_FAULT = 13 , hf_gpio_err_t::GPIO_ERR_COMMUNICATION_FAILURE = 14 ,
  hf_gpio_err_t::GPIO_ERR_DEVICE_NOT_RESPONDING = 15 , hf_gpio_err_t::GPIO_ERR_TIMEOUT = 16 , hf_gpio_err_t::GPIO_ERR_VOLTAGE_OUT_OF_RANGE = 17 , hf_gpio_err_t::GPIO_ERR_INVALID_CONFIGURATION = 18 ,
  hf_gpio_err_t::GPIO_ERR_UNSUPPORTED_OPERATION = 19 , hf_gpio_err_t::GPIO_ERR_RESOURCE_BUSY = 20 , hf_gpio_err_t::GPIO_ERR_RESOURCE_UNAVAILABLE = 21 , hf_gpio_err_t::GPIO_ERR_READ_FAILURE = 22 ,
  hf_gpio_err_t::GPIO_ERR_WRITE_FAILURE = 23 , hf_gpio_err_t::GPIO_ERR_DIRECTION_MISMATCH = 24 , hf_gpio_err_t::GPIO_ERR_PULL_RESISTOR_FAILURE = 25 , hf_gpio_err_t::GPIO_ERR_INTERRUPT_NOT_SUPPORTED = 26 ,
  hf_gpio_err_t::GPIO_ERR_INTERRUPT_ALREADY_ENABLED = 27 , hf_gpio_err_t::GPIO_ERR_INTERRUPT_NOT_ENABLED = 28 , hf_gpio_err_t::GPIO_ERR_INTERRUPT_HANDLER_FAILED = 29 , hf_gpio_err_t::GPIO_ERR_SYSTEM_ERROR = 30 ,
  hf_gpio_err_t::GPIO_ERR_PERMISSION_DENIED = 31 , hf_gpio_err_t::GPIO_ERR_OPERATION_ABORTED = 32 , hf_gpio_err_t::GPIO_ERR_NOT_SUPPORTED = 33 , hf_gpio_err_t::GPIO_ERR_DRIVER_ERROR = 34 ,
  hf_gpio_err_t::GPIO_ERR_INVALID_STATE = 35 , hf_gpio_err_t::GPIO_ERR_INVALID_ARG = 36 , hf_gpio_err_t::GPIO_ERR_CALIBRATION_FAILURE = 37 , hf_gpio_err_t::GPIO_ERR_UNKNOWN = 38 ,
  hf_gpio_err_t::GPIO_ERR_COUNT
}
 HardFOC GPIO error codes. More...
 
enum class  hf_gpio_state_t : hf_u8_t { hf_gpio_state_t::HF_GPIO_STATE_INACTIVE = 0 , hf_gpio_state_t::HF_GPIO_STATE_ACTIVE = 1 }
 GPIO pin logical states. More...
 
enum class  hf_gpio_level_t : hf_u8_t { hf_gpio_level_t::HF_GPIO_LEVEL_LOW = 0 , hf_gpio_level_t::HF_GPIO_LEVEL_HIGH = 1 }
 GPIO pin electrical levels. More...
 
enum class  hf_gpio_active_state_t : hf_u8_t { hf_gpio_active_state_t::HF_GPIO_ACTIVE_LOW = 0 , hf_gpio_active_state_t::HF_GPIO_ACTIVE_HIGH = 1 }
 GPIO active state polarity configuration. More...
 
enum class  hf_gpio_direction_t : hf_u8_t { hf_gpio_direction_t::HF_GPIO_DIRECTION_INPUT = 0 , hf_gpio_direction_t::HF_GPIO_DIRECTION_OUTPUT = 1 }
 GPIO pin direction/mode configuration. More...
 
enum class  hf_gpio_output_mode_t : hf_u8_t { hf_gpio_output_mode_t::HF_GPIO_OUTPUT_MODE_PUSH_PULL = 0 , hf_gpio_output_mode_t::HF_GPIO_OUTPUT_MODE_OPEN_DRAIN = 1 }
 GPIO output drive modes. More...
 
enum class  hf_gpio_pull_mode_t : hf_u8_t { hf_gpio_pull_mode_t::HF_GPIO_PULL_MODE_FLOATING = 0 , hf_gpio_pull_mode_t::HF_GPIO_PULL_MODE_UP = 1 , hf_gpio_pull_mode_t::HF_GPIO_PULL_MODE_DOWN = 2 , hf_gpio_pull_mode_t::HF_GPIO_PULL_MODE_UP_DOWN = 3 }
 GPIO pull resistor configuration. More...
 
enum class  hf_gpio_interrupt_trigger_t : hf_u8_t {
  hf_gpio_interrupt_trigger_t::HF_GPIO_INTERRUPT_TRIGGER_NONE = 0 , hf_gpio_interrupt_trigger_t::HF_GPIO_INTERRUPT_TRIGGER_RISING_EDGE = 1 , hf_gpio_interrupt_trigger_t::HF_GPIO_INTERRUPT_TRIGGER_FALLING_EDGE = 2 , hf_gpio_interrupt_trigger_t::HF_GPIO_INTERRUPT_TRIGGER_BOTH_EDGES = 3 ,
  hf_gpio_interrupt_trigger_t::HF_GPIO_INTERRUPT_TRIGGER_LOW_LEVEL = 4 , hf_gpio_interrupt_trigger_t::HF_GPIO_INTERRUPT_TRIGGER_HIGH_LEVEL = 5
}
 GPIO interrupt trigger types. More...
 

Functions

constexpr std::string_view HfGpioErrToString (hf_gpio_err_t err) noexcept
 Convert hf_gpio_err_t to human-readable string.
 

Detailed Description

All GPIO-related types, enums, and functions for digital I/O operations.

This module provides comprehensive GPIO functionality including:

Macro Definition Documentation

◆ HF_GPIO_ERR_LIST

#define HF_GPIO_ERR_LIST ( X)

HardFOC GPIO error codes macro list.

X-macro pattern for comprehensive error enumeration. Each entry contains: X(NAME, VALUE, DESCRIPTION)

Typedef Documentation

◆ InterruptCallback

Initial value:
void(*)(BaseGpio* gpio, hf_gpio_interrupt_trigger_t trigger, void* user_data)
Unified GPIO base class for all digital GPIO implementations.
Definition BaseGpio.h:294
hf_gpio_interrupt_trigger_t
GPIO interrupt trigger types.
Definition BaseGpio.h:200

GPIO interrupt callback function type.

Callback invoked when GPIO interrupt occurs.

Parameters
gpioPointer to the GPIO instance that triggered
triggerThe trigger type that caused the interrupt
user_dataUser-provided data passed to callback

Enumeration Type Documentation

◆ hf_gpio_active_state_t

enum class hf_gpio_active_state_t : hf_u8_t
strong

GPIO active state polarity configuration.

Defines which electrical level corresponds to the logical "active" state.

Enumerator
HF_GPIO_ACTIVE_LOW 

Active state is electrical low.

HF_GPIO_ACTIVE_HIGH 

Active state is electrical high.

◆ hf_gpio_direction_t

enum class hf_gpio_direction_t : hf_u8_t
strong

GPIO pin direction/mode configuration.

Defines whether the pin is configured as input or output.

Enumerator
HF_GPIO_DIRECTION_INPUT 

Pin configured as input.

HF_GPIO_DIRECTION_OUTPUT 

Pin configured as output.

◆ hf_gpio_err_t

enum class hf_gpio_err_t : hf_u8_t
strong

HardFOC GPIO error codes.

Comprehensive error enumeration for all GPIO operations in the system.

Enumerator
GPIO_SUCCESS 
GPIO_ERR_FAILURE 
GPIO_ERR_NOT_INITIALIZED 
GPIO_ERR_ALREADY_INITIALIZED 
GPIO_ERR_INVALID_PARAMETER 
GPIO_ERR_NULL_POINTER 
GPIO_ERR_OUT_OF_MEMORY 
GPIO_ERR_INVALID_PIN 
GPIO_ERR_PIN_NOT_FOUND 
GPIO_ERR_PIN_NOT_CONFIGURED 
GPIO_ERR_PIN_ALREADY_REGISTERED 
GPIO_ERR_PIN_ACCESS_DENIED 
GPIO_ERR_PIN_BUSY 
GPIO_ERR_HARDWARE_FAULT 
GPIO_ERR_COMMUNICATION_FAILURE 
GPIO_ERR_DEVICE_NOT_RESPONDING 
GPIO_ERR_TIMEOUT 
GPIO_ERR_VOLTAGE_OUT_OF_RANGE 
GPIO_ERR_INVALID_CONFIGURATION 
GPIO_ERR_UNSUPPORTED_OPERATION 
GPIO_ERR_RESOURCE_BUSY 
GPIO_ERR_RESOURCE_UNAVAILABLE 
GPIO_ERR_READ_FAILURE 
GPIO_ERR_WRITE_FAILURE 
GPIO_ERR_DIRECTION_MISMATCH 
GPIO_ERR_PULL_RESISTOR_FAILURE 
GPIO_ERR_INTERRUPT_NOT_SUPPORTED 
GPIO_ERR_INTERRUPT_ALREADY_ENABLED 
GPIO_ERR_INTERRUPT_NOT_ENABLED 
GPIO_ERR_INTERRUPT_HANDLER_FAILED 
GPIO_ERR_SYSTEM_ERROR 
GPIO_ERR_PERMISSION_DENIED 
GPIO_ERR_OPERATION_ABORTED 
GPIO_ERR_NOT_SUPPORTED 
GPIO_ERR_DRIVER_ERROR 
GPIO_ERR_INVALID_STATE 
GPIO_ERR_INVALID_ARG 
GPIO_ERR_CALIBRATION_FAILURE 
GPIO_ERR_UNKNOWN 
GPIO_ERR_COUNT 

◆ hf_gpio_interrupt_trigger_t

enum class hf_gpio_interrupt_trigger_t : hf_u8_t
strong

GPIO interrupt trigger types.

Defines the conditions that trigger GPIO interrupts.

Enumerator
HF_GPIO_INTERRUPT_TRIGGER_NONE 

No interrupt (disabled)

HF_GPIO_INTERRUPT_TRIGGER_RISING_EDGE 

Trigger on rising edge (low to high)

HF_GPIO_INTERRUPT_TRIGGER_FALLING_EDGE 

Trigger on falling edge (high to low)

HF_GPIO_INTERRUPT_TRIGGER_BOTH_EDGES 

Trigger on both rising and falling edges.

HF_GPIO_INTERRUPT_TRIGGER_LOW_LEVEL 

Trigger on low level.

HF_GPIO_INTERRUPT_TRIGGER_HIGH_LEVEL 

Trigger on high level.

◆ hf_gpio_level_t

enum class hf_gpio_level_t : hf_u8_t
strong

GPIO pin electrical levels.

Represents the actual electrical level of a GPIO pin.

Enumerator
HF_GPIO_LEVEL_LOW 

Electrical low level (0V)

HF_GPIO_LEVEL_HIGH 

Electrical high level (VCC)

◆ hf_gpio_output_mode_t

enum class hf_gpio_output_mode_t : hf_u8_t
strong

GPIO output drive modes.

Defines the electrical characteristics of GPIO output pins.

Enumerator
HF_GPIO_OUTPUT_MODE_PUSH_PULL 

Push-pull output (strong high and low)

HF_GPIO_OUTPUT_MODE_OPEN_DRAIN 

Open-drain output (strong low, high-impedance high)

◆ hf_gpio_pull_mode_t

enum class hf_gpio_pull_mode_t : hf_u8_t
strong

GPIO pull resistor configuration.

Defines the internal pull resistor configuration for GPIO pins.

Enumerator
HF_GPIO_PULL_MODE_FLOATING 

No pull resistor (floating/high-impedance)

HF_GPIO_PULL_MODE_UP 

Internal pull-up resistor enabled.

HF_GPIO_PULL_MODE_DOWN 

Internal pull-down resistor enabled.

HF_GPIO_PULL_MODE_UP_DOWN 

Both pull-up and pull-down resistors enabled.

◆ hf_gpio_state_t

enum class hf_gpio_state_t : hf_u8_t
strong

GPIO pin logical states.

Represents the logical state of a GPIO pin, independent of electrical polarity.

Enumerator
HF_GPIO_STATE_INACTIVE 

Logical inactive state.

HF_GPIO_STATE_ACTIVE 

Logical active state.

Function Documentation

◆ HfGpioErrToString()

constexpr std::string_view HfGpioErrToString ( hf_gpio_err_t err)
constexprnoexcept

Convert hf_gpio_err_t to human-readable string.

Parameters
errThe error code to convert
Returns
String view of the error description