zephyr/samples/drivers/display
Phi Bang Nguyen d0f7604b1a samples: drivers: display: Fix RGB565/BGR565 interchange issue
The RGB565 and BGR565 formats are interchanged in the sample. This leads
to wrong assumptions about "byte swap" in Zephyr and make display
drivers, shields and video sample follow it for a long time. Fix it.

Signed-off-by: Phi Bang Nguyen <phibang.nguyen@nxp.com>
2025-07-28 16:45:33 -04:00
..
boards samples: display: Fix stm32n6570_dk fsbl variant 2025-07-11 13:14:30 -10:00
src samples: drivers: display: Fix RGB565/BGR565 interchange issue 2025-07-28 16:45:33 -04:00
CMakeLists.txt
dummy_dc.overlay
prj.conf
README.rst
sample.yaml test: driver: display: add test case for x_nucleo_gfx01m2 2025-05-13 16:22:52 +02:00

.. zephyr:code-sample:: display
   :name: Display
   :relevant-api: display_interface

   Draw basic rectangles on a display device.

Overview
********

This sample will draw some basic rectangles onto the display.
The rectangle colors and positions are chosen so that you can check the
orientation of the LCD and correct RGB bit order. The rectangles are drawn
in clockwise order, from top left corner: red, green, blue, grey. The shade of
grey changes from black through to white. If the grey looks too green or red
at any point or the order of the corners is not as described above then the LCD
may be endian swapped.

On displays with the :c:enumerator:`SCREEN_INFO_X_ALIGNMENT_WIDTH` capability,
such as those using the :dtcompatible:`sharp,ls0xx` driver, it is only possible
to draw full lines at a time. On these displays, the rectangles described above
will be replaced with bars that take up the entire width of the display. Only
the green and grey bar will be visible.

On monochrome displays, the rectangles (or bars) will all be some shade of grey.

On displays with 1 bit per pixel, the greyscale animation of the bottom
rectangle (or bar) will appear as flickering between black and white.

Building and Running
********************

As this is a generic sample it should work with any display supported by Zephyr.

Below is an example on how to build for a :zephyr:board:`nrf52840dk` board with a
:ref:`adafruit_2_8_tft_touch_v2`.

.. zephyr-app-commands::
   :zephyr-app: samples/drivers/display
   :board: nrf52840dk/nrf52840
   :goals: build
   :shield: adafruit_2_8_tft_touch_v2
   :compact:

For testing purpose without the need of any hardware, the :ref:`native_sim <native_sim>`
board is also supported and can be built as follows;

.. zephyr-app-commands::
   :zephyr-app: samples/drivers/display
   :board: native_sim
   :goals: build
   :compact:

List of Arduino-based display shields
*************************************

- :ref:`adafruit_2_8_tft_touch_v2`
- :ref:`ssd1306_128_shield`
- :ref:`st7789v_generic`
- :ref:`waveshare_epaper`