[ili9xxx] Add cs_pin config option (#4249)

* Add cs_pin config option to ili9xxx
Add list of common display configs

* Additional text

* move `id` to top-level display doc

* Fix st7701 transform docs
This commit is contained in:
Clyde Stubbs 2024-09-17 23:37:40 +10:00 committed by GitHub
parent 02d9af543c
commit 640c6b93e6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 42 additions and 26 deletions

View File

@ -60,14 +60,14 @@ beyond the basic SPI connections, and a reasonable amount of RAM, it is not well
- platform: ili9xxx
model: ili9341
dc_pin: GPIOXX
reset_pin: GPIOXX
lambda: |-
it.fill(COLOR_BLACK);
it.print(0, 0, id(my_font), id(my_red), TextAlign::TOP_LEFT, "Hello World!");
show_test_card: true
Configuration variables:
************************
All :ref:`graphical display configuration<display-configuration>` options are available, plus the following.
- **model** (**Required**): The model of the display. Options are:
- ``M5STACK``, ``TFT 2.4``, ``TFT 2.4R``, ``S3BOX``, ``S3BOX_LITE``, ``WSPICOLCD``
@ -79,13 +79,15 @@ Configuration variables:
- **dc_pin** (**Required**, :ref:`Pin Schema <config-pin_schema>`): The DC pin.
- **reset_pin** (*Optional*, :ref:`Pin Schema <config-pin_schema>`): The RESET pin.
- **lambda** (*Optional*, :ref:`lambda <config-lambda>`): The lambda to use for rendering the content on the display.
See :ref:`display-engine` for more information.
- **update_interval** (*Optional*, :ref:`config-time`): The interval to re-draw the screen. Defaults to ``5s``.
- **auto_clear_enabled** (*Optional*, boolean): Whether to automatically clear the display in each loop (''true'', default),
or to keep the existing display content (must overwrite explicitly, e.g., only on data change).
- **pages** (*Optional*, list): Show pages instead of a single lambda. See :ref:`display-pages`.
- **id** (*Optional*, :ref:`config-id`): Manually specify the ID used for code generation.
- **cs_pin** (*Optional*, :ref:`Pin Schema <config-pin_schema>`): The CS pin.
.. note::
A DC pin is always required, the CS pin and RESET pin will only be needed if the specific board has those
pins wired to GPIOs.
- **color_palette** (*Optional*): The type of color pallet that will be used in the ESP's internal 8-bits-per-pixel buffer. This can be used to improve color depth quality of the image. For example if you know that the display will only be showing grayscale images, the clarity of the display can be improved by targeting the available colors to monochrome only. Options are:
- ``NONE`` (default)

View File

@ -11,15 +11,34 @@ engine. Fundamentally, there are these types of displays:
- Character displays like :doc:`7-Segment displays <max7219>` or
:doc:`LCD displays <lcd_display>`.
- Serial displays like :doc:`nextion` that have their own processors for graphics rendering.
- Graphical binary displays which can toggle ON/OFF any pixel, like :doc:`E-Paper <waveshare_epaper>`,
- Graphical displays with fully addressable pixels, like :doc:`E-Paper <waveshare_epaper>`,
:doc:`OLED <ssd1306>` or :doc:`TFT <ili9xxx>` displays.
For graphical displays, which offer the greatest flexibility, there are two options:
For graphical displays, which offer the greatest flexibility, there are two options for displaying content:
- ESPHome's :ref:`own rendering engine <display-engine>`
- :doc:`LVGL </components/lvgl/index>` - Light and Versatile Graphics Library
.. _display-configuration:
Configuration variables:
************************
All display components inherit these configuration variables.
- **id** (*Optional*, :ref:`config-id`): Manually specify the ID used for code generation. Required if there are multiple displays.
- **update_interval** (*Optional*, :ref:`config-time`): The interval to re-draw the screen. Defaults to ``1s``.
- **lambda** (*Optional*, :ref:`lambda <config-lambda>`): The lambda to use for rendering the content on the display.
See :ref:`display-engine` for more information.
All *graphical* displays also inherit these configuration variables.
- **auto_clear_enabled** (*Optional*, boolean): If the display should be cleared before each update. Defaults to ``true``.
- **show_test_card** (*Optional*, boolean): If the display should show a test card. Defaults to ``false``. If set, any code in the ``lambda`` config option will be ignored.
- **rotation** (*Optional*, integer): The rotation of the display in degrees, one of 0, 90, 180 or 270. Defaults to ``0``.
- **pages** (*Optional*, list): Pages configuration - see below.
.. _display-engine:
Display Rendering Engine

View File

@ -37,12 +37,12 @@ ESP-IDF. PSRAM is a requirement due to the size of the display buffer.
dimensions:
width: 480
height: 480
cs_pin: REPLACE_ME
reset_pin: REPLACE_ME
de_pin: REPLACE_ME
hsync_pin: REPLACE_ME
vsync_pin: REPLACE_ME
pclk_pin: REPLACE_ME
cs_pin: GPIOXX
reset_pin: GPIOXX
de_pin: GPIOXX
hsync_pin: GPIOXX
vsync_pin: GPIOXX
pclk_pin: GPIOXX
# Replace XX with the correct pin number
data_pins:
@ -109,18 +109,13 @@ Configuration variables:
- **rotation** (*Optional*): Rotate the display presentation in software. Choose one of ````, ``90°``, ``180°``, or ``270°``. This option cannot be used with ``transform``.
- **transform** (*Optional*): Transform the display presentation using hardware. All defaults are ``false``. This option cannot be used with ``rotation``.
- **swap_xy** (*Optional*, boolean): If true, exchange the x and y axes.
- **mirror_x** (*Optional*, boolean): If true, mirror the x axis.
- **mirror_y** (*Optional*, boolean): If true, mirror the y axis.
- **lambda** (*Optional*, :ref:`lambda <config-lambda>`): The lambda to use for rendering the content on the display.
See :ref:`display-engine` for more information.
**Note:** To rotate the display in hardware use one of the following combinations:
- 90 degrees - use ``swap_xy`` with ``mirror_x``
- 180 degrees - use ``mirror_x`` with ``mirror_y``
- 270 degrees - use ``swap_xy`` with ``mirror_y``
**Note:** To rotate the display in hardware by 180 degrees set both ``mirror_x`` and ``mirror_y`` to ``true``. The st7701s does not support hardware rotation by 90 or 270.
The horizontal and vertical ``pulse_width``, ``front_porch`` and ``back_porch`` values are optional, but may require
changing for a specific display. Refer to the manufacturer's sample code for suitable values. These specify timing