Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions boards/shields/st7789v_generic/doc/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
.. _st7789v_generic:

Generic ST7789V Display Shield
##############################

Overview
********

This is a generic shield for display shields based on ST7789V display
controller. More information about the controller can be found in
`ST7789V Datasheet`_.

Pins Assignment of the Generic ST7789V Display Shield
=====================================================

+-----------------------+--------------------------------------------+
| Arduino Connector Pin | Function |
+=======================+===============+============================+
| D8 | ST7789V Reset | |
+-----------------------+---------------+----------------------------+
| D9 | ST7789V DC | (Data/Command) |
+-----------------------+---------------+----------------------------+
| D10 | SPI SS | (Serial Slave Select) |
+-----------------------+---------------+----------------------------+
| D11 | SPI MOSI | (Serial Data Input) |
+-----------------------+---------------+----------------------------+
| D12 | SPI MISO | (Serial Data Out) |
+-----------------------+---------------+----------------------------+
| D13 | SPI SCK | (Serial Clock Input) |
+-----------------------+---------------+----------------------------+

Requirements
************

This shield can only be used with a board that provides a configuration
for Arduino connectors and defines node aliases for SPI and GPIO interfaces
(see :ref:`shields` for more details).

Programming
***********

Set ``-DSHIELD=st7789v_generic`` when you invoke ``west build``. For example:

.. zephyr-app-commands::
:zephyr-app: samples/gui/lvgl
:board: nrf52840_pca10056
:shield: st7789v_generic
:goals: build

References
**********

.. target-notes::

.. _ST7789V Datasheet:
https://www.newhavendisplay.com/appnotes/datasheets/LCDs/ST7789V.pdf
10 changes: 10 additions & 0 deletions boards/shields/st7789v_generic/st7789v_generic.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
CONFIG_SPI=y
CONFIG_DISPLAY=y
CONFIG_ST7789V=y

CONFIG_ST7789V_RGB888=y
CONFIG_LVGL_BITS_PER_PIXEL=24
CONFIG_LVGL_HOR_RES=320
CONFIG_LVGL_VER_RES=170

CONFIG_LVGL_DISPLAY_DEV_NAME="ST7789V"
22 changes: 22 additions & 0 deletions boards/shields/st7789v_generic/st7789v_generic.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
* Copyright (c) 2019 Jan Van Winkel <[email protected]>
*
* SPDX-License-Identifier: Apache-2.0
*/

&arduino_spi {
status = "okay";
cs-gpios = <&arduino_header 16 0>; /* D10 */

st7789v@0 {
compatible = "sitronix,st7789v";
label = "ST7789V";
spi-max-frequency = <20000000>;
reg = <0>;
cmd-data-gpios = <&arduino_header 15 0>; /* D9 */
reset-gpios = <&arduino_header 14 0>; /* D8 */
width = <320>;
height = <170>;
y-offset = <35>;
};
};
40 changes: 21 additions & 19 deletions samples/display/st7789v/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,25 +18,26 @@ controller orientation.

Building and Running
********************
The sample has a board overlay for a nrf52832 based board with the following
pin assignments:

+-------------+-------------+
| | nRF52832 | | LCD module|
| | Pin | | signal |
+=============+=============+
| P0.03 | SPI_SCK |
+-------------+-------------+
| P0.05 | SPI_MOSI |
+-------------+-------------+
| P0.26 | SPI_MISO |
+-------------+-------------+
| P0.27 | CS |
+-------------+-------------+
| P0.25 | DATA/CMD |
+-------------+-------------+
| P0.02 | RESET |
+-------------+-------------+

The sample uses the :ref:`st7789v_generic` and the pin assignments on a
:ref:`nrf52_pca10040` are as follows:

+-------------------+-------------+
| | NRF52 PCA10040 | | LCD module|
| | Pin | | signal |
+===================+=============+
| P1.15 (D13) | SPI_SCK |
+-------------------+-------------+
| P1.14 (D12) | SPI_MISO |
+-------------------+-------------+
| P1.13 (D11) | SPI_MOSI |
+-------------------+-------------+
| P1.12 (D10) | CS |
+-------------------+-------------+
| P1.11 (D9) | DATA/CMD |
+-------------------+-------------+
| P1.10 (D8) | RESET |
+-------------------+-------------+

You might need to alter these according to your specific board/LCD configuration.

Expand All @@ -45,6 +46,7 @@ For :ref:`nrf52_pca10040`, build this sample application with the following comm
.. zephyr-app-commands::
:zephyr-app: samples/display/st7789v
:board: nrf52_pca10040
:shield: st7789v_generic
:goals: build
:compact:

Expand Down
25 changes: 0 additions & 25 deletions samples/display/st7789v/nrf52_pca10040.overlay

This file was deleted.

13 changes: 1 addition & 12 deletions samples/display/st7789v/prj.conf
Original file line number Diff line number Diff line change
@@ -1,15 +1,4 @@
CONFIG_PRINTK=y

CONFIG_HEAP_MEM_POOL_SIZE=16384

CONFIG_GPIO=y
CONFIG_SPI=y

CONFIG_DISPLAY=y
CONFIG_ST7789V=y
CONFIG_ST7789V_LCD_TL019FQV01=y
CONFIG_ST7789V_RGB565=y

CONFIG_DISPLAY_LOG_LEVEL_DBG=y

CONFIG_LOG=y
CONFIG_DISPLAY_LOG_LEVEL_DBG=y
3 changes: 2 additions & 1 deletion samples/display/st7789v/sample.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ tests:
sample.display.st7789v:
build_only: true
platform_whitelist: nrf52_pca10040
tags: display
extra_args: SHIELD=st7789v_generic
tags: display shield
1 change: 1 addition & 0 deletions samples/display/st7789v/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ void main(void)
*(buf + idx + 1) = (color_rgb >> 0) & 0xFFU;
}
#else
int color = cnt % 4;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this a stray change? it doesn't seem related to the commit message samples: display: Use ST7789V generic shield

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like it, but it is a bug fix for the sample in case RGB565 is not defined

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not nice but this sample (and any other controller type specific) should be removed after we merged #20580

u32_t color_rgb;
u32_t c = grey_count & 0xff;

Expand Down