menu "Board Support Package(ESP32-P4)"

    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
                ESP32P4 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 "I2S"
        config BSP_I2S_NUM
            int "I2S peripheral index"
            default 1
            range 0 2
            help
                ESP32P4 has three I2S peripherals, pick the one you want to use.
    endmenu

    menu "uSD card - Virtual File System"
        config BSP_SD_FORMAT_ON_MOUNT_FAIL
            bool "Format uSD card if mounting fails"
            default n
            help
                The SDMMC host will format (FAT) the uSD card if it fails to mount the filesystem.

        config BSP_SD_MOUNT_POINT
            string "uSD card mount point"
            default "/sdcard"
            help
                Mount point of the uSD card in the Virtual File System

    endmenu

    menu "SPIFFS - Virtual File System"
        config BSP_SPIFFS_FORMAT_ON_MOUNT_FAIL
            bool "Format SPIFFS if mounting fails"
            default n
            help
                Format SPIFFS if it fails to mount the filesystem.

        config BSP_SPIFFS_MOUNT_POINT
            string "SPIFFS mount point"
            default "/spiffs"
            help
                Mount point of SPIFFS in the Virtual File System.

        config BSP_SPIFFS_PARTITION_LABEL
            string "Partition label of SPIFFS"
            default "storage"
            help
                Partition label which stores SPIFFS.

        config BSP_SPIFFS_MAX_FILES
            int "Max files supported for SPIFFS VFS"
            default 5
            help
                Supported max files for SPIFFS in the Virtual File System.
    endmenu

    menu "Display"
        config BSP_LCD_DPI_BUFFER_NUMS
            int "Set number of frame buffers"
            default 1
            range 1 3
            help
                Let DPI LCD driver create a specified number of frame-size buffers. Only when it is set to multiple can the avoiding tearing be turned on.

        config BSP_DISPLAY_LVGL_AVOID_TEAR
            bool "Avoid tearing effect"
            depends on BSP_LCD_DPI_BUFFER_NUMS > 1
            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
            
        config BSP_DISPLAY_BRIGHTNESS_LEDC_CH
        int "LEDC channel index"
        default 1
        range 0 7
        help
            LEDC channel is used to generate PWM signal that controls display brightness.
            Set LEDC index that should be used.

        choice BSP_LCD_COLOR_FORMAT
            prompt "Select LCD color format"
            default BSP_LCD_COLOR_FORMAT_RGB565
            help
                Select the LCD color format RGB565/RGB888.

            config BSP_LCD_COLOR_FORMAT_RGB565
                bool "RGB565"
            config BSP_LCD_COLOR_FORMAT_RGB888
                bool "RGB888"
        endchoice   
            
        choice BSP_LCD_TYPE
            prompt "Select LCD type"
            default BSP_LCD_TYPE_800_1280_10_1_INCH
            help
                Select the LCD.

            config BSP_LCD_TYPE_800_1280_10_1_INCH
                bool "Waveshare 101M-8001280-IPS-CT-K Display"
            config BSP_LCD_TYPE_800_1280_10_1_INCH_A
                bool "Waveshare 10.1-DSI-TOUCH-A Display"
            config BSP_LCD_TYPE_800_1280_8_INCH_A
                bool "Waveshare 8-DSI-TOUCH-A Display"
            config BSP_LCD_TYPE_720_1280_7_INCH_A
                bool "Waveshare 7-DSI-TOUCH-A Display"
            config BSP_LCD_TYPE_480_640_2_8_INCH
                bool "Waveshare 2.8inch DSI LCD Display"
            config BSP_LCD_TYPE_800_800_3_4_INCH_C
                bool "Waveshare 3.4inch DSI LCD (C) Display"
            config BSP_LCD_TYPE_720_720_4_INCH_C
                bool "Waveshare 4inch DSI LCD (C) Display"
            config BSP_LCD_TYPE_480_800_4_INCH
                bool "Waveshare 4inch DSI LCD Display"
            config BSP_LCD_TYPE_720_1280_5_INCH_D
                bool "Waveshare 5inch DSI LCD (D) Display"
            config BSP_LCD_TYPE_720_1560_6_25_INCH
                bool "Waveshare 6.25inch DSI LCD Display"
            config BSP_LCD_TYPE_1024_600_5_INCH_C
                bool "Waveshare 5inch DSI LCD (C) Display"
            config BSP_LCD_TYPE_1024_600_7_INCH_C
                bool "Waveshare 7inch DSI LCD (C) Display"
            config BSP_LCD_TYPE_400_1280_7_9_INCH
                bool "Waveshare 7.9inch DSI LCD Display"
            config BSP_LCD_TYPE_1280_800_7_INCH_E
                bool "Waveshare 7inch DSI LCD (E) Display"
            config BSP_LCD_TYPE_1280_800_8_INCH_C
                bool "Waveshare 8inch DSI LCD (C) Display"
            config BSP_LCD_TYPE_1280_800_10_1_INCH_C
                bool "Waveshare 10.1inch DSI LCD (C) Display"
            config BSP_LCD_TYPE_480_1920_8_8_INCH
                bool "Waveshare 8.8inch DSI LCD Display"
            config BSP_LCD_TYPE_320_1480_11_9_INCH
                bool "Waveshare 11.9inch DSI LCD Display"
        endchoice

        config BSP_LCD_MIPI_DSI_LANE_BITRATE_MBPS
        int "MIPI DSI lane bitrate (Mbps)"
        default 1500
        range 600 1500
        help
            Set the lane bitrate for the MIPI DSI interface in Mbps.
            Adjust this value based on the display's requirements and capabilities.
            Try 840, 860, 933, 1000, 1200, 1500.

        
    endmenu
    
endmenu
