|
Internal Interface Wrap
API reference
|
Advanced MCU-specific implementation of unified BaseGpio with ESP32/ESP-IDF v5.5+ features. More...
#include <EspGpio.h>
Private Member Functions | |
| gpio_int_type_t | MapInterruptTrigger (hf_gpio_interrupt_trigger_t trigger) const noexcept |
| Convert BaseGpio::InterruptTrigger to platform-specific interrupt type. | |
| void IRAM_ATTR | HandleInterrupt () |
| Handle interrupt in instance context. | |
| bool | InitializeAdvancedFeatures () noexcept |
| Initialize advanced features during GPIO initialization. | |
| void | CleanupAdvancedFeatures () noexcept |
| Cleanup advanced feature resources. | |
| void | CleanupGlitchFilters () noexcept |
| Cleanup glitch filter resources. | |
| void | CleanupInterruptSemaphore () noexcept |
| Cleanup interrupt semaphore (called from destructor). | |
| hf_gpio_err_t | WriteImpl (hf_gpio_state_t state) noexcept |
| hf_gpio_err_t | ReadImpl (hf_gpio_state_t &state) noexcept |
Static Private Member Functions | |
| static void IRAM_ATTR | StaticInterruptHandler (void *arg) |
| Static interrupt service routine handler. | |
Private Attributes | |
| hf_gpio_interrupt_trigger_t | interrupt_trigger_ |
| Current interrupt trigger type. | |
| InterruptCallback | interrupt_callback_ |
| User interrupt callback. | |
| void * | interrupt_user_data_ |
| User data for callback. | |
| bool | interrupt_enabled_ |
| Interrupt currently enabled. | |
| std::atomic< hf_u32_t > | interrupt_count_ |
| Number of interrupts occurred (thread-safe) | |
| void * | platform_semaphore_ |
| Platform-specific semaphore for WaitForInterrupt. | |
| bool | isr_handler_added_ |
| Whether ISR handler was added for this pin. | |
| hf_gpio_drive_cap_t | drive_capability_ |
| Current drive capability setting. | |
| hf_gpio_glitch_filter_type_t | glitch_filter_type_ |
| Type of glitch filter configured. | |
| bool | pin_glitch_filter_enabled_ |
| Pin glitch filter enabled. | |
| bool | flex_glitch_filter_enabled_ |
| Flexible glitch filter enabled. | |
| hf_gpio_flex_filter_config_t | flex_filter_config_ |
| Flexible filter configuration. | |
| hf_gpio_sleep_config_t | sleep_config_ |
| Sleep configuration. | |
| bool | hold_enabled_ |
| Hold function enabled. | |
| bool | rtc_gpio_enabled_ |
| RTC GPIO functionality enabled. | |
| hf_gpio_wakeup_config_t | wakeup_config_ |
| Wake-up configuration. | |
| void * | glitch_filter_handle_ |
| Platform-specific glitch filter handle. | |
| void * | rtc_gpio_handle_ |
| Platform-specific RTC GPIO handle. | |
Static Private Attributes | |
| static bool | gpio_isr_handler_installed_ |
| Track if ISR service is installed. | |
Additional Inherited Members | |
Protected Attributes inherited from BaseGpio | |
| 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. | |
Advanced MCU-specific implementation of unified BaseGpio with ESP32/ESP-IDF v5.5+ features.
This class provides a comprehensive implementation of BaseGpio for MCU-based GPIO pins with support for both basic and advanced features including:
Basic Features:
Advanced Features (ESP32/ESP-IDF v5.5+):
|
explicitnoexcept |
Constructor for EspGpio with full configuration including advanced features.
| pin_num | Platform-agnostic GPIO pin number |
| direction | Initial pin direction (Input or Output) |
| active_state | Polarity configuration (High or Low active) |
| output_mode | Output drive mode (PushPull or OpenDrain) |
| pull_mode | Pull resistor configuration (Floating, PullUp, or PullDown) |
| drive_capability | Drive strength capability (Weak to Strongest) |
Creates an MCU GPIO instance with the specified configuration. LAZY INITIALIZATION: The pin is NOT physically configured until the first call to EnsureInitialized(), Initialize(), or any GPIO operation. This allows creating GPIO objects without immediate hardware access.
|
override |
Destructor - ensures proper cleanup including interrupt resources.
|
privatenoexcept |
Cleanup advanced feature resources.
|
privatenoexcept |
Cleanup glitch filter resources.
|
privatenoexcept |
Cleanup interrupt semaphore (called from destructor).
|
overridevirtualnoexcept |
Clear interrupt statistics/counters.
Reimplemented from BaseGpio.
|
noexcept |
Configure flexible glitch filter with custom timing.
| config | Flexible glitch filter configuration |
Flexible glitch filter allows precise control over filtering parameters. Pulses shorter than window_threshold_ns within window_width_ns are filtered.
|
noexcept |
Configure advanced glitch filter (pin/flex) for ESP32.
| filter_type | Glitch filter type (none, pin, flex, both) |
| flex_config | Optional pointer to flexible filter config |
|
noexcept |
Enable GPIO hold function.
| enable | Enable or disable hold function |
Hold function maintains GPIO state during sleep and reset. Useful for maintaining critical pin states during power transitions.
|
overridevirtualnoexcept |
Configure GPIO interrupt settings.
| trigger | Interrupt trigger type |
| callback | Callback function to invoke on interrupt (optional) |
| user_data | User data passed to callback (optional) |
Reimplemented from BaseGpio.
|
noexcept |
Configure pin glitch filter (fixed 2 clock cycles).
| enable | Enable or disable the pin glitch filter |
Pin glitch filter removes pulses shorter than 2 IO_MUX clock cycles. This is a simple, low-overhead filter suitable for basic noise rejection.
|
noexcept |
Configure GPIO sleep behavior.
| config | Sleep configuration parameters |
Configures how the GPIO behaves during sleep modes. Essential for power-optimized applications.
|
noexcept |
Configure sleep mode for ESP32 GPIO.
| sleep_config | Sleep configuration struct |
|
noexcept |
Configure GPIO as wake-up source.
| config | Wake-up configuration parameters |
Enables GPIO to wake the system from deep sleep. Essential for battery-powered applications.
|
overridevirtualnoexcept |
Deinitialize the MCU GPIO pin.
Resets the pin to a safe default state and marks it as uninitialized.
Reimplemented from BaseGpio.
|
noexcept |
Disable all glitch filters.
|
overridevirtualnoexcept |
Disable GPIO interrupt.
Reimplemented from BaseGpio.
|
noexcept |
Enable all configured glitch filters.
|
overridevirtualnoexcept |
Enable GPIO interrupt.
Reimplemented from BaseGpio.
Get count of currently active GPIO instances.
Thread-safe counter for resource monitoring.
|
noexcept |
Get comprehensive GPIO configuration information.
Provides detailed information about current GPIO configuration. Useful for debugging and system validation.
Get human-readable description of this GPIO instance.
Implements BaseGpio.
|
overridevirtualnoexcept |
Get GPIO diagnostics information.
| diagnostics | Reference to store current diagnostics |
Reimplemented from BaseGpio.
|
overrideprotectedvirtualnoexcept |
Platform-specific implementation for reading pin direction from hardware.
| direction | Output parameter: current hardware pin direction |
Reads the actual direction configuration from ESP32 GPIO registers.
Implements BaseGpio.
|
inlinenoexcept |
Get current drive capability setting.
|
overridevirtualnoexcept |
Get current interrupt status and statistics.
| status | Reference to store interrupt status |
Reimplemented from BaseGpio.
|
overridevirtualnoexcept |
Get the maximum number of pins supported by this MCU.
Implements BaseGpio.
|
overrideprotectedvirtualnoexcept |
Platform-specific implementation for reading output mode from hardware.
| mode | Output parameter: current hardware output mode |
Reads the actual output mode configuration from ESP32 GPIO registers.
Implements BaseGpio.
|
noexcept |
Get pin capabilities for comprehensive feature detection.
| capabilities | Output structure to store pin capabilities |
Provides comprehensive information about pin capabilities including ADC, RTC, touch, strapping, and special function support.
|
overrideprotectedvirtualnoexcept |
Platform-specific implementation for reading pin electrical level.
| level | Output parameter: current electrical level (HIGH or LOW) |
Reads the current MCU pin electrical level.
Implements BaseGpio.
|
overrideprotectedvirtualnoexcept |
Platform-specific implementation for reading pull resistor mode.
Queries the current pull resistor configuration from MCU registers.
Implements BaseGpio.
|
overridevirtualnoexcept |
Get GPIO operation statistics.
| statistics | Reference to store current statistics |
Reimplemented from BaseGpio.
|
noexcept |
Get detailed status information for diagnostics.
| status | Output structure to store status information |
Provides comprehensive status information for debugging and monitoring.
Get total interrupt count across all GPIO instances.
Thread-safe global interrupt counter for system monitoring.
|
overridevirtualnoexcept |
Initialize the MCU GPIO pin with current configuration.
Configures the physical MCU pin according to the current direction, pull mode, and output mode settings.
Implements BaseGpio.
|
privatenoexcept |
Initialize advanced features during GPIO initialization.
|
noexcept |
Check if pin is currently held.
|
inlinenoexcept |
Check if the GPIO pin has been initialized.
|
overridevirtualnoexcept |
Check if the pin is available for GPIO operations.
Validates that the pin number is valid and not reserved for special functions like SPI, I2C, etc.
Implements BaseGpio.
|
staticnoexcept |
Check if pin supports RTC GPIO functionality.
| pin_num | Pin number to check |
ESP32: GPIO0-7 support RTC functionality.
|
staticnoexcept |
Check if pin is a strapping pin requiring caution.
| pin_num | Pin number to check |
ESP32 strapping pins: GPIO4, GPIO5, GPIO8, GPIO9, GPIO15.
|
staticnoexcept |
Validate if a pin number is valid for the target platform.
| pin_num | Pin number to validate |
Platform-specific validation using centralized constants.
|
privatenoexcept |
Convert BaseGpio::InterruptTrigger to platform-specific interrupt type.
| trigger | BaseGpio interrupt trigger enum |
|
privatenoexcept |
|
overrideprotectedvirtualnoexcept |
Platform-specific implementation for setting pin direction.
| direction | Desired pin direction (Input or Output) |
Reconfigures the MCU pin as input or output with appropriate pull resistor and drive mode settings.
Implements BaseGpio.
|
noexcept |
Set GPIO drive capability.
| capability | New drive capability level |
Controls the output drive strength from ~5mA (Weak) to ~40mA (Strongest). Higher drive capability allows for faster switching and driving larger loads but increases power consumption and EMI.
|
overrideprotectedvirtualnoexcept |
Platform-specific implementation for setting output mode.
| mode | Desired output mode (PushPull or OpenDrain) |
Changes the output drive characteristics of the MCU pin.
Implements BaseGpio.
|
overrideprotectedvirtualnoexcept |
Platform-specific implementation for setting pin electrical level.
| level | Desired electrical level (HIGH or LOW) |
Sets the MCU pin to the specified electrical level.
Implements BaseGpio.
|
overrideprotectedvirtualnoexcept |
Platform-specific implementation for setting pull resistor mode.
| mode | Desired PullMode configuration (Floating, PullUp, or PullDown) |
Configures the MCU's internal pull resistors.
Implements BaseGpio.
Static interrupt service routine handler.
| arg | Pointer to EspGpio instance |
|
noexcept |
Check if glitch filters are supported.
|
overridevirtualnoexcept |
MCU GPIO supports interrupts.
Reimplemented from BaseGpio.
|
noexcept |
Check if pin supports RTC GPIO functionality.
|
overridevirtualnoexcept |
Wait for GPIO interrupt with timeout.
| timeout_ms | Timeout in milliseconds (0 = no timeout) |
Reimplemented from BaseGpio.
|
privatenoexcept |
|
private |
Current drive capability setting.
|
private |
Flexible filter configuration.
|
private |
Flexible glitch filter enabled.
|
private |
Platform-specific glitch filter handle.
|
private |
Type of glitch filter configured.
|
staticprivate |
Track if ISR service is installed.
|
private |
Hold function enabled.
|
private |
User interrupt callback.
|
private |
Number of interrupts occurred (thread-safe)
|
private |
Interrupt currently enabled.
|
private |
Current interrupt trigger type.
|
private |
User data for callback.
|
private |
Whether ISR handler was added for this pin.
|
private |
Pin glitch filter enabled.
|
private |
Platform-specific semaphore for WaitForInterrupt.
|
private |
RTC GPIO functionality enabled.
|
private |
Platform-specific RTC GPIO handle.
|
private |
Sleep configuration.
|
private |
Wake-up configuration.