HF Interface Wrapper 0.1.0-dev
Embedded C++ hardware abstraction layer
Loading...
Searching...
No Matches
BaseGpio Class Referenceabstract

Unified GPIO base class for all digital GPIO implementations. More...

#include <BaseGpio.h>

Inheritance diagram for BaseGpio:
[legend]
Collaboration diagram for BaseGpio:
[legend]

Public Member Functions

 BaseGpio (const BaseGpio &copy)=delete
 Copy constructor is deleted to avoid copying instances.
 
BaseGpiooperator= (const BaseGpio &copy)=delete
 Assignment operator is deleted to avoid copying instances.
 
virtual ~BaseGpio () noexcept=default
 Virtual destructor for proper cleanup of derived classes.
 
bool IsInitialized () const noexcept
 Check if the pin is initialized.
 
bool EnsureInitialized () noexcept
 Ensures the pin is initialized (lazy initialization).
 
bool EnsureDeinitialized () noexcept
 Ensures the pin is deinitialized (lazy deinitialization).
 
hf_pin_num_t GetPin () const noexcept
 Get the GPIO pin number/identifier.
 
hf_gpio_direction_t GetDirection () const noexcept
 Get the current pin direction.
 
hf_gpio_err_t SetDirection (hf_gpio_direction_t direction) noexcept
 Set the pin direction (input or output).
 
bool IsInput () const noexcept
 Check if the pin is currently configured as input.
 
bool IsOutput () const noexcept
 Check if the pin is currently configured as output.
 
hf_gpio_output_mode_t GetOutputMode () const noexcept
 Get the output drive mode.
 
hf_gpio_err_t SetOutputMode (hf_gpio_output_mode_t mode) noexcept
 Set the output drive mode.
 
hf_gpio_pull_mode_t GetPullMode () const noexcept
 Get the current pull resistor mode.
 
hf_gpio_err_t SetPullMode (hf_gpio_pull_mode_t mode) noexcept
 Set the pull resistor mode.
 
hf_gpio_state_t GetCurrentState () const noexcept
 Get the current logical state of the pin.
 
hf_gpio_err_t SetState (hf_gpio_state_t state) noexcept
 Set the pin to a specific logical state.
 
hf_gpio_active_state_t GetActiveState () const noexcept
 Get the active state polarity configuration.
 
void SetActiveState (hf_gpio_active_state_t active_state) noexcept
 Set the active state polarity configuration.
 
hf_gpio_err_t SetActive () noexcept
 Set the GPIO to active state.
 
hf_gpio_err_t SetInactive () noexcept
 Set the GPIO to inactive state.
 
hf_gpio_err_t Toggle () noexcept
 Toggle the GPIO state.
 
hf_gpio_err_t IsActive (bool &is_active) noexcept
 Check if the GPIO is currently active.
 
hf_gpio_err_t VerifyDirection (hf_gpio_direction_t &direction) const noexcept
 Verify current direction setting by reading from hardware registers.
 
hf_gpio_err_t VerifyOutputMode (hf_gpio_output_mode_t &mode) const noexcept
 Verify current output mode setting by reading from hardware registers.
 
hf_gpio_err_t VerifyHardwareConfiguration () const noexcept
 Perform comprehensive hardware verification of all pin settings.
 
virtual bool IsPinAvailable () const noexcept=0
 Check if the pin is available for GPIO operations.
 
virtual hf_u8_t GetMaxPins () const noexcept=0
 Get the maximum number of pins supported by this GPIO instance.
 
virtual const char * GetDescription () const noexcept=0
 Get human-readable description of this GPIO instance.
 
virtual hf_gpio_err_t SupportsInterrupts () const noexcept
 Check if this GPIO implementation supports interrupts.
 
virtual hf_gpio_err_t ConfigureInterrupt (hf_gpio_interrupt_trigger_t trigger, InterruptCallback callback=nullptr, void *user_data=nullptr) noexcept
 Configure GPIO interrupt settings.
 
virtual hf_gpio_err_t EnableInterrupt () noexcept
 Enable GPIO interrupt.
 
virtual hf_gpio_err_t DisableInterrupt () noexcept
 Disable GPIO interrupt.
 
virtual hf_gpio_err_t WaitForInterrupt (hf_u32_t timeout_ms=0) noexcept
 Wait for GPIO interrupt to occur.
 
virtual hf_gpio_err_t GetInterruptStatus (InterruptStatus &status) noexcept
 Get interrupt status information.
 
virtual hf_gpio_err_t ClearInterruptStats () noexcept
 Clear interrupt statistics.
 
virtual hf_gpio_err_t ResetStatistics () noexcept
 Reset GPIO operation statistics.
 
virtual hf_gpio_err_t ResetDiagnostics () noexcept
 Reset GPIO diagnostic information.
 
virtual hf_gpio_err_t GetStatistics (hf_gpio_statistics_t &statistics) const noexcept
 Get GPIO operation statistics.
 
virtual hf_gpio_err_t GetDiagnostics (hf_gpio_diagnostics_t &diagnostics) const noexcept
 Get GPIO diagnostic information.
 
virtual bool Initialize () noexcept=0
 Initialize the GPIO pin with current configuration.
 
virtual bool Deinitialize () noexcept
 Deinitialize the GPIO pin.
 

Static Public Member Functions

static const char * ToString (hf_gpio_state_t state) noexcept
 
static const char * ToString (hf_gpio_level_t level) noexcept
 
static const char * ToString (hf_gpio_active_state_t active_state) noexcept
 
static const char * ToString (hf_gpio_direction_t direction) noexcept
 
static const char * ToString (hf_gpio_output_mode_t output_mode) noexcept
 
static const char * ToString (hf_gpio_pull_mode_t pull_mode) noexcept
 
static const char * ToString (hf_gpio_interrupt_trigger_t trigger) noexcept
 

Protected Member Functions

virtual hf_gpio_err_t SetDirectionImpl (hf_gpio_direction_t direction) noexcept=0
 Platform-specific implementation for setting pin direction.
 
virtual hf_gpio_err_t GetDirectionImpl (hf_gpio_direction_t &direction) const noexcept=0
 Hardware read-back of current pin direction from registers.
 
virtual hf_gpio_err_t SetOutputModeImpl (hf_gpio_output_mode_t mode) noexcept=0
 Platform-specific implementation for setting output mode.
 
virtual hf_gpio_err_t GetOutputModeImpl (hf_gpio_output_mode_t &mode) const noexcept=0
 Hardware read-back of current output mode from registers.
 
virtual hf_gpio_err_t SetPullModeImpl (hf_gpio_pull_mode_t mode) noexcept=0
 Platform-specific implementation for setting pull resistor mode.
 
virtual hf_gpio_pull_mode_t GetPullModeImpl () const noexcept=0
 Hardware read-back of current pull resistor mode from registers.
 
virtual hf_gpio_err_t SetPinLevelImpl (hf_gpio_level_t level) noexcept=0
 Platform-specific implementation for setting pin electrical level.
 
virtual hf_gpio_err_t GetPinLevelImpl (hf_gpio_level_t &level) noexcept=0
 Platform-specific implementation for getting pin electrical level.
 
hf_gpio_err_t ValidateBasicOperation () const noexcept
 Validate basic parameters before GPIO operations.
 
hf_gpio_level_t StateToLevel (hf_gpio_state_t state) const noexcept
 Convert logical state to electrical level based on polarity.
 
hf_gpio_state_t LevelToState (hf_gpio_level_t level) const noexcept
 Convert electrical level to logical state based on polarity.
 
 BaseGpio (hf_pin_num_t pin_num, hf_gpio_direction_t direction=hf_gpio_direction_t::HF_GPIO_DIRECTION_INPUT, hf_gpio_active_state_t active_state=hf_gpio_active_state_t::HF_GPIO_ACTIVE_HIGH, hf_gpio_output_mode_t output_mode=hf_gpio_output_mode_t::HF_GPIO_OUTPUT_MODE_PUSH_PULL, hf_gpio_pull_mode_t pull_mode=hf_gpio_pull_mode_t::HF_GPIO_PULL_MODE_FLOATING) noexcept
 Protected constructor with configuration.
 

Protected Attributes

const hf_pin_num_t pin_
 GPIO pin number/identifier.
 
bool initialized_
 Initialization state flag.
 
hf_gpio_direction_t current_direction_
 Current pin direction.
 
hf_gpio_active_state_t active_state_
 Active state polarity.
 
hf_gpio_output_mode_t output_mode_
 Output drive mode.
 
hf_gpio_pull_mode_t pull_mode_
 Pull resistor configuration.
 
hf_gpio_state_t current_state_
 Current logical state.
 
hf_gpio_statistics_t statistics_
 GPIO operation statistics.
 
hf_gpio_diagnostics_t diagnostics_
 GPIO diagnostic information.
 

Detailed Description

Unified GPIO base class for all digital GPIO implementations.

This class provides a comprehensive digital GPIO implementation that serves as the base for all GPIO hardware in the HardFOC system. It supports:

  • Dynamic mode switching between input and output
  • Active-high/active-low polarity support
  • Pull resistor configuration
  • Push-pull and open-drain output modes
  • Comprehensive error handling and validation
  • Lazy initialization pattern

Derived classes implement platform-specific details for:

  • On-chip GPIO controllers
  • I2C GPIO expanders
  • SPI GPIO expanders
  • Other GPIO hardware

Constructor & Destructor Documentation

◆ BaseGpio() [1/2]

BaseGpio::BaseGpio ( const BaseGpio & copy)
delete

Copy constructor is deleted to avoid copying instances.

◆ ~BaseGpio()

virtual BaseGpio::~BaseGpio ( )
virtualdefaultnoexcept

Virtual destructor for proper cleanup of derived classes.

◆ BaseGpio() [2/2]

Protected constructor with configuration.

Parameters
pin_numGPIO pin number
directionGPIO direction (input/output)
active_stateActive state polarity (high/low)
output_modeOutput drive mode (push-pull/open-drain)
pull_modePull resistor configuration (Floating, PullUp, or PullDown)

Initializes the GPIO with specified configuration. The pin is not physically configured until Initialize() is called.

Member Function Documentation

◆ ClearInterruptStats()

virtual hf_gpio_err_t BaseGpio::ClearInterruptStats ( )
inlinevirtualnoexcept

Clear interrupt statistics.

Returns
hf_gpio_err_t::GPIO_SUCCESS if successful, error code otherwise

Reimplemented in EspGpio.

◆ ConfigureInterrupt()

virtual hf_gpio_err_t BaseGpio::ConfigureInterrupt ( hf_gpio_interrupt_trigger_t trigger,
InterruptCallback callback = nullptr,
void * user_data = nullptr )
inlinevirtualnoexcept

Configure GPIO interrupt settings.

Parameters
triggerInterrupt trigger type
callbackCallback function to invoke on interrupt (optional)
user_dataUser data passed to callback (optional)
Returns
hf_gpio_err_t::GPIO_SUCCESS if successful, error code otherwise

Reimplemented in EspGpio.

◆ Deinitialize()

virtual bool BaseGpio::Deinitialize ( )
inlinevirtualnoexcept

Deinitialize the GPIO pin.

Returns
true if deinitialization successful, false otherwise

Reimplemented in EspGpio.

◆ DisableInterrupt()

virtual hf_gpio_err_t BaseGpio::DisableInterrupt ( )
inlinevirtualnoexcept

Disable GPIO interrupt.

Returns
hf_gpio_err_t::GPIO_SUCCESS if successful, error code otherwise

Reimplemented in EspGpio.

◆ EnableInterrupt()

virtual hf_gpio_err_t BaseGpio::EnableInterrupt ( )
inlinevirtualnoexcept

Enable GPIO interrupt.

Returns
hf_gpio_err_t::GPIO_SUCCESS if successful, error code otherwise

Reimplemented in EspGpio.

◆ EnsureDeinitialized()

bool BaseGpio::EnsureDeinitialized ( )
inlinenoexcept

Ensures the pin is deinitialized (lazy deinitialization).

Returns
true if deinitialized successfully, false otherwise

◆ EnsureInitialized()

bool BaseGpio::EnsureInitialized ( )
inlinenoexcept

Ensures the pin is initialized (lazy initialization).

Returns
true if initialized successfully, false otherwise

◆ GetActiveState()

hf_gpio_active_state_t BaseGpio::GetActiveState ( ) const
inlinenoexcept

Get the active state polarity configuration.

Returns
Current ActiveState setting (High or Low)

◆ GetCurrentState()

hf_gpio_state_t BaseGpio::GetCurrentState ( ) const
inlinenoexcept

Get the current logical state of the pin.

Returns
Current State (Active or Inactive)

◆ GetDescription()

virtual const char * BaseGpio::GetDescription ( ) const
pure virtualnoexcept

Get human-readable description of this GPIO instance.

Returns
Pointer to description string

Implemented in EspGpio, and StmGpio.

◆ GetDiagnostics()

virtual hf_gpio_err_t BaseGpio::GetDiagnostics ( hf_gpio_diagnostics_t & diagnostics) const
inlinevirtualnoexcept

Get GPIO diagnostic information.

Parameters
diagnosticsReference to store diagnostics data
Returns
hf_gpio_err_t::GPIO_SUCCESS if successful, GPIO_ERR_NOT_SUPPORTED if not implemented

Reimplemented in EspGpio.

◆ GetDirection()

hf_gpio_direction_t BaseGpio::GetDirection ( ) const
inlinenoexcept

Get the current pin direction.

Returns
Current Direction setting (Input or Output)

◆ GetDirectionImpl()

virtual hf_gpio_err_t BaseGpio::GetDirectionImpl ( hf_gpio_direction_t & direction) const
protectedpure virtualnoexcept

Hardware read-back of current pin direction from registers.

Parameters
directionOutput parameter: actual hardware pin direction
Returns
hf_gpio_err_t::GPIO_SUCCESS if successful, error code otherwise

Reads the actual direction configuration from hardware registers. Useful for fault detection and hardware verification.

Note
Some hardware may not support this operation.

Implemented in EspGpio, and StmGpio.

◆ GetInterruptStatus()

virtual hf_gpio_err_t BaseGpio::GetInterruptStatus ( InterruptStatus & status)
inlinevirtualnoexcept

Get interrupt status information.

Parameters
statusReference to store status information
Returns
hf_gpio_err_t::GPIO_SUCCESS if successful, error code otherwise

Reimplemented in EspGpio.

◆ GetMaxPins()

virtual hf_u8_t BaseGpio::GetMaxPins ( ) const
pure virtualnoexcept

Get the maximum number of pins supported by this GPIO instance.

Returns
Maximum pin count

Implemented in EspGpio, and StmGpio.

◆ GetOutputMode()

hf_gpio_output_mode_t BaseGpio::GetOutputMode ( ) const
inlinenoexcept

Get the output drive mode.

Returns
Current OutputMode setting (PushPull or OpenDrain)

◆ GetOutputModeImpl()

virtual hf_gpio_err_t BaseGpio::GetOutputModeImpl ( hf_gpio_output_mode_t & mode) const
protectedpure virtualnoexcept

Hardware read-back of current output mode from registers.

Parameters
modeOutput parameter: actual hardware output mode
Returns
hf_gpio_err_t::GPIO_SUCCESS if successful, error code otherwise

Reads the actual output mode configuration from hardware registers. Useful for fault detection and hardware verification.

Note
Some hardware may not support this operation.

Implemented in EspGpio, and StmGpio.

◆ GetPin()

hf_pin_num_t BaseGpio::GetPin ( ) const
inlinenoexcept

Get the GPIO pin number/identifier.

Returns
Platform-agnostic pin identifier

◆ GetPinLevelImpl()

virtual hf_gpio_err_t BaseGpio::GetPinLevelImpl ( hf_gpio_level_t & level)
protectedpure virtualnoexcept

Platform-specific implementation for getting pin electrical level.

Parameters
levelOutput parameter: current electrical level (Low or High)
Returns
hf_gpio_err_t::GPIO_SUCCESS if successful, error code otherwise

Implemented in EspGpio, and StmGpio.

◆ GetPullMode()

hf_gpio_pull_mode_t BaseGpio::GetPullMode ( ) const
inlinenoexcept

Get the current pull resistor mode.

Returns
Current PullMode setting

◆ GetPullModeImpl()

virtual hf_gpio_pull_mode_t BaseGpio::GetPullModeImpl ( ) const
protectedpure virtualnoexcept

Hardware read-back of current pull resistor mode from registers.

Returns
Current pull resistor mode

Reads the actual pull resistor configuration from hardware registers. Useful for fault detection and hardware verification.

Note
Some hardware may not support this operation.

Implemented in EspGpio, and StmGpio.

◆ GetStatistics()

virtual hf_gpio_err_t BaseGpio::GetStatistics ( hf_gpio_statistics_t & statistics) const
inlinevirtualnoexcept

Get GPIO operation statistics.

Parameters
statisticsReference to store statistics data
Returns
hf_gpio_err_t::GPIO_SUCCESS if successful, GPIO_ERR_NOT_SUPPORTED if not implemented

Reimplemented in EspGpio.

◆ Initialize()

virtual bool BaseGpio::Initialize ( )
pure virtualnoexcept

Initialize the GPIO pin with current configuration.

Returns
true if initialization successful, false otherwise

Implemented in EspGpio, and StmGpio.

◆ IsActive()

hf_gpio_err_t BaseGpio::IsActive ( bool & is_active)
inlinenoexcept

Check if the GPIO is currently active.

Parameters
is_activeReference to store the result
Returns
hf_gpio_err_t::GPIO_SUCCESS if successful, error code otherwise

◆ IsInitialized()

bool BaseGpio::IsInitialized ( ) const
inlinenoexcept

Check if the pin is initialized.

Returns
true if initialized, false otherwise

◆ IsInput()

bool BaseGpio::IsInput ( ) const
inlinenoexcept

Check if the pin is currently configured as input.

Returns
true if input, false if output

◆ IsOutput()

bool BaseGpio::IsOutput ( ) const
inlinenoexcept

Check if the pin is currently configured as output.

Returns
true if output, false if input

◆ IsPinAvailable()

virtual bool BaseGpio::IsPinAvailable ( ) const
pure virtualnoexcept

Check if the pin is available for GPIO operations.

Returns
true if pin is available, false if reserved for other functions

Implemented in EspGpio, and StmGpio.

◆ LevelToState()

hf_gpio_state_t BaseGpio::LevelToState ( hf_gpio_level_t level) const
inlineprotectednoexcept

Convert electrical level to logical state based on polarity.

Parameters
levelElectrical level (High or Low)
Returns
Logical state (Active or Inactive)

◆ operator=()

BaseGpio & BaseGpio::operator= ( const BaseGpio & copy)
delete

Assignment operator is deleted to avoid copying instances.

◆ ResetDiagnostics()

virtual hf_gpio_err_t BaseGpio::ResetDiagnostics ( )
inlinevirtualnoexcept

Reset GPIO diagnostic information.

Returns
hf_gpio_err_t::GPIO_SUCCESS if successful, error code otherwise
Note
Override this method to provide platform-specific diagnostics reset

◆ ResetStatistics()

virtual hf_gpio_err_t BaseGpio::ResetStatistics ( )
inlinevirtualnoexcept

Reset GPIO operation statistics.

Returns
hf_gpio_err_t::GPIO_SUCCESS if successful, error code otherwise
Note
Override this method to provide platform-specific statistics reset

◆ SetActive()

hf_gpio_err_t BaseGpio::SetActive ( )
inlinenoexcept

Set the GPIO to active state.

Returns
hf_gpio_err_t::GPIO_SUCCESS if successful, error code otherwise

◆ SetActiveState()

void BaseGpio::SetActiveState ( hf_gpio_active_state_t active_state)
inlinenoexcept

Set the active state polarity configuration.

Parameters
active_stateNew ActiveState setting (High or Low)

◆ SetDirection()

hf_gpio_err_t BaseGpio::SetDirection ( hf_gpio_direction_t direction)
inlinenoexcept

Set the pin direction (input or output).

Parameters
directionNew Direction setting (Input or Output)
Returns
hf_gpio_err_t::GPIO_SUCCESS if successful, error code otherwise

◆ SetDirectionImpl()

virtual hf_gpio_err_t BaseGpio::SetDirectionImpl ( hf_gpio_direction_t direction)
protectedpure virtualnoexcept

Platform-specific implementation for setting pin direction.

Parameters
directionNew pin direction (Input or Output)
Returns
hf_gpio_err_t::GPIO_SUCCESS if successful, error code otherwise

Implemented in EspGpio, and StmGpio.

◆ SetInactive()

hf_gpio_err_t BaseGpio::SetInactive ( )
inlinenoexcept

Set the GPIO to inactive state.

Returns
hf_gpio_err_t::GPIO_SUCCESS if successful, error code otherwise

◆ SetOutputMode()

hf_gpio_err_t BaseGpio::SetOutputMode ( hf_gpio_output_mode_t mode)
inlinenoexcept

Set the output drive mode.

Parameters
modeNew OutputMode setting (PushPull or OpenDrain)
Returns
hf_gpio_err_t::GPIO_SUCCESS if successful, error code otherwise

◆ SetOutputModeImpl()

virtual hf_gpio_err_t BaseGpio::SetOutputModeImpl ( hf_gpio_output_mode_t mode)
protectedpure virtualnoexcept

Platform-specific implementation for setting output mode.

Parameters
modeNew output mode (PushPull or OpenDrain)
Returns
hf_gpio_err_t::GPIO_SUCCESS if successful, error code otherwise

Implemented in EspGpio, and StmGpio.

◆ SetPinLevelImpl()

virtual hf_gpio_err_t BaseGpio::SetPinLevelImpl ( hf_gpio_level_t level)
protectedpure virtualnoexcept

Platform-specific implementation for setting pin electrical level.

Parameters
levelNew electrical level (Low or High)
Returns
hf_gpio_err_t::GPIO_SUCCESS if successful, error code otherwise

Implemented in EspGpio, and StmGpio.

◆ SetPullMode()

hf_gpio_err_t BaseGpio::SetPullMode ( hf_gpio_pull_mode_t mode)
inlinenoexcept

Set the pull resistor mode.

Parameters
modeNew PullMode setting (Floating, PullUp, or PullDown)
Returns
hf_gpio_err_t::GPIO_SUCCESS if successful, error code otherwise

◆ SetPullModeImpl()

virtual hf_gpio_err_t BaseGpio::SetPullModeImpl ( hf_gpio_pull_mode_t mode)
protectedpure virtualnoexcept

Platform-specific implementation for setting pull resistor mode.

Parameters
modeNew pull resistor mode (Floating, PullUp, PullDown)
Returns
hf_gpio_err_t::GPIO_SUCCESS if successful, error code otherwise

Implemented in EspGpio, and StmGpio.

◆ SetState()

hf_gpio_err_t BaseGpio::SetState ( hf_gpio_state_t state)
inlinenoexcept

Set the pin to a specific logical state.

Parameters
stateNew logical state to set (Active or Inactive)
Returns
hf_gpio_err_t::GPIO_SUCCESS if successful, error code otherwise

◆ StateToLevel()

hf_gpio_level_t BaseGpio::StateToLevel ( hf_gpio_state_t state) const
inlineprotectednoexcept

Convert logical state to electrical level based on polarity.

Parameters
stateLogical state (Active or Inactive)
Returns
Electrical level (High or Low)

◆ SupportsInterrupts()

virtual hf_gpio_err_t BaseGpio::SupportsInterrupts ( ) const
inlinevirtualnoexcept

Check if this GPIO implementation supports interrupts.

Returns
true if interrupts are supported, false otherwise

Reimplemented in EspGpio.

◆ Toggle()

hf_gpio_err_t BaseGpio::Toggle ( )
inlinenoexcept

Toggle the GPIO state.

Returns
hf_gpio_err_t::GPIO_SUCCESS if successful, error code otherwise

◆ ToString() [1/7]

const char * BaseGpio::ToString ( hf_gpio_active_state_t active_state)
inlinestaticnoexcept

◆ ToString() [2/7]

const char * BaseGpio::ToString ( hf_gpio_direction_t direction)
inlinestaticnoexcept

◆ ToString() [3/7]

const char * BaseGpio::ToString ( hf_gpio_interrupt_trigger_t trigger)
inlinestaticnoexcept

◆ ToString() [4/7]

const char * BaseGpio::ToString ( hf_gpio_level_t level)
inlinestaticnoexcept

◆ ToString() [5/7]

const char * BaseGpio::ToString ( hf_gpio_output_mode_t output_mode)
inlinestaticnoexcept

◆ ToString() [6/7]

const char * BaseGpio::ToString ( hf_gpio_pull_mode_t pull_mode)
inlinestaticnoexcept

◆ ToString() [7/7]

const char * BaseGpio::ToString ( hf_gpio_state_t state)
inlinestaticnoexcept

◆ ValidateBasicOperation()

hf_gpio_err_t BaseGpio::ValidateBasicOperation ( ) const
inlineprotectednoexcept

Validate basic parameters before GPIO operations.

Returns
hf_gpio_err_t error code

◆ VerifyDirection()

hf_gpio_err_t BaseGpio::VerifyDirection ( hf_gpio_direction_t & direction) const
inlinenoexcept

Verify current direction setting by reading from hardware registers.

Parameters
directionOutput parameter: actual hardware direction setting
Returns
hf_gpio_err_t::GPIO_SUCCESS if successful, error code otherwise

Reads the actual direction configuration from hardware registers for fault detection and verification. Compares against cached value.

Note
Some hardware may not support this operation.

◆ VerifyHardwareConfiguration()

hf_gpio_err_t BaseGpio::VerifyHardwareConfiguration ( ) const
inlinenoexcept

Perform comprehensive hardware verification of all pin settings.

Returns
hf_gpio_err_t::GPIO_SUCCESS if all settings match, error code otherwise

Verifies that all hardware registers match the expected cached values. Useful for detecting hardware faults, register corruption, or power management issues. Updates diagnostics on mismatch.

◆ VerifyOutputMode()

hf_gpio_err_t BaseGpio::VerifyOutputMode ( hf_gpio_output_mode_t & mode) const
inlinenoexcept

Verify current output mode setting by reading from hardware registers.

Parameters
modeOutput parameter: actual hardware output mode setting
Returns
hf_gpio_err_t::GPIO_SUCCESS if successful, error code otherwise

Reads the actual output mode configuration from hardware registers for fault detection and verification. Compares against cached value.

Note
Some hardware may not support this operation.

◆ WaitForInterrupt()

virtual hf_gpio_err_t BaseGpio::WaitForInterrupt ( hf_u32_t timeout_ms = 0)
inlinevirtualnoexcept

Wait for GPIO interrupt to occur.

Parameters
timeout_msTimeout in milliseconds (0 = wait forever)
Returns
hf_gpio_err_t::GPIO_SUCCESS if interrupt occurred, error code otherwise

Reimplemented in EspGpio.

Member Data Documentation

◆ active_state_

hf_gpio_active_state_t BaseGpio::active_state_
protected

Active state polarity.

◆ current_direction_

hf_gpio_direction_t BaseGpio::current_direction_
protected

Current pin direction.

◆ current_state_

hf_gpio_state_t BaseGpio::current_state_
protected

Current logical state.

◆ diagnostics_

hf_gpio_diagnostics_t BaseGpio::diagnostics_
protected

GPIO diagnostic information.

◆ initialized_

bool BaseGpio::initialized_
protected

Initialization state flag.

◆ output_mode_

hf_gpio_output_mode_t BaseGpio::output_mode_
protected

Output drive mode.

◆ pin_

const hf_pin_num_t BaseGpio::pin_
protected

GPIO pin number/identifier.

◆ pull_mode_

hf_gpio_pull_mode_t BaseGpio::pull_mode_
protected

Pull resistor configuration.

◆ statistics_

hf_gpio_statistics_t BaseGpio::statistics_
protected

GPIO operation statistics.


The documentation for this class was generated from the following file: