Colorful

Draw an RGB color gradient on a display device.

Overview

This sample uses the display API to render an RGB color gradient across the entire display.

With most display drivers, the RGB color gradient runs across the entire screen, from red through yellow to green, then from green through cyan to blue, and finally from blue through magenta back to red. This cycle repeats endlessly and changes the color of all pixels at once. It is not a static representation of an RGB color gradient; the colors simply cycle through.

Typical RGB output at 320x240: color gradient from red across dark yellow to green, across dark cyan to blue, across dark magenta back to red.

Requirements

This sample supports any kind of display configured as default Zephyr display node in Devicetree by the chosen { zephyr,display = ...; }; entry.

The sample supports the following default platforms, but is not limited to them (located in samples/colorful/tests.yaml):

Hardware platforms

Order number

Board name

Board target

Native (64-bit)

Native simulator - native_sim

native_sim/native/64

Native (32-bit)

Native simulator - native_sim

native_sim

native_sim/native

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 nRF52840 DK board with a Adafruit 2.8” TFT Touch Shield v2.

west build -b nrf52840dk/nrf52840 --shield adafruit_2_8_tft_touch_v2 -d build/colorful bridle/samples/display/colorful

For testing purpose without the need of any hardware, the native_sim/native/64 board is also supported and can be built as follows:

west build -b native_sim/native/64 -d build/colorful bridle/samples/display/colorful
west build -t run -d build/colorful

Twister test suites

To run the test with twister on emulated or dummy hardware, use the following command:

west twister -v -X fixture_display -T bridle/samples/display/colorful -s sample.display.colorful.sdl -s sample.display.colorful.dummy

To run all test with twister, use the following command:

west twister -v -T bridle/samples/display/colorful

List of Arduino-based display shields