Skip to content

ENABLE_GPIO_ABSTRACTION

Flag to select the GPIO read implementation.

Controls whether GPIO reads use direct register access or the ESP-IDF HAL API (gpio_get_level).


Default

  • v2: Enabled by default (ENABLE_GPIO_ABSTRACTION=1, HAL API) — set in platformio.ini
  • v1: Disabled by default (ENABLE_GPIO_ABSTRACTION=0, direct register access)

Options

  • ENABLE_GPIO_ABSTRACTION=0: Use direct register access via 0x3FF4403C (default, maximum performance)
  • ENABLE_GPIO_ABSTRACTION=1: Use gpio_get_level() HAL API (better readability, negligible overhead)

Override with platformio.override.ini

[env:esp32dev-v2]
build_flags =
    -D ENABLE_GPIO_ABSTRACTION=1

Trade-offs

Feature =0 (v1 default) =1 (v2 default, HAL)
Performance Maximum (direct register) Negligible overhead
Readability Lower Higher
Portability ESP32-specific ESP-IDF portable

History

  • v1.6.8 — Initial implementation