Skip to content

Commit 864f3bd

Browse files
committed
samples: display: Added generic display shield sample
Added a generic display shield sample. Signed-off-by: Jan Van Winkel <[email protected]>
1 parent d9d4082 commit 864f3bd

File tree

7 files changed

+418
-0
lines changed

7 files changed

+418
-0
lines changed

CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,7 @@
308308
/samples/boards/intel_s1000_crb/ @sathishkuttan @dcpleung @nashif
309309
/samples/display/ @vanwinkeljan
310310
/samples/drivers/CAN/ @alexanderwachter
311+
/samples/drivers/display/ @vanwinkeljan
311312
/samples/drivers/ht16k33/ @henrikbrixandersen
312313
/samples/drivers/lora/ @Mani-Sadhasivam
313314
/samples/gui/ @vanwinkeljan
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# SPDX-License-Identifier: Apache-2.0
2+
3+
cmake_minimum_required(VERSION 3.13.1)
4+
include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE)
5+
project(display)
6+
7+
target_sources(app PRIVATE src/main.c)

samples/drivers/display/README.rst

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
.. _display-sample:
2+
3+
Display Sample
4+
##############
5+
6+
Overview
7+
********
8+
9+
This sample will draw some basic rectangles onto the display.
10+
The rectangle colors and positions are chosen so that you can check the
11+
orientation of the LCD and correct RGB bit order. The rectangles are drawn
12+
in clockwise order, from top left corner: red, green, blue, grey. The shade of
13+
grey changes from black through to white. If the grey looks too green or red
14+
at any point or the order of the corners is not as described above then the LCD
15+
may be endian swapped.
16+
17+
Building and Running
18+
********************
19+
20+
As this is a generic sample it should work with any display supported by Zephyr.
21+
22+
Below is an example on how to build for a :ref:`nrf52840_pca10056` board with a
23+
:ref:`adafruit_2_8_tft_touch_v2`.
24+
25+
.. zephyr-app-commands::
26+
:zephyr-app: samples/drivers/display_shield
27+
:board: nrf52840_pca10056
28+
:goals: build
29+
:shield: adafruit_2_8_tft_touch_v2
30+
:compact:
31+
32+
For testing purpose without the need of any hardware, the :ref:`native_posix`
33+
board is also supported and can be built as follows;
34+
35+
.. zephyr-app-commands::
36+
:zephyr-app: samples/drivers/display_shield
37+
:board: native_posix
38+
:goals: build
39+
:compact:
40+
41+
List of Arduino-based display shields
42+
*************************************
43+
44+
- :ref:`adafruit_2_8_tft_touch_v2`
45+
- :ref:`ssd1306_128_shield`
46+
- :ref:`st7789v_generic`
47+
- :ref:`waveshare_e_paper_raw_panel_shield`
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/*
2+
* Copyright (c) 2019 Jan Van Winkel <[email protected]>
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#ifdef DT_INST_0_ILITEK_ILI9340_LABEL
8+
#define DISPLAY_DEV_NAME DT_INST_0_ILITEK_ILI9340_LABEL
9+
#endif
10+
11+
#ifdef DT_INST_0_SOLOMON_SSD1306FB_LABEL
12+
#define DISPLAY_DEV_NAME DT_INST_0_SOLOMON_SSD1306FB_LABEL
13+
#endif
14+
15+
#ifdef DT_INST_0_GOODDISPLAY_GDEH0213B1_LABEL
16+
#define DISPLAY_DEV_NAME DT_INST_0_GOODDISPLAY_GDEH0213B1_LABEL
17+
#endif
18+
19+
#ifdef DT_INST_0_SITRONIX_ST7789V_LABEL
20+
#define DISPLAY_DEV_NAME DT_INST_0_SITRONIX_ST7789V_LABEL
21+
#endif
22+
23+
#ifdef DT_INST_0_FSL_IMX6SX_LCDIF_LABEL
24+
#define DISPLAY_DEV_NAME DT_INST_0_FSL_IMX6SX_LCDIF_LABEL
25+
#endif
26+
27+
#ifdef CONFIG_SDL_DISPLAY_DEV_NAME
28+
#define DISPLAY_DEV_NAME CONFIG_SDL_DISPLAY_DEV_NAME
29+
#endif
30+
31+
#ifdef CONFIG_DUMMY_DISPLAY_DEV_NAME
32+
#define DISPLAY_DEV_NAME CONFIG_DUMMY_DISPLAY_DEV_NAME
33+
#endif
34+

samples/drivers/display/prj.conf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
CONFIG_HEAP_MEM_POOL_SIZE=16384
2+
CONFIG_LOG=y
3+
CONFIG_DISPLAY=y
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
sample:
2+
description: Sample application for displays
3+
name: display_sample
4+
tests:
5+
sample.display.shield.adafruit_2_8_tft_touch_v2:
6+
platform_whitelist: nrf52840_pca10056
7+
extra_args: SHIELD=adafruit_2_8_tft_touch_v2
8+
tags: display shield
9+
sample.display.shield.ssd1306_128x32:
10+
platform_whitelist: nrf52840_pca10056
11+
extra_args: SHIELD=ssd1306_128x32
12+
tags: display shield
13+
sample.display.shield.ssd1306_128x64:
14+
platform_whitelist: nrf52840_pca10056
15+
extra_args: SHIELD=ssd1306_128x64
16+
tags: display shield
17+
sample.display.shield.waveshare_epaper_gdeh0213b1:
18+
platform_whitelist: nrf52840_pca10056
19+
extra_args: SHIELD=waveshare_epaper_gdeh0213b1
20+
sample.display.st7789v_tl019fqv01:
21+
platform_whitelist: nrf52_pca10040
22+
extra_args: SHIELD=st7789v_tl019fqv01
23+
tags: display shield
24+
sample.display.st7789v_waveshare_240x240:
25+
platform_whitelist: nrf52_pca10040
26+
extra_args: SHIELD=st7789v_waveshare_240x240
27+
tags: display shield
28+
sample.display.mcux_elcdif:
29+
platform_whitelist: mimxrt1050_evk
30+
tags: display
31+
sample.display.sdl:
32+
build_only: true
33+
platform_whitelist: native_posix_64
34+
tags: display
35+
sample.display.dummy:
36+
platform_whitelist: native_posix
37+
extra_configs:
38+
- CONFIG_DUMMY_DISPLAY=y
39+
- CONFIG_SDL_DISPLAY=n
40+
- CONFIG_TEST=y
41+
tags: display

0 commit comments

Comments
 (0)