Skip to content

BSP Board Initialization

The BSP Board Initialization module is the hardware abstraction entry point for every supported board in the ESP3D pendant firmware. Each board ships its own board_init.c implementing a common C interface (board_init.h) that the application calls once at startup via ESP3DX::begin().

The module is responsible for:

  • Powering on and configuring the display panel (SPI / I80 / RGB parallel)
  • Setting up LVGL draw buffers, the flush pipeline, and the tick timer
  • Registering touch, button, encoder, switch, and potentiometer input devices with LVGL
  • Initialising the activity manager (screen wake/sleep arbitration)
  • Delegating to control_events_init() to register board-specific LVGL custom events

Boards that have no display (e.g. fysetc_wifi_pro) implement a minimal stub that still satisfies the interface.


Board IDDisplayBusTouch ICExtra Inputs
esp32s3_8048s070cEK9716 800×480RGB parallelGT911—
esp32s3_bzm_tft35_gt911ST7796 480×320SPIGT911—
esp32s3_hmi43v3RM68120 800×480I80FT5x06TCA9554 I/O expander
esp32s3_zx3d50ce02s_usrc_4832ST7796 480×320I80FT5x06—
fysetc_wifi_pro(none)———
pibot_pendant_v1_0ILI9341 320×240SPIFT6336UButtons, encoder, 4-pos switch, potentiometer, buzzer

init_lvgl()

lv_init()

lv_display_create()

Allocate draw buffer(s)

DMA / SPIRAM

lv_display_set_flush_cb()

esp_timer_create(increase_lvgl_tick)

lv_indev_create() × N

app_main / ESP3DX::begin()

board_init()

activity_manager_init()

backlight_configure() + set(0)

Display panel configure

(SPI / I80 / RGB)

init_touch_controller()

init_lvgl()

control_events_init()

backlight_set(DEFAULT_LEVEL)


LVGLTouch ICDisplay PanelActivityManagerboard_init()ApplicationLVGLTouch ICDisplay PanelActivityManagerboard_init()Applicationboard_init()activity_manager_init()ESP_OKconfigure (SPI/I80/RGB)ESP_OK + panel handleinit_touch_controller()ESP_OKinit_lvgl()lv_init()lv_display_create()heap_caps_malloc(draw buf)register flush_cb / tick timerlv_indev_create() per deviceESP_OKbacklight_set(DEFAULT)ESP_OK

Each board’s lvgl_flush_cb() pushes a rendered pixel region to the panel using one of three synchronisation strategies, driven by the display bus type:

RGB parallel (EK9716)

I80 (RM68120 / ST7796-I80)

SPI (ILI9341 / ST7796)

LVGL render engine

lvgl_flush_cb()

esp_lcd_panel_draw_bitmap()

notify_lvgl_flush_ready()

(on_color_trans_done ISR)

lvgl_flush_cb()

esp_lcd_panel_draw_bitmap()

i80_flush_ready_cb()

(I80 bus done ISR)

lvgl_flush_cb()

xSemaphoreGive(sem_gui_ready)

xSemaphoreTake(sem_vsync_end)

esp_lcd_panel_draw_bitmap()

disp_on_vsync_event()

(VSYNC ISR)


configures

configures

configures

feeds

initialises

delegates

uses

uses

uses (PiBot)

runs on

panel handle →

touch data →

input events →

bsp_board_initialization

(board_init.c)

Display Drivers

(SPI / I80 / RGB)

Touch Controllers

(GT911 / FT5x06 / FT6336U)

Physical Inputs

(buttons / encoder / switch / pot)

LVGL Integration

(display + indev registration)

Activity Manager

(wake/sleep arbitration)

Control Events

(board-specific LVGL events)

Bus Drivers

(I2C / SPI)

IO Expanders

(TCA9554 on hmi43v3)

Buzzer

LVGL (Core 1)


The bsp_board_initialization module is further documented across four sub-module files. Each file is self-contained and focuses on one functional area that is shared (or specialised) across the board variants.

Sub-module fileScopeBoards covered
bsp_board_initialization_lvgl.mdinit_lvgl(), increase_lvgl_tick(), draw-buffer allocation (DMA vs SPIRAM), LVGL display/indev registration, accessor functions (get_lvgl_display, get_lvgl_lock, get_touch_indev)All display boards
bsp_board_initialization_display.mdlvgl_flush_cb() per bus type, notify_lvgl_flush_ready (SPI), i80_flush_ready_cb (I80), disp_on_vsync_event + dual-semaphore sync (RGB), bsp_accessFs / bsp_releaseFs pixel-clock patchAll display boards
bsp_board_initialization_touch.mdinit_touch_controller(), touch_read_cb() wake-up state machine (transition detection, consumed-for-wakeup flag), GT911 native-to-panel coordinate mappingAll touch boards
bsp_board_initialization_inputs.mdbutton_read_cb() (3-button, per-button wake-up, LV_EVENT_PRESSED/RELEASED), encoder_read_cb() (adaptive speed, ±1 step normalisation), switch_read_cb() (4-position, invalid-state guard), potentiometer_read_cb() (ADC→0–100 mapping, adaptive threshold, inactivity timeout)pibot_pendant_v1_0 only

The fysetc_wifi_pro board has no display, no touch panel, and no hardware controls. Its board_init() is a minimal stub:

esp_err_t board_init(void)
{
esp3d_log("Initializing %s %s", BOARD_NAME_STR, BOARD_VERSION_STR);
esp3d_log("Headless WiFi+SD board — no display, no touch, no hardware controls");
return ESP_OK;
}

This board acts purely as a network and SD gateway; all UI runs over the WebUI served from the Network, Web Services & Discovery layer.


Related ModuleRelationship
BSP Control Eventscontrol_events_init() is called at the end of board_init() to register board-specific LVGL custom events and input-device group bindings
Display Drivers — SPIboard_init calls ili9341_spi_configure() / st7796_spi_configure() to obtain the panel and IO handles used in init_lvgl()
Display Drivers — I80board_init calls disp_rm68120_configure() / disp_st7796_i80_configure() and passes the i80_flush_ready_cb ISR
Display Drivers — RGBboard_init calls disp_ek9716_configure() and registers disp_on_vsync_event via esp_lcd_rgb_panel_register_event_callbacks()
Touch Controllersinit_touch_controller() delegates to touch_gt911_configure(), touch_ft5x06_configure(), or touch_ft6336u_configure()
IO Expandersesp32s3_hmi43v3 calls io_tca9554_configure() before display or touch init to gate the shared I2C bus
Bus DriversAll touch drivers share an I2C bus initialised by bus_i2c_init() inside init_touch_controller()
Physical InputsPiBot pendant configures phy_buttons, phy_encoder, phy_switch, phy_potentiometer inside board_init()
BuzzerPiBot pendant calls buzzer_configure() inside board_init()
UI Framework — display_coreThe LVGL task (tft_ui_task) picks up the display handle and lock returned by get_lvgl_display() / get_lvgl_lock()
Core Platform — activity_manageractivity_manager_init() is the first call in every board_init(); activity_process_event() is used in every input read callback

FlagEffect
ESP3D_DISPLAY_FEATUREGuards all display and LVGL init; without it board_init() only calls activity_manager_init()
ESP3D_TOUCH_FEATUREEnables init_touch_controller() and registers touch_indev in LVGL
ESP3D_BRIGHTNESS_CONTROL_FEATUREEnables backlight_configure() and the set-to-0 / set-to-default bracket around display init
ESP3D_SNAPSHOT_FEATUREEnables in-lvgl_flush_cb pixel capture to file (screenshot to SD)
ESP3D_PATCH_FS_ACCESS_RELEASEEnables bsp_accessFs() / bsp_releaseFs() to throttle RGB pixel clock during SD access
ESP3D_HARDWARE_BUTTONS_FEATUREEnables button_read_cb() and button_indev (PiBot only)
ESP3D_HARDWARE_ENCODER_FEATUREEnables encoder_read_cb() and encoder_indev (PiBot only)
ESP3D_HARDWARE_SWITCH_FEATUREEnables switch_read_cb() and switch_indev (PiBot only)
ESP3D_HARDWARE_POTENTIOMETER_FEATUREEnables potentiometer_read_cb() and potentiometer_indev (PiBot only)
ESP3D_BUZZER_FEATUREEnables buzzer_configure() (PiBot only)
DISPLAY_USE_DOUBLE_BUFFER_FLAGAllocates a second draw buffer for reduced tearing on SPI/I80 boards