# BSP API Include `bsp/esp-bsp.h` or `bsp/ksdiy_s31_43.h`. | API | Contract | |---|---| | `lv_display_t *bsp_display_start(void)` | Start singleton LCD, backlight, ST7123 and LVGL task. Returns the display. Call in task context, without holding the LVGL lock. Initialization failures use `ESP_ERROR_CHECK`. | | `bool bsp_display_lock(uint32_t timeout_ms)` | Acquire LVGL lock; 0 waits indefinitely. Returns false on timeout or timeout values above `INT_MAX`. | | `void bsp_display_unlock(void)` | Release a previously acquired LVGL lock. | | `esp_err_t bsp_display_brightness_set(int percent)` | Set PWM brightness, 0..100. Out-of-range values return `ESP_ERR_INVALID_ARG`. Use after display startup. | | `esp_lcd_panel_handle_t bsp_display_get_panel_handle(void)` | Borrowed panel handle; NULL before startup. Do not destroy it. | | `esp_lcd_touch_handle_t bsp_touch_get_handle(void)` | Borrowed touch handle; NULL before startup. Do not destroy it. | `BSP_LCD_H_RES=480`, `BSP_LCD_V_RES=800` and `BSP_LCD_BITS_PER_PIXEL=16` describe the framebuffer. Panel output uses 24-bit RGB888 slots with the upper six bits of each channel connected to 18 physical pins. The BSP owns I2C controller 0 and a shared LCD/touch reset. Do not initialize the same controller independently or reset the touch while the LCD is running. No deinitialization or display rotation API is provided in this release. ## Legacy API `ksdiy_lvgl_port.h` remains available. `ksdiy_lvgl_lock(-1)` waits indefinitely; the legacy implementation also treats 0 as an infinite wait. `ksdiy_lcd_set_brightness(uint8_t)` uses a **0..255** PWM value, whereas `bsp_display_brightness_set(int)` uses **0..100 percent**. `ksdiy_rgb_color.h` and `ksdiy_st7102_rgb.h` expose the retained diagnostic helpers and legacy tuning macros. Normal applications should use color mode 0 and the default RGB888 upper-six-bit output. These helpers are not a substitute for a matching module FPC/pad map.
idf.py add-dependency "kevincoooool/ksdiy_s31_43_bsp^0.1.0"