# NOTES:
# - default <> if <> work only when no prompt is available for the user

menu "LVGL TFT Display controller"

    # Predefined display configurations for multiple
    # evaluation/development boards.
    choice LV_PREDEFINED_DISPLAY
        prompt "Select predefined display configuration"
        default LV_PREDEFINED_DISPLAY_NONE
        help
            Select predefined display configuration

        config LV_PREDEFINED_DISPLAY_NONE
            bool "None"
        config LV_PREDEFINED_DISPLAY_WROVER4
            bool "ESP-Wrover-KIT v4.1"
            select LV_TFT_DISPLAY_CONTROLLER_ILI9341
            select LV_TFT_DISPLAY_PROTOCOL_SPI
        config LV_PREDEFINED_DISPLAY_M5STACK
            bool "M5Stack"
            select LV_TFT_DISPLAY_CONTROLLER_ILI9341
            select LV_TFT_DISPLAY_PROTOCOL_SPI
        config LV_PREDEFINED_DISPLAY_M5STICK
            bool "M5Stick"
            select LV_TFT_DISPLAY_CONTROLLER_SH1107
            select LV_TFT_DISPLAY_PROTOCOL_SPI
            select LV_TFT_DISPLAY_MONOCHROME
            select LV_THEME_MONO
        config LV_PREDEFINED_DISPLAY_M5STICKC
            bool "M5StickC"
            select LV_TFT_DISPLAY_CONTROLLER_ST7735S
            select LV_TFT_DISPLAY_PROTOCOL_SPI
        config LV_PREDEFINED_DISPLAY_ERTFT0356
            bool "ER-TFT035-6"
            select LV_TFT_DISPLAY_CONTROLLER_ILI9488
            select LV_TFT_DISPLAY_PROTOCOL_SPI
        config LV_PREDEFINED_DISPLAY_ADA_FEATHERWING
            bool "Adafruit 3.5 Featherwing"
            select LV_TFT_DISPLAY_CONTROLLER_HX8357
            select LV_TFT_DISPLAY_PROTOCOL_SPI
       config LV_PREDEFINED_DISPLAY_RPI_MPI3501
            bool "RPi MPI3501"
            select LV_TFT_DISPLAY_CONTROLLER_ILI9486
            select LV_TFT_DISPLAY_PROTOCOL_SPI
        config LV_PREDEFINED_DISPLAY_WEMOS_LOLIN
            bool "Wemos Lolin OLED"
            select LV_TFT_DISPLAY_CONTROLLER_SSD1306
            select LV_TFT_DISPLAY_PROTOCOL_I2C
            select LV_TFT_DISPLAY_MONOCHROME
            select LV_THEME_MONO
        config LV_PREDEFINED_DISPLAY_ATAG
            bool "AIRcable ATAGv3"
            select LV_TFT_DISPLAY_CONTROLLER_IL3820
            select LV_TFT_DISPLAY_PROTOCOL_SPI
            select LV_TFT_DISPLAY_MONOCHROME
            select LV_THEME_MONO
        config LV_PREDEFINED_DISPLAY_RPI_RA8875
            bool "RAiO RA8875"
            select LV_TFT_DISPLAY_CONTROLLER_RA8875
            select LV_TFT_DISPLAY_PROTOCOL_SPI
        config LV_PREDEFINED_DISPLAY_TTGO
            bool "TTGO T-Display"
            select LV_TFT_DISPLAY_CONTROLLER_ST7789
            select LV_TFT_DISPLAY_PROTOCOL_SPI
            select LV_TFT_DISPLAY_OFFSETS
        config LV_PREDEFINED_DISPLAY_TTGO_CAMERA_PLUS
            bool "TTGO Camera Plus"
            select LV_TFT_DISPLAY_CONTROLLER_ST7789
            select LV_TFT_DISPLAY_PROTOCOL_SPI
        config LV_PREDEFINED_DISPLAY_WT32_SC01
            bool "Wireless Tag WT32-SC01"
            select LV_TFT_DISPLAY_CONTROLLER_ST7796S
            select LV_TFT_DISPLAY_PROTOCOL_SPI
    endchoice

    # START of helper symbols.
    #
    # Display controller symbols,
    #
    # This boolean configuration symbols can be used to know what
    # display controller has been choosen by the user. When selected
    # the symbol <symbol_name> is set to y, then in the file sdkconfig.h
    # the symbol CONFIG_<symbol_name> is set to 1.
    #
    # If you add support for a new display controller to the repository
    # you must add a config option for it on this helper symbols section.
    config LV_TFT_DISPLAY_CONTROLLER_ILI9341
        bool
        help
            ILI9341 display controller.

    config LV_TFT_DISPLAY_CONTROLLER_ILI9481
        bool
        help
            ILI9481 display controller.

    config LV_TFT_DISPLAY_CONTROLLER_ILI9488
        bool
        help
            ILI9488 display controller.

    config LV_TFT_DISPLAY_CONTROLLER_ILI9486
        bool
        help
            ILI9486 display controller.

    config LV_TFT_DISPLAY_CONTROLLER_ST7789
        bool
        help
            ST7789 display controller.

    config LV_TFT_DISPLAY_CONTROLLER_GC9A01
        bool
        help
            GC9A01 display controller.

    config LV_TFT_DISPLAY_CONTROLLER_ST7735S
        bool
        help
            ST7735S display controller.

    config LV_TFT_DISPLAY_CONTROLLER_HX8357
        bool
        help
            HX8357 display controller.

    config LV_TFT_DISPLAY_CONTROLLER_SH1107
        bool
        help
            SH1107 display controller.

    config LV_TFT_DISPLAY_CONTROLLER_SSD1306
        bool
        help
            SSD1306 display controller.

    config LV_TFT_DISPLAY_CONTROLLER_FT81X
        bool
        help
            FT81x display controller.

    config LV_TFT_DISPLAY_CONTROLLER_IL3820
        bool
        help
            IL3820 epaper display controller.

    config LV_TFT_DISPLAY_CONTROLLER_JD79653A
        bool
        help
            FitiPower JD79653A display controller for GoodDisplay GDEW0154M09 e-paper panel

    config LV_TFT_DISPLAY_CONTROLLER_UC8151D
        bool
        help
            UltraChip UC8151D display controller with GoodDisplay GDEW0154M10 DES e-paper panel

    config LV_TFT_DISPLAY_CONTROLLER_RA8875
        bool
        help
            RA8875 display controller.

    config LV_TFT_DISPLAY_CONTROLLER_ST7796S
        bool
        help
            ST7796S display controller.

    # Display controller communication protocol
    #
    # This symbols define the communication protocol used by the
    # ESP32 to communicate with the display controller.
    # This symbols can be used, but not limited, to:
    # - Know what peripherals to initialize.
    # - Know if the touch and display controllers share the same peripheral.
    # - Etc.
    config LV_TFT_DISPLAY_PROTOCOL_SPI
        bool
        help
            Display controller protocol SPI

    config LV_TFT_DISPLAY_PROTOCOL_I2C
        bool
        help
            Display controller protocol I2C

    # Used in display init function to send display orientation commands
    choice DISPLAY_ORIENTATION
        prompt "Display orientation"
        default DISPLAY_ORIENTATION_PORTRAIT if !LV_TFT_DISPLAY_CONTROLLER_SSD1306
        default DISPLAY_ORIENTATION_LANDSCAPE if LV_TFT_DISPLAY_CONTROLLER_SSD1306
        config DISPLAY_ORIENTATION_PORTRAIT
            bool "Portrait" if !LV_TFT_DISPLAY_CONTROLLER_SSD1306
        config DISPLAY_ORIENTATION_PORTRAIT_INVERTED
            bool "Portrait inverted" if !LV_TFT_DISPLAY_CONTROLLER_SSD1306
        config DISPLAY_ORIENTATION_LANDSCAPE
            bool "Landscape"
        config DISPLAY_ORIENTATION_LANDSCAPE_INVERTED
            bool "Landscape inverted"
    endchoice

    config LV_DISPLAY_ORIENTATION
        int
        default 0 if DISPLAY_ORIENTATION_PORTRAIT
        default 1 if DISPLAY_ORIENTATION_PORTRAIT_INVERTED
        default 2 if DISPLAY_ORIENTATION_LANDSCAPE
        default 3 if DISPLAY_ORIENTATION_LANDSCAPE_INVERTED

    config LV_TFT_DISPLAY_OFFSETS
        bool
        help
        Display area doesn't start at address 0

    config LV_TFT_DISPLAY_X_OFFSET
        depends on LV_TFT_DISPLAY_OFFSETS
        int
        default 40 if LV_PREDEFINED_DISPLAY_TTGO && (LV_DISPLAY_ORIENTATION_LANDSCAPE || LV_DISPLAY_ORIENTATION_LANDSCAPE_INVERTED)
        default 53 if LV_PREDEFINED_DISPLAY_TTGO && (LV_DISPLAY_ORIENTATION_PORTRAIT  || LV_DISPLAY_ORIENTATION_PORTRAIT_INVERTED)
        default 0

    config LV_TFT_DISPLAY_Y_OFFSET
        depends on LV_TFT_DISPLAY_OFFSETS
        int
        default 53  if LV_PREDEFINED_DISPLAY_TTGO && (LV_DISPLAY_ORIENTATION_LANDSCAPE || LV_DISPLAY_ORIENTATION_LANDSCAPE_INVERTED)
        default 40 if LV_PREDEFINED_DISPLAY_TTGO && (LV_DISPLAY_ORIENTATION_PORTRAIT  || LV_DISPLAY_ORIENTATION_PORTRAIT_INVERTED)
        default 0


    # Display colors(?)
    # Useful to know when the display being used is a monochrome
    # display, so we can use the monochrome theme, etc.
    config LV_TFT_DISPLAY_MONOCHROME
        bool
        help
            A monochrome display is used.
    # END of helper symbols

    choice
        prompt "Select predefined board pinouts" if LV_PREDEFINED_DISPLAY_NONE || LV_PREDEFINED_DISPLAY_ERTFT0356
        default LV_PREDEFINED_PINS_NONE
        help
            Select predefined board pin out configuration.

        config LV_PREDEFINED_PINS_NONE
            bool "None"
        config LV_PREDEFINED_PINS_38V4
            bool "ESP32 DevKit v4 with 38 pins"
        config LV_PREDEFINED_PINS_30
            bool "ESP32 Devkit v1 with 30 pins"
        config LV_PREDEFINED_PINS_38V1
            bool "Dev Board with 38 pins"
        config LV_PREDEFINED_PINS_TKOALA
            bool "TTGO Koala"
    endchoice

    # Select one of the available display controllers.
    choice
    prompt "Select a display controller model." if LV_PREDEFINED_DISPLAY_NONE
        help
        Select the controller for your display.

    config LV_TFT_DISPLAY_USER_CONTROLLER_ILI9341
        bool "ILI9341"
            select LV_TFT_DISPLAY_CONTROLLER_ILI9341
            select LV_TFT_DISPLAY_PROTOCOL_SPI
    config LV_TFT_DISPLAY_USER_CONTROLLER_ILI9481
        bool "ILI9481"
            select LV_TFT_DISPLAY_CONTROLLER_ILI9481
            select LV_TFT_DISPLAY_PROTOCOL_SPI
    config LV_TFT_DISPLAY_USER_CONTROLLER_ILI9486
        bool "ILI9486"
            select LV_TFT_DISPLAY_CONTROLLER_ILI9486
            select LV_TFT_DISPLAY_PROTOCOL_SPI
    config LV_TFT_DISPLAY_USER_CONTROLLER_ILI9488
        bool "ILI9488"
            select LV_TFT_DISPLAY_CONTROLLER_ILI9488
            select LV_TFT_DISPLAY_PROTOCOL_SPI
    config LV_TFT_DISPLAY_USER_CONTROLLER_ST7789
        bool "ST7789"
            select LV_TFT_DISPLAY_CONTROLLER_ST7789
            select LV_TFT_DISPLAY_PROTOCOL_SPI
    config LV_TFT_DISPLAY_USER_CONTROLLER_ST7796S
        bool "ST7796S"
            select LV_TFT_DISPLAY_CONTROLLER_ST7796S
            select LV_TFT_DISPLAY_PROTOCOL_SPI
    config LV_TFT_DISPLAY_USER_CONTROLLER_GC9A01
        bool "GC9A01"
            select LV_TFT_DISPLAY_CONTROLLER_GC9A01
            select LV_TFT_DISPLAY_PROTOCOL_SPI
        config LV_TFT_DISPLAY_USER_CONTROLLER_ST7735S
            bool "ST7735S"
            select LV_TFT_DISPLAY_CONTROLLER_ST7735S
            select LV_TFT_DISPLAY_PROTOCOL_SPI
    config LV_TFT_DISPLAY_USER_CONTROLLER_HX8357
        bool "HX8357"
            select LV_TFT_DISPLAY_CONTROLLER_HX8357
            select LV_TFT_DISPLAY_PROTOCOL_SPI
    config LV_TFT_DISPLAY_USER_CONTROLLER_SH1107
        bool "SH1107"
            select LV_TFT_DISPLAY_CONTROLLER_SH1107
            select LV_TFT_DISPLAY_PROTOCOL_SPI
            select LV_TFT_DISPLAY_MONOCHROME
        config LV_TFT_DISPLAY_USER_CONTROLLER_SSD1306
            bool "SSD1306"
            select LV_TFT_DISPLAY_CONTROLLER_SSD1306
            select LV_TFT_DISPLAY_PROTOCOL_I2C
            select LV_TFT_DISPLAY_MONOCHROME
        config LV_TFT_DISPLAY_USER_CONTROLLER_FT81X
            bool "FT81X"
            select LV_TFT_DISPLAY_CONTROLLER_FT81X
            select LV_TFT_DISPLAY_PROTOCOL_SPI
        config LV_TFT_DISPLAY_USER_CONTROLLER_IL3820
            bool "IL3820"
            select LV_TFT_DISPLAY_CONTROLLER_IL3820
            select LV_TFT_DISPLAY_PROTOCOL_SPI
            select LV_TFT_DISPLAY_MONOCHROME
        config LV_TFT_DISPLAY_USER_CONTROLLER_JD79653A
            bool "JD79653A"
            select LV_TFT_DISPLAY_CONTROLLER_JD79653A
            select LV_TFT_DISPLAY_PROTOCOL_SPI
            select LV_TFT_DISPLAY_MONOCHROME
        config LV_TFT_DISPLAY_USER_CONTROLLER_UC8151D
            bool "UC8151D"
            select LV_TFT_DISPLAY_CONTROLLER_UC8151D
            select LV_TFT_DISPLAY_PROTOCOL_SPI
            select LV_TFT_DISPLAY_MONOCHROME
        config LV_TFT_DISPLAY_USER_CONTROLLER_RA8875
            bool "RA8875"
            select LV_TFT_DISPLAY_CONTROLLER_RA8875
            select LV_TFT_DISPLAY_PROTOCOL_SPI
    endchoice

    config CUSTOM_DISPLAY_BUFFER_SIZE
        bool "Use custom display buffer size (bytes)"
        help
            Enable to use a custom display buffer size.

    config CUSTOM_DISPLAY_BUFFER_BYTES
        int "Custom buffer size (bytes)"
        depends on CUSTOM_DISPLAY_BUFFER_SIZE
        default 1024
        help
            See Display buffer on LVGL docs for more information.

    # Select one of the available FT81x configurations.
    choice
        prompt "Select a FT81x configuration." if LV_TFT_DISPLAY_USER_CONTROLLER_FT81X
        default LV_FT81X_CONFIG_EVE_NHD_50
        help
            Select a configuration for your FT81x display.
        config LV_FT81X_CONFIG_EVE_VM800B35A
            bool "EVE_VM800B35A"
        config LV_FT81X_CONFIG_EVE_VM800B43A
            bool "EVE_VM800B43A"
        config LV_FT81X_CONFIG_EVE_VM800B50A
            bool "EVE_VM800B50A"
        config LV_FT81X_CONFIG_EVE_VM810C
            bool "EVE_VM810C"
        config LV_FT81X_CONFIG_EVE_ME812A
            bool "EVE_ME812A"
        config LV_FT81X_CONFIG_EVE_ME813A
            bool "EVE_ME813A"
        config LV_FT81X_CONFIG_EVE_FT810CB_HY50HD
            bool "EVE_FT810CB_HY50HD"
        config LV_FT81X_CONFIG_EVE_FT811CB_HY50HD
            bool "EVE_FT811CB_HY50HD"
        config LV_FT81X_CONFIG_EVE_ET07
            bool "EVE_ET07"
        config LV_FT81X_CONFIG_EVE_RVT28
            bool "EVE_RVT28"
        config LV_FT81X_CONFIG_EVE_RVT35
            bool "EVE_RVT35"
        config LV_FT81X_CONFIG_EVE_RVT43
            bool "EVE_RVT43"
        config LV_FT81X_CONFIG_EVE_RVT50
            bool "EVE_RVT50"
        config LV_FT81X_CONFIG_EVE_RVT70
            bool "EVE_RVT70"
        config LV_FT81X_CONFIG_EVE_RiTFT43
            bool "EVE_RiTFT43"
        config LV_FT81X_CONFIG_EVE_RiTFT50
            bool "EVE_RiTFT50"
        config LV_FT81X_CONFIG_EVE_RiTFT70
            bool "EVE_RiTFT70"
        config LV_FT81X_CONFIG_EVE_EVE2_29
            bool "EVE_EVE2_29"
        config LV_FT81X_CONFIG_EVE_EVE2_35
            bool "EVE_EVE2_35"
        config LV_FT81X_CONFIG_EVE_EVE2_35G
            bool "EVE_EVE2_35G"
        config LV_FT81X_CONFIG_EVE_EVE2_38
            bool "EVE_EVE2_38"
        config LV_FT81X_CONFIG_EVE_EVE2_38G
            bool "EVE_EVE2_38G"
        config LV_FT81X_CONFIG_EVE_EVE2_43
            bool "EVE_EVE2_43"
        config LV_FT81X_CONFIG_EVE_EVE2_43G
            bool "EVE_EVE2_43G"
        config LV_FT81X_CONFIG_EVE_EVE2_50
            bool "EVE_EVE2_50"
        config LV_FT81X_CONFIG_EVE_EVE2_50G
            bool "EVE_EVE2_50G"
        config LV_FT81X_CONFIG_EVE_EVE2_70
            bool "EVE_EVE2_70"
        config LV_FT81X_CONFIG_EVE_EVE2_70G
            bool "EVE_EVE2_70G"
        config LV_FT81X_CONFIG_EVE_EVE3_35
            bool "EVE_EVE3_35"
        config LV_FT81X_CONFIG_EVE_EVE3_35G
            bool "EVE_EVE3_35G"
        config LV_FT81X_CONFIG_EVE_EVE3_43
            bool "EVE_EVE3_43"
        config LV_FT81X_CONFIG_EVE_EVE3_43G
            bool "EVE_EVE3_43G"
        config LV_FT81X_CONFIG_EVE_EVE3_50
            bool "EVE_EVE3_50"
        config LV_FT81X_CONFIG_EVE_EVE3_50G
            bool "EVE_EVE3_50G"
        config LV_FT81X_CONFIG_EVE_EVE3_70
            bool "EVE_EVE3_70"
        config LV_FT81X_CONFIG_EVE_EVE3_70G
            bool "EVE_EVE3_70G"
        config LV_FT81X_CONFIG_EVE_NHD_35
            bool "EVE_NHD_35"
        config LV_FT81X_CONFIG_EVE_NHD_43
            bool "EVE_NHD_43"
        config LV_FT81X_CONFIG_EVE_NHD_50
            bool "EVE_NHD_50"
        config LV_FT81X_CONFIG_EVE_NHD_70
            bool "EVE_NHD_70"
        config LV_FT81X_CONFIG_EVE_ADAM101
            bool "EVE_ADAM101"
        config LV_FT81X_CONFIG_EVE_CFAF240400C1_030SC
            bool "EVE_CFAF240400C1_030SC"
        config LV_FT81X_CONFIG_EVE_CFAF320240F_035T
            bool "EVE_CFAF320240F_035T"
        config LV_FT81X_CONFIG_EVE_CFAF480128A0_039TC
            bool "EVE_CFAF480128A0_039TC"
        config LV_FT81X_CONFIG_EVE_CFAF800480E0_050SC
            bool "EVE_CFAF800480E0_050SC"
        config LV_FT81X_CONFIG_EVE_PAF90
            bool "EVE_PAF90"
        config LV_FT81X_CONFIG_EVE_SUNFLOWER
            bool "EVE_SUNFLOWER"
        config LV_FT81X_CONFIG_EVE_CONNECTEVE
            bool "EVE_CONNECTEVE"
    endchoice

    choice
        prompt "TFT SPI Bus." if LV_TFT_DISPLAY_PROTOCOL_SPI && \
            !LV_PREDEFINED_DISPLAY_TTGO
        default LV_TFT_DISPLAY_SPI_VSPI if LV_PREDEFINED_DISPLAY_TTGO && \
            !IDF_TARGET_ESP32S2
        default LV_TFT_DISPLAY_SPI_FSPI if IDF_TARGET_ESP32S2
        help
              Select the SPI Bus the TFT Display is attached to.

        config LV_TFT_DISPLAY_SPI_HSPI
            bool "HSPI"
        config LV_TFT_DISPLAY_SPI_VSPI
            bool "VSPI" if !IDF_TARGET_ESP32S2
        config LV_TFT_DISPLAY_SPI_FSPI
            bool "FSPI" if IDF_TARGET_ESP32S2
    endchoice

    choice
        prompt "TFT Data Transfer Mode" if LV_TFT_DISPLAY_PROTOCOL_SPI
        default LV_TFT_DISPLAY_SPI_TRANS_MODE_SIO
        help
              Select the SPI SIO/DIO/QIO Transfer Mode for the TFT Display.

        config LV_TFT_DISPLAY_SPI_TRANS_MODE_SIO
            bool "SIO (MOSI/MISO)"
        config LV_TFT_DISPLAY_SPI_TRANS_MODE_DIO
            bool "DIO (2-bit Dual SPI)"
        config LV_TFT_DISPLAY_SPI_TRANS_MODE_QIO
            bool "QIO (4-bit Quad SPI)"
    endchoice

    choice
        prompt "TFT SPI Duplex Mode" if LV_TFT_DISPLAY_PROTOCOL_SPI
        default LV_TFT_DISPLAY_SPI_FULL_DUPLEX if LV_PREDEFINED_DISPLAY_RPI_RA8875 || LV_TFT_DISPLAY_CONTROLLER_FT81X
        default LV_TFT_DISPLAY_SPI_HALF_DUPLEX
        help
              Select the SPI Duplex Mode for the TFT Display.

        config LV_TFT_DISPLAY_SPI_HALF_DUPLEX
            bool "HALF DUPLEX"
        config LV_TFT_DISPLAY_SPI_FULL_DUPLEX
            bool "FULL DUPLEX"
            depends on LV_TFT_DISPLAY_SPI_TRANS_MODE_SIO
    endchoice

    choice
        prompt "Display I2C port" if LV_TFT_DISPLAY_PROTOCOL_I2C
        default LV_DISPLAY_I2C_PORT_0
        help
            Select the I2C port used by the display controller.

        config LV_DISPLAY_I2C_PORT_0
            bool "I2C PORT 0"
        config LV_DISPLAY_I2C_PORT_1
            bool "I2C PORT 1"
    endchoice

    config LV_TFT_USE_CUSTOM_SPI_CLK_DIVIDER
        bool "Use custom SPI clock frequency." if LV_TFT_DISPLAY_PROTOCOL_SPI
        default n
        help
            Allows to use a custom divider for the SPI clock frequency.

    choice
        prompt "Select a custom frequency."
        depends on LV_TFT_USE_CUSTOM_SPI_CLK_DIVIDER
        default LV_TFT_SPI_CLK_DIVIDER_4 if LV_TFT_DISPLAY_CONTROLLER_ST7789 ||LV_TFT_DISPLAY_CONTROLLER_GC9A01 || LV_TFT_DISPLAY_CONTROLLER_ILI9486
        default LV_TFT_SPI_CLK_DIVIDER_2 if LV_TFT_DISPLAY_CONTROLLER_ST7796S
        default LV_TFT_SPI_CLK_DIVIDER_5 if LV_TFT_DISPLAY_CONTROLLER_ILI9481
        default LV_TFT_SPI_CLK_DIVIDER_3 if LV_TFT_DISPLAY_CONTROLLER_HX8357
        default LV_TFT_SPI_CLK_DIVIDER_10 if LV_TFT_DISPLAY_CONTROLLER_SH1107
        default LV_TFT_SPI_CLK_DIVIDER_16 if LV_TFT_DISPLAY_CONTROLLER_JD79653A || LV_TFT_DISPLAY_CONTROLLER_UC8151D
        default LV_TFT_SPI_CLK_DIVIDER_2

        config LV_TFT_SPI_CLK_DIVIDER_1
            bool "80 MHz"
        config LV_TFT_SPI_CLK_DIVIDER_2
            bool "40 MHz"
        config LV_TFT_SPI_CLK_DIVIDER_3
            bool "26.67 MHz"
        config LV_TFT_SPI_CLK_DIVIDER_4
            bool "20 MHz"
        config LV_TFT_SPI_CLK_DIVIDER_5
            bool "16 MHz"
        config LV_TFT_SPI_CLK_DIVIDER_6
            bool "13.33 MHz"
        config LV_TFT_SPI_CLK_DIVIDER_7
            bool "11.43 MHz"
        config LV_TFT_SPI_CLK_DIVIDER_8
            bool "10 MHz"
        config LV_TFT_SPI_CLK_DIVIDER_9
            bool "8.89 MHz"
        config LV_TFT_SPI_CLK_DIVIDER_10
            bool "8 MHz"
        config LV_TFT_SPI_CLK_DIVIDER_12
            bool "6.67 MHz"
        config LV_TFT_SPI_CLK_DIVIDER_16
            bool "5 MHz"
        config LV_TFT_SPI_CLK_DIVIDER_20
            bool "4 MHz"
        config LV_TFT_SPI_CLK_DIVIDER_24
            bool "3.33 MHz"
        config LV_TFT_SPI_CLK_DIVIDER_32
            bool "2.5 MHz"
        config LV_TFT_SPI_CLK_DIVIDER_40
            bool "2 MHz"
        config LV_TFT_SPI_CLK_DIVIDER_48
            bool "1.67 MHz"
        config LV_TFT_SPI_CLK_DIVIDER_80
            bool "1 MHz"
    endchoice

    config LV_TFT_CUSTOM_SPI_CLK_DIVIDER
        int
        default 1 if LV_TFT_SPI_CLK_DIVIDER_1
        default 2 if LV_TFT_SPI_CLK_DIVIDER_2
        default 3 if LV_TFT_SPI_CLK_DIVIDER_3
        default 4 if LV_TFT_SPI_CLK_DIVIDER_4
        default 5 if LV_TFT_SPI_CLK_DIVIDER_5
        default 6 if LV_TFT_SPI_CLK_DIVIDER_6
        default 7 if LV_TFT_SPI_CLK_DIVIDER_7
        default 8 if LV_TFT_SPI_CLK_DIVIDER_8
        default 9 if LV_TFT_SPI_CLK_DIVIDER_9
        default 10 if LV_TFT_SPI_CLK_DIVIDER_10
        default 12 if LV_TFT_SPI_CLK_DIVIDER_12
        default 16 if LV_TFT_SPI_CLK_DIVIDER_16
        default 20 if LV_TFT_SPI_CLK_DIVIDER_20
        default 24 if LV_TFT_SPI_CLK_DIVIDER_24
        default 32 if LV_TFT_SPI_CLK_DIVIDER_32
        default 40 if LV_TFT_SPI_CLK_DIVIDER_40
        default 48 if LV_TFT_SPI_CLK_DIVIDER_48
        default 80 if LV_TFT_SPI_CLK_DIVIDER_80
        default 2

    config LV_INVERT_DISPLAY
        bool "IN DEPRECATION - Invert display." if LV_TFT_DISPLAY_CONTROLLER_RA8875
        default n
        help
            If text is backwards on your display, try enabling this.

    config LV_INVERT_COLORS
        bool "Invert colors in display" if LV_TFT_DISPLAY_CONTROLLER_ILI9341 || LV_TFT_DISPLAY_CONTROLLER_ST7735S || LV_TFT_DISPLAY_CONTROLLER_ILI9481 || LV_TFT_DISPLAY_CONTROLLER_ST7789 || LV_TFT_DISPLAY_CONTROLLER_SSD1306 || LV_TFT_DISPLAY_CONTROLLER_SH1107 || LV_TFT_DISPLAY_CONTROLLER_HX8357
        default y if LV_PREDEFINED_DISPLAY_M5STACK || LV_PREDEFINED_DISPLAY_M5STICKC
        help
            If the colors look inverted on your display, try enabling this.
            If it didn't help try LVGL configuration -> Swap the 2 bytes of RGB565 color.

    config LV_M5STICKC_HANDLE_AXP192
        bool "Handle Backlight and TFT power for M5StickC using AXP192." if LV_PREDEFINED_DISPLAY_M5STICKC || LV_TFT_DISPLAY_CONTROLLER_ST7735S
        default y if LV_PREDEFINED_DISPLAY_M5STICKC
        help
            Display and TFT power supply on M5StickC is controlled using an AXP192 Power Mangerment IC.
            Select yes if you want to enable TFT IC (LDO3) and backlight power using AXP192 by LVGL, or select no if you want to take care of
            power management in your own code.

    config LV_AXP192_PIN_SDA
        int "GPIO for AXP192 I2C SDA"
        depends on LV_M5STICKC_HANDLE_AXP192
        range 0 39
        default 21 if LV_PREDEFINED_DISPLAY_M5STICKC
        default 21
        help
            Configure the AXP192 I2C SDA pin here.

    config LV_AXP192_PIN_SCL
        int "GPIO for AXP192 I2C SCL"
        depends on LV_M5STICKC_HANDLE_AXP192
        range 0 39
        default 22 if LV_PREDEFINED_DISPLAY_M5STICKC
        default 22
        help
            Configure the AXP192 I2C SDA pin here.

    # menu will be visible only when LV_PREDEFINED_DISPLAY_NONE is y
    menu "Display RA8875 Configuration"
    visible if LV_TFT_DISPLAY_CONTROLLER_RA8875

        config LV_DISP_RA8875_PLLDIVM
            int "PLLDIVM value for RA8875 System Clock"
            depends on LV_TFT_DISPLAY_CONTROLLER_RA8875
            range 0 1
            default 0
            help
                Configure the value to use for PLLDIVM in PLLC0 register here.

        config LV_DISP_RA8875_PLLDIVN
            int "PLLDIVN value for RA8875 System Clock"
            depends on LV_TFT_DISPLAY_CONTROLLER_RA8875
            range 1 31
            default 7
            help
                Configure the value to use for PLLDIVN in PLLC0 register here.

        config LV_DISP_RA8875_PLLDIVK
            int "PLLDIVK value for RA8875 System Clock"
            depends on LV_TFT_DISPLAY_CONTROLLER_RA8875
            range 0 7
            default 3
            help
                Configure the value to use for PLLDIVK in PLLC1 register here.

        config LV_DISP_RA8875_PCLK_MULTIPLIER
            int "PCLK Period Setting"
            depends on LV_TFT_DISPLAY_CONTROLLER_RA8875
            range 0 3
            default 0
            help
                Configure the PCLK multiplier in PCSR register here.

        config LV_DISP_RA8875_PCLK_INVERT
            bool "PCLK Inversion"
            depends on LV_TFT_DISPLAY_CONTROLLER_RA8875
            default n
            help
                Configure the PCLK to be inverted in PCSR register here.

        config LV_DISP_RA8875_DE_POLARITY
            bool "Data Enable (DE) Polarity/Invert"
            depends on LV_TFT_DISPLAY_CONTROLLER_RA8875
            default n
            help
                Set to make data enable (DE) signal active low.

        config LV_DISP_RA8875_HORI_NON_DISP_PERIOD
            int "Horizontal Non-Display Period"
            depends on LV_TFT_DISPLAY_CONTROLLER_RA8875
            range 12 274
            default 12
            help
                Configure the Horizontal Non-Display Period (aka Horizontal Back Porch).
                Horizontal Non-Display Period(pixels) = 8*(HNDR+1) + 2*(HNDFTR/2+1) + 2

        config LV_DISP_RA8875_HSYNC_START
            int "HSYNC Start Position"
            depends on LV_TFT_DISPLAY_CONTROLLER_RA8875
            range 8 256
            default 8
            help
                Configure start position of HSYNC (aka Horizontal Front Porch).
                HSYNC Start Position(pixels) = 8*(HSTR+1)

        config LV_DISP_RA8875_HSYNC_PW
            int "HSYNC Pulse Width"
            depends on LV_TFT_DISPLAY_CONTROLLER_RA8875
            range 8 256
            default 8
            help
                Configure pulse width of HSYNC.
                HSYNC Pulse Width(pixels) = 8*(HPW+1)

        config LV_DISP_RA8875_HSYNC_POLARITY
            bool "HSYNC Polarity/Invert"
            depends on LV_TFT_DISPLAY_CONTROLLER_RA8875
            default n
            help
                Set to make HSYNC signal active high.

        config LV_DISP_RA8875_VERT_NON_DISP_PERIOD
            int "Vertical Non-Display Period"
            depends on LV_TFT_DISPLAY_CONTROLLER_RA8875
            range 1 512
            default 1
            help
                Configure the Vertical Non-Display Period (aka Vertical Back Porch).
                Vertical Non-Display Period(lines) = (VNDR+1)

        config LV_DISP_RA8875_VSYNC_START
            int "VSYNC Start Position"
            depends on LV_TFT_DISPLAY_CONTROLLER_RA8875
            range 1 512
            default 1
            help
                Configure start position of VSYNC (aka Vertical Front Porch).
                VSYNC Start Position(lines) = (VSTR+1)

        config LV_DISP_RA8875_VSYNC_PW
            int "VSYNC Pulse Width"
            depends on LV_TFT_DISPLAY_CONTROLLER_RA8875
            range 1 128
            default 1
            help
                Configure pulse width of VSYNC.
                VSYNC Pulse Width(lines) = (VPWR+1)

        config LV_DISP_RA8875_VSYNC_POLARITY
            bool "VSYNC Polarity/Invert"
            depends on LV_TFT_DISPLAY_CONTROLLER_RA8875
            default n
            help
                Set to make VSYNC signal active high.

    endmenu

    # menu will be visible only when LV_PREDEFINED_DISPLAY_NONE is y
    menu "Display ST7789 Configuration"
    visible if LV_TFT_DISPLAY_CONTROLLER_ST7789

        config LV_DISP_ST7789_SOFT_RESET
            bool "Soft reset - use software reset instead of reset pin"
            depends on LV_TFT_DISPLAY_CONTROLLER_ST7789            
            default n
            help
                Use software reset and ignores configured reset pin (some hardware does not use a reset pin).
    
    endmenu

    # menu will be visible only when LV_PREDEFINED_DISPLAY_NONE is y
    menu "Display Pin Assignments"
    visible if LV_PREDEFINED_DISPLAY_NONE || LV_PREDEFINED_DISPLAY_RPI_MPI3501 || LV_PREDEFINED_PINS_TKOALA

        config LV_DISP_SPI_MOSI
            int "GPIO for MOSI (Master Out Slave In)" if LV_TFT_DISPLAY_PROTOCOL_SPI
            range 0 39 if IDF_TARGET_ESP32
            range 0 43 if IDF_TARGET_ESP32S2

            default 23 if LV_PREDEFINED_DISPLAY_WROVER4
            default 23 if LV_PREDEFINED_DISPLAY_ATAG
            default 23 if LV_PREDEFINED_DISPLAY_M5STACK || LV_PREDEFINED_DISPLAY_M5STICK
            default 15 if LV_PREDEFINED_DISPLAY_M5STICKC
            default 18 if LV_PREDEFINED_DISPLAY_ADA_FEATHERWING
            default 23 if LV_PREDEFINED_PINS_TKOALA
            default 19 if LV_PREDEFINED_DISPLAY_TTGO
            default 19 if LV_PREDEFINED_DISPLAY_TTGO_CAMERA_PLUS
            default 13 if LV_PREDEFINED_DISPLAY_WT32_SC01
            default 13

            help
                Configure the display MOSI pin here.

        config LV_DISPLAY_USE_SPI_MISO
            bool "GPIO for MISO (Master In Slave Out)" if LV_TFT_DISPLAY_PROTOCOL_SPI
            default y if LV_PREDEFINED_PINS_TKOALA
            help
                Enable the MISO signal to control the display. You can disable
                it when the display does not need MISO signal to be controlled.

        config LV_DISP_SPI_MISO
            int "GPIO for MISO (Master In Slave Out)" if LV_TFT_DISPLAY_PROTOCOL_SPI
            depends on LV_DISPLAY_USE_SPI_MISO
            range 0 39 if IDF_TARGET_ESP32
            range 0 43 if IDF_TARGET_ESP32S2

            default 19 if LV_PREDEFINED_PINS_TKOALA
            default 0

            help
                Configure the display MISO pin here.

        config LV_DISP_SPI_INPUT_DELAY_NS
            int "MISO Input Delay (ns)" if LV_TFT_DISPLAY_PROTOCOL_SPI
            depends on LV_DISPLAY_USE_SPI_MISO
            range 0 2147483647
            default 0
            help
                The time required between SCLK and MISO being valid, including the possible clock
                delay from processor to display. Leave at 0 unless you know you need a delay.

        config LV_DISP_SPI_IO2
            int "GPIO for Quad SPI IO2/WP" if LV_TFT_DISPLAY_PROTOCOL_SPI
            depends on LV_TFT_DISPLAY_SPI_TRANS_MODE_QIO
            range -1 39 if IDF_TARGET_ESP32
            range -1 43 if IDF_TARGET_ESP32S2

            default 22 if LV_PREDEFINED_PINS_TKOALA && LV_TFT_DISPLAY_SPI_TRANS_MODE_QIO
            default -1
            help
                Configure the display Quad SPI IO2 pin here.

        config LV_DISP_SPI_IO3
            int "GPIO for Quad SPI IO3/HD" if LV_TFT_DISPLAY_PROTOCOL_SPI
            depends on LV_TFT_DISPLAY_SPI_TRANS_MODE_QIO
            range -1 39 if IDF_TARGET_ESP32
            range -1 43 if IDF_TARGET_ESP32S2

            default 21 if LV_PREDEFINED_PINS_TKOALA && LV_TFT_DISPLAY_SPI_TRANS_MODE_QIO
            default -1
            help
                Configure the display Quad SPI IO2 pin here.

        config LV_DISP_SPI_CLK
            int "GPIO for CLK (SCK / Serial Clock)" if LV_TFT_DISPLAY_PROTOCOL_SPI
            range 0 39 if IDF_TARGET_ESP32
            range 0 43 if IDF_TARGET_ESP32S2

            default 18 if LV_PREDEFINED_DISPLAY_M5STACK || LV_PREDEFINED_DISPLAY_M5STICK
            default 13 if LV_PREDEFINED_DISPLAY_M5STICKC
            default 18 if LV_PREDEFINED_DISPLAY_ATAG
            default 19 if LV_PREDEFINED_DISPLAY_WROVER4
            default 5 if LV_PREDEFINED_DISPLAY_ADA_FEATHERWING
            default 18 if LV_PREDEFINED_PINS_TKOALA
            default 18 if LV_PREDEFINED_DISPLAY_TTGO
            default 21 if LV_PREDEFINED_DISPLAY_TTGO_CAMERA_PLUS
            default 14 if LV_PREDEFINED_DISPLAY_WT32_SC01
            default 14

            help
                Configure the display CLK pin here.

        config LV_DISPLAY_USE_SPI_CS
            bool "Use CS signal to control the display" if LV_TFT_DISPLAY_PROTOCOL_SPI
            default y
            help
                Enable the CS signal to control the display. You can disable
                it when the display does not need CS signal to be controlled.

        config LV_DISP_SPI_CS
            int "GPIO for CS (Slave Select)" if LV_TFT_DISPLAY_PROTOCOL_SPI
            depends on LV_DISPLAY_USE_SPI_CS
            range 0 39 if IDF_TARGET_ESP32
            range 0 43 if IDF_TARGET_ESP32S2

            default 5 if LV_PREDEFINED_PINS_38V1
            default 14 if LV_PREDEFINED_DISPLAY_M5STACK || LV_PREDEFINED_DISPLAY_M5STICK
            default 5 if LV_PREDEFINED_DISPLAY_M5STICKC
            default 22 if LV_PREDEFINED_DISPLAY_WROVER4
            default 15 if LV_PREDEFINED_DISPLAY_ADA_FEATHERWING
            default 5 if LV_PREDEFINED_PINS_TKOALA
            default 26 if LV_PREDEFINED_DISPLAY_ATAG
            default 5 if LV_PREDEFINED_DISPLAY_TTGO
            default 12 if LV_PREDEFINED_DISPLAY_TTGO_CAMERA_PLUS
            default 15 if LV_PREDEFINED_DISPLAY_WT32_SC01
            default 15

            help
                Configure the display CS pin here.

        config LV_DISPLAY_USE_DC
            bool "Use DC signal to control the display" if LV_TFT_DISPLAY_PROTOCOL_SPI
            default y if !LV_PREDEFINED_PINS_TKOALA
            help
                Enable the DC signal to control the display. You can disable
                it when the display does not need DC signal to be controlled.

        config LV_DISP_PIN_DC
            int "GPIO for DC (Data / Command)" if LV_TFT_DISPLAY_PROTOCOL_SPI
            range 0 39 if IDF_TARGET_ESP32
            range 0 43 if IDF_TARGET_ESP32S2

            depends on LV_DISPLAY_USE_DC
            default 19 if LV_PREDEFINED_PINS_38V1
            default 17 if LV_PREDEFINED_PINS_38V4
            default 27 if LV_PREDEFINED_DISPLAY_M5STACK || LV_PREDEFINED_DISPLAY_M5STICK
            default 23 if LV_PREDEFINED_DISPLAY_M5STICKC
            default 21 if LV_PREDEFINED_DISPLAY_WROVER4
            default 21 if LV_PREDEFINED_DISPLAY_WT32_SC01
            default 33 if LV_PREDEFINED_DISPLAY_ADA_FEATHERWING
            default 0 if LV_PREDEFINED_PINS_TKOALA
            default 17 if LV_PREDEFINED_DISPLAY_ATAG
            default 16 if LV_PREDEFINED_DISPLAY_TTGO
            default 15 if LV_PREDEFINED_DISPLAY_TTGO_CAMERA_PLUS
            default 2

            help
                Configure the display DC pin here.

        config LV_DISP_PIN_RST
            int "GPIO for Reset" if LV_TFT_DISPLAY_PROTOCOL_SPI && !LV_DISP_ST7789_SOFT_RESET
            range 0 39 if IDF_TARGET_ESP32
            range 0 43 if IDF_TARGET_ESP32S2

            default 18 if LV_PREDEFINED_PINS_38V1
            default 25 if LV_PREDEFINED_PINS_38V4
            default 33 if LV_PREDEFINED_DISPLAY_M5STACK || LV_PREDEFINED_DISPLAY_M5STICK
            default 18 if LV_PREDEFINED_DISPLAY_M5STICKC
            default 18 if LV_PREDEFINED_DISPLAY_WROVER4
            default 4 if LV_PREDEFINED_DISPLAY_ADA_FEATHERWING
            default 4 if LV_PREDEFINED_PINS_TKOALA
            default 16 if LV_PREDEFINED_DISPLAY_ATAG
            default 23 if LV_PREDEFINED_DISPLAY_TTGO
            default 33 if LV_PREDEFINED_DISPLAY_TTGO_CAMERA_PLUS
            default 22 if LV_PREDEFINED_DISPLAY_WT32_SC01
            default 4

            help
                Configure the display Reset pin here.

        config LV_DISP_PIN_BUSY
            int "GPIO for Busy" if LV_TFT_DISPLAY_CONTROLLER_IL3820 || LV_TFT_DISPLAY_CONTROLLER_JD79653A || LV_TFT_DISPLAY_CONTROLLER_UC8151D
            range 0 39 if IDF_TARGET_ESP32
            range 0 43 if IDF_TARGET_ESP32S2

            default 35 if LV_TFT_DISPLAY_CONTROLLER_IL3820 || LV_TFT_DISPLAY_CONTROLLER_JD79653A || LV_TFT_DISPLAY_CONTROLLER_UC8151D
            default 35

            help
                Configure the display Busy pin here.

        config LV_ENABLE_BACKLIGHT_CONTROL
            bool "Enable control of the display backlight by using an GPIO." if \
                ( LV_PREDEFINED_DISPLAY_NONE && ! ( LV_TFT_DISPLAY_CONTROLLER_SH1107 || LV_TFT_DISPLAY_CONTROLLER_SSD1306 ) ) \
                || LV_PREDEFINED_DISPLAY_RPI_MPI3501
            default y if LV_PREDEFINED_DISPLAY_M5STACK
            default y if LV_PREDEFINED_DISPLAY_WROVER4
            default y if LV_PREDEFINED_DISPLAY_ERTFT0356
            default y if LV_PREDEFINED_DISPLAY_TTGO
            default y if LV_PREDEFINED_DISPLAY_TTGO_CAMERA_PLUS
            default y if LV_PREDEFINED_DISPLAY_WT32_SC01
            help
                Enable controlling the display backlight using an GPIO

        config LV_BACKLIGHT_ACTIVE_LVL
            bool "Is backlight turn on with a HIGH (1) logic level?"
            depends on LV_ENABLE_BACKLIGHT_CONTROL
            default y if LV_PREDEFINED_DISPLAY_M5STACK
            default y if LV_PREDEFINED_DISPLAY_ERTFT0356
            default y if LV_PREDEFINED_DISPLAY_TTGO
            default y if LV_PREDEFINED_DISPLAY_TTGO_CAMERA_PLUS
            default y if LV_PREDEFINED_DISPLAY_WT32_SC01
            help
                Some backlights are turned on with a high signal, others held low.
                If enabled, a value of 1 will be sent to the display to enable the backlight,
                otherwise a 0 will be expected to enable it.

        config LV_DISP_PIN_BCKL
            int "GPIO for Backlight Control"
            depends on LV_ENABLE_BACKLIGHT_CONTROL
            range 0 39 if IDF_TARGET_ESP32
            range 0 43 if IDF_TARGET_ESP32S2

            default 23 if LV_PREDEFINED_PINS_38V1
            default 26 if LV_PREDEFINED_PINS_38V4
            default 32 if LV_PREDEFINED_DISPLAY_M5STACK
            default 5 if LV_PREDEFINED_DISPLAY_WROVER4
            default 2 if LV_PREDEFINED_DISPLAY_ADA_FEATHERWING
            default 27 if LV_PREDEFINED_DISPLAY_ERTFT0356
            default 0  if LV_PREDEFINED_PINS_TKOALA
            default 4 if LV_PREDEFINED_DISPLAY_TTGO
            default 2 if LV_PREDEFINED_DISPLAY_TTGO_CAMERA_PLUS
            default 23 if LV_PREDEFINED_DISPLAY_WT32_SC01
            default 27

            help
                Configure the display BCLK (LED) pin here.

        config LV_DISP_PIN_SDA
            int "GPIO for I2C SDA" if LV_TFT_DISPLAY_PROTOCOL_I2C
            range 0 39 if IDF_TARGET_ESP32
            range 0 43 if IDF_TARGET_ESP32S2

            default 5 if LV_PREDEFINED_DISPLAY_WEMOS_LOLIN
            default 5

            help
            Configure the I2C SDA pin here.

        config LV_DISP_PIN_SCL
            int "GPIO for I2C SCL" if LV_TFT_DISPLAY_PROTOCOL_I2C
            range 0 39 if IDF_TARGET_ESP32
            range 0 43 if IDF_TARGET_ESP32S2

            default 4 if LV_PREDEFINED_DISPLAY_WEMOS_LOLIN
            default 4

            help
            Configure the I2C SCL pin here.

    endmenu

endmenu
