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_1024_600
            help
                Select the LCD.

            config BSP_LCD_TYPE_1024_600
                bool "LCD 7-inch 1024x600 - ek79007"
            config BSP_LCD_TYPE_1280_800
                bool "LCD 1280x800 - ili9881c"
        endchoice           
        
    endmenu
    
endmenu
