# The following lines of boilerplate have to be in your project's CMakeLists
# in this exact order for cmake to work correctly
cmake_minimum_required(VERSION 3.16)

include($ENV{IDF_PATH}/tools/cmake/project.cmake)
# "Trim" the build. Include the minimal set of components, main, and anything it depends on.
idf_build_set_property(MINIMAL_BUILD ON)
project(mipi_isp_dsi)

# This panel does not return a reliable BTA response on the ESP32-P4 DSI read
# path. Its ID is informational, so keep panel initialization write-only.
idf_component_get_property(st7123_component_lib esp_lcd_st7123 COMPONENT_LIB)
target_compile_definitions(${st7123_component_lib} PRIVATE
    ST7123_READ_ID=0
    ST7123_DEFER_COLMOD=1
)

# Keep the command and video paths write-only on this panel. These settings
# match the stabilized ST7123 hardware-test path for the Unit PoE-P4.
idf_component_get_property(dsi_init_component_lib dsi_init COMPONENT_LIB)
target_compile_definitions(${dsi_init_component_lib} PRIVATE
    DSI_INIT_DIRECT_GPIO_BACKLIGHT=1
    DSI_INIT_PREINIT_BACKLIGHT=1
    DSI_INIT_DIRECT_FB_CLEAR=1
    DSI_INIT_NUM_FBS=2
    DSI_INIT_WRITE_ONLY_VIDEO=1
    DSI_INIT_DISABLE_UNDERRUN_IRQ=1
)
