Skip to content

Hardware Peripheral Drivers

The Hardware_Peripheral_Drivers module is the Hardware Abstraction Layer (HAL) for all on-board peripheral devices across the supported ESP32 and ESP32-S3 board family. It provides self-contained, board-agnostic C drivers for every hardware peripheral — displays, touch controllers, physical inputs, I/O expanders, buses, sensors, and the buzzer — with board-specific wiring injected at runtime through typed configuration structures.

The module is shared across all board variants (boards/*/components/bsp/) without modification. Each Board Support Package (BSP) selects, configures, and composes these drivers in its board_init.c.


ESP-IDF

Application Layer (Core 1)

Board Support Package (boards/)

Hardware_Peripheral_Drivers (hardware/)

configure() calls

configure() calls

configure() calls

configure() calls

bus_i2c_init()

phy_*_configure()

io_*_configure()

sensor_analog_configure()

buzzer_configure()

lv_display_flush_ready()

lvgl_flush_cb → draw_bitmap()

lvgl_flush_cb → draw_bitmap()

lvgl_flush_cb → draw_bitmap()

touch_read_cb → *_read()

*_read_cb → lv_indev

display_spi_drivers

ILI9341 · ST7796S · JD9853 · ST7789

hardware/common/drivers/

display_i80_drivers

RM68120 · ST7796-i80

hardware/drivers_video_i80/

display_rgb_drivers

EK9716 · ILI9485 · ST7262

hardware/drivers_video_rgb/

touch_drivers

FT5x06 · FT6336U · GT911 · XPT2046 · AXS5106L

hardware/common/drivers/

bus_drivers

bus_i2c · bus_sw_spi

hardware/common/drivers/

physical_input

phy_buttons · phy_encoder

phy_potentiometer · phy_switch

hardware/common/drivers/

io_expanders

CH422G · TCA9554

hardware/common/drivers/

analog_sensor

ADC oneshot

hardware/common/drivers/

buzzer

LEDC PWM driver

hardware/common/drivers/

usb_cdc_device

TinyUSB dual CDC-ACM

hardware/drivers_usb_device/

board_init.c

(per-board)

LVGL / UIManager

esp_lcd

(SPI · I80 · RGB panels)

esp_adc

(oneshot)

pulse_cnt

(encoder)

driver/gpio

driver/ledc

driver/i2c


Three parallel-bus families are supported. Each implements the standard esp_lcd_panel_t vtable, allowing LVGL and the BSP to call the same uniform panel API regardless of the underlying controller.

RGB Parallel - display_rgb_drivers

ST7262

disp_st7262/

EK9716

disp_ek9716/

ILI9485

disp_ili9485/

I80 Parallel - display_i80_drivers

RM68120

disp_rm68120/

ST7796-i80

disp_st7796_i80/

SPI - display_spi_drivers

ILI9341

disp_ili9341/

ST7796S

disp_st7796/

JD9853

disp_jd9853/

ST7789

disp_st7789/

backlight_config_t

disp_backlight/

esp_lcd_panel_t vtable

(esp-idf)

FamilyFramebufferFlush triggerBoards
SPIController GRAMon_color_trans_done ISRpibot_pendant_v1_0, esp32_2432s028r, esp32_3248s035*, esp32s3_bzm_tft35_gt911, ESP32_S3_TOUCH_LCD_1_47 (JD9853), ESP32_S3_LCD_1_47B (ST7789)
I80Controller GRAMnotify_flush_ready ISResp32s3_hmi43v3, esp32s3_zx3d50ce02s_usrc_4832
RGBESP32-S3 PSRAMVSync semaphoreesp32s3_4827s043c, esp32s3_8048s043c, esp32s3_8048s050c, esp32s3_8048s070c, esp32s3_8048_touch_lcd_7

bus_drivers

touch_drivers

touch_ft5x06

Capacitive I²C

touch_ft6336u

Capacitive I²C

touch_gt911

Capacitive I²C

touch_xpt2046

Resistive SPI

touch_axs5106

Capacitive I²C

bus_i2c

shared I²C

bus_sw_spi

bit-bang SPI

driver/i2c_master.h

(new I²C API, BSP-owned bus)

io_expanders

CH422G · TCA9554

physical_input

phy_buttons

3× push-button

(GPIO + debounce)

phy_encoder

Quadrature rotary

(PCNT 4× decode)

phy_potentiometer

Analog wiper

(ADC oneshot)

phy_switch

4-position selector

(GPIO decode)

BSP *_read_cb()

LVGL lv_indev_t

Hardware Driver (C)

Application Layer (C++) - main/modules/buzzer/

ESP3DSound (esp3d_sound)

semantic events · NVS enable/disable

definitions: compiled defaults / ui_resources / /esp3dsound.ini

ESP3DSoundBackend

tone backend (esp3d_sound_backend_tone.cpp)

buzzer.c

LEDC PWM

hardware/common/drivers/buzzer/

board_init()

buzzer_configure()

The former Buzzer class (esp3d_buzzer.h) is replaced by the sound module: callers play a semantic event (ESP3DSoundEvent::selection, error, startup, …) and the backend interface keeps the door open for an audio decoder later. See sound_system.md.

hardware/drivers_usb_device/usb_cdc_device/ is the sole owner of TinyUSB (espressif/esp_tinyusb ^1): driver installation, descriptors, two CDC-ACM interfaces and the low-level RX/TX primitives. CDC #0 (USB_CDC_DEVICE_PORT_COMMAND) carries the ESP3D command / monitoring client (or the CNC output with [ESP950]USB-CDC); CDC #1 (USB_CDC_DEVICE_PORT_LOG) carries the log backend. usb_cdc_device_init() is idempotent and the driver is never uninstalled at runtime. Once installed, TinyUSB owns the USB PHY: USB-Serial-JTAG and esptool auto-reset are gone, flashing needs BOOT + RESET. Only boards that set BOARD_USB_CDC_DEVICE_SUPPORTED add this component (USB_CDC_DEVICE_SERVICE). Study: usb_device_cdc_client_study.md. It is not the USB host (OTG) driver used for a USB-serial CNC link (hardware/drivers_usb_otg/, see usb_serial).

AXS5106L note — unlike the other touch drivers (legacy I²C API through bus_i2c), it uses the new driver/i2c_master.h API: the 1.47” BSP creates the bus with i2c_new_master_bus() and passes the handle in touch_axs5106_config_t.i2c_bus (see i2c_new_api_migration.md). The controller does not support an I²C repeated start: the driver writes the register address, then reads in a separate transaction (i2c_master_transmit_receive did not work on hardware, as in the Waveshare reference).


ConstraintApplies to
No heap allocation in drivers — all state is staticAll sub-modules
Single driver instance per chip type — singleton patternIO expanders, touch, sensor
No blocking in LVGL task (Core 1) — ISR-only flush signalsDisplay drivers (SPI, I80, RGB)
FreeRTOS-safe ISRs — only xQueueSendFromISR / volatile flagsEncoder PCNT ISR, touch INT ISRs
I²C bus deduplication — s_installed[] guard prevents double-initbus_i2c
ADC2 / WiFi conflict — always use ADC1 when WiFi activesensor_analog, phy_potentiometer

Sub-ModuleDocumentation
Display — SPI (ILI9341, ST7796S, JD9853, ST7789, backlight)docs/architecture/display_drivers.md
Display — I80 parallel (RM68120, ST7796-i80)docs/architecture/display_drivers.md
Display — RGB parallel (EK9716, ILI9485, ST7262)docs/architecture/display_drivers.md
Touch controllers (FT5x06, FT6336U, GT911, XPT2046, AXS5106L)docs/architecture/display_drivers.md, docs/architecture/Input_system.md
Bus drivers (bus_i2c, bus_sw_spi)docs/architecture/display_drivers.md
Physical inputs (buttons, encoder, potentiometer, switch)docs/architecture/Input_system.md
I/O expanders (CH422G, TCA9554)docs/architecture/shared_sd_mechanism_V2.0.md
Analog sensor (ADC oneshot)docs/features/features.md
Sound (LEDC driver + sound module)docs/architecture/sound_system.md, docs/Factory/factory_app_technical_doc.md (factory buzzer)
Native USB CDC device (TinyUSB)docs/ongoing_reflection/usb_device_cdc_client_study.md
Board build guidelines and portingdocs/guides/board_build_guidelines.md
ESP32 memory constraintsdocs/guides/esp32_memory_constraints.md
UI resources (icons, fonts, partition)docs/ui_resources/development.md

Legacy documents (phase-1 naming duplicates)

Section titled “Legacy documents (phase-1 naming duplicates)”