menu "Board Support Package"

    config BSP_ERROR_CHECK
        bool "Enable error check in BSP"
        default y
        help
            Error check assert the application before returning the error code.

    menu "I2C"
        config BSP_I2C_NUM
            int "I2C peripheral index"
            default 1
            range 0 1
            help
                ESP32S3 has two I2C peripherals, pick the one you want to use.

        config BSP_I2C_FAST_MODE
            bool "Enable I2C fast mode"
            default y
            help
                I2C has two speed modes: normal (100kHz) and fast (400kHz).

        config BSP_I2C_CLK_SPEED_HZ
            int
            default 400000 if BSP_I2C_FAST_MODE
            default 100000
    endmenu

    menu "LCD"
        config BSP_LCD_RGB_BOUNCE_BUFFER
            bool "Enable to use bounce buffer"
            default "y"
            help
                Let RGB LCD driver create two little internal buffers. It can prevent screen drift when using wifi or writing to flash.

        config BSP_LCD_RGB_BOUNCE_BUFFER_HEIGHT
            int "Bounce buffer height"
            depends on BSP_LCD_RGB_BOUNCE_BUFFER
            default 10
            help
                Height of bounce buffer. The width of the buffer is the same as that of the LCD.

        config BSP_LCD_RGB_DOUBLE_BUFFER
            bool "Enable to use double frame buffers"
            default "n"
            help
                Let RGB LCD driver create two frame size buffers. It's a necessary configuration to avoiding tearing effect.

        config BSP_LCD_RGB_REFRESH_TASK_ENABLE
            bool "Enable to refresh LCD manually"
            depends on !BSP_LCD_RGB_BOUNCE_BUFFER
            default "n"
            help
                Refresh the LCD in a specific task instead of automatically refreshing. It's a necessary configuration to avoiding tearing effect.

        config BSP_LCD_RGB_REFRESH_TASK_PERIOD
            int "Minimum Period(ms) of LCD refreshing task"
            depends on BSP_LCD_RGB_REFRESH_TASK_ENABLE
            default 10
            help
               This configuration does not necessarily represent the actual refresh cycle of the RGB interface.

        config BSP_LCD_RGB_REFRESH_TASK_PRIORITY
            int "Priority of LCD refreshing task"
            depends on BSP_LCD_RGB_REFRESH_TASK_ENABLE
            default 2
    endmenu

    menu "Display"
        config BSP_DISPLAY_LVGL_TASK_PRIORITY
            int "LVGL task priority"
            default 2
            help
                The Board Support Package will create a task that will periodically handle LVGL operation in lv_timer_handler().

        config BSP_DISPLAY_LVGL_TICK
            int "LVGL tick period"
            default 5
            range 1 100
            help
                Period of LVGL tick timer.

        config BSP_DISPLAY_LVGL_AVOID_TEAR
            bool "Avoid tearing effect"
            depends on BSP_LCD_RGB_REFRESH_TASK_ENABLE && BSP_LCD_RGB_DOUBLE_BUFFER
            default "n"
            help
                Avoid tearing effect through LVGL buffer mode and double frame buffers of RGB LCD. This feature is only available for RGB LCD.

        choice BSP_DISPLAY_LVGL_MODE
            depends on BSP_DISPLAY_LVGL_AVOID_TEAR
            prompt "Select LVGL buffer mode"
            default BSP_DISPLAY_LVGL_FULL_REFRESH
            config BSP_DISPLAY_LVGL_FULL_REFRESH
                bool "Full refresh"
            config BSP_DISPLAY_LVGL_DIRECT_MODE
                bool "Direct mode"
        endchoice

        choice BSP_DISPLAY_LVGL_BUF_CAPS
            depends on !BSP_DISPLAY_LVGL_AVOID_TEAR
            prompt "Select LVGL buffer memory capability"
            default BSP_DISPLAY_LVGL_INTERNAL
            config BSP_DISPLAY_LVGL_PSRAM
                bool "PSRAM memory"
            config BSP_DISPLAY_LVGL_INTERNAL
                bool "Internal memory"
        endchoice

        config BSP_DISPLAY_LVGL_BUF_HEIGHT
            depends on !BSP_DISPLAY_LVGL_AVOID_TEAR
            int "LVGL buffer height"
            default 10
            help
                Height of LVGL buffer. The width of the buffer is the same as that of the LCD.
    endmenu

    config BSP_I2S_NUM
        int "I2S peripheral index"
        default 1
        range 0 1
        help
            ESP32S3 has two I2S peripherals, pick the one you want to use.
endmenu
