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.
On displays using a multi-bit luminance format (for example PIXEL_FORMAT_L_8),
the entire screen runs over different grey level between black and white (color luminance).
Other multi-bit monochrome formats behave similarly (different greys).
Grayscale-style; entire screen animates through different greys (color luminance).
On displays with 1 bit per pixel, the greyscale animation of the entire screen will appear as flickering between black and white.
1 bpp: entire screen animates flickering between fore- and background color (black
for MONO01, white for MONO10 on a black screen).
By querying the display controller’s capabilities, it is possible to determine if the display
is an e-paper display by checking if the SCREEN_INFO_EPD bit is set in the
display_capabilities.screen_info.
For such displays, the color of the entire screen will change at a much slower rate than on a typical LCD, to align with the typical refresh rate of e-ink technologies.
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