shields: display: Added support for ST7735r based LCD shields
This very first version supports the 160x128 pixels adafruit TFT display
Signed-off-by: Kim Bøndergaard <kim@fam-boendergaard.dk>
Signed-off-by: Kim Bøndergaard <kibo@prevas.dk>
diff --git a/boards/shields/st7735r/Kconfig.defconfig b/boards/shields/st7735r/Kconfig.defconfig
new file mode 100644
index 0000000..59915d3
--- /dev/null
+++ b/boards/shields/st7735r/Kconfig.defconfig
@@ -0,0 +1,33 @@
+# Copyright (c) 2020 Kim Bøndergaard <kim@fam-boendergaard.dk>
+# SPDX-License-Identifier: Apache-2.0
+
+if SHIELD_ST7735R_ADA_160x128
+
+if DISPLAY
+
+config SPI
+ default y
+
+config ST7735R
+ default y
+
+
+if LVGL
+
+config LVGL_DISPLAY_DEV_NAME
+ default "ST7735R"
+
+config LVGL_HOR_RES_MAX
+ default 160
+
+config LVGL_VER_RES_MAX
+ default 128
+
+config LVGL_BITS_PER_PIXEL
+ default 16
+
+endif # LVGL
+
+endif # DISPLAY
+
+endif # SHIELD_ST7735R_ADA_160x128
diff --git a/boards/shields/st7735r/Kconfig.shield b/boards/shields/st7735r/Kconfig.shield
new file mode 100644
index 0000000..6cbeda7
--- /dev/null
+++ b/boards/shields/st7735r/Kconfig.shield
@@ -0,0 +1,5 @@
+# Copyright (c) 2020 Kim Bøndergaard <kim@fam-boendergaard.dk>
+# SPDX-License-Identifier: Apache-2.0
+
+config SHIELD_ST7735R_ADA_160x128
+ def_bool $(shields_list_contains,st7735r_ada_160x128)
diff --git a/boards/shields/st7735r/doc/index.rst b/boards/shields/st7735r/doc/index.rst
new file mode 100644
index 0000000..3a8fb54
--- /dev/null
+++ b/boards/shields/st7735r/doc/index.rst
@@ -0,0 +1,67 @@
+.. _st7735r_generic:
+
+Generic ST7735R Display Shield
+##############################
+
+Overview
+********
+
+This is a generic shield for display shields based on ST7735R display
+controller. More information about the controller can be found in
+`ST7735R Datasheet`_.
+
+Pins Assignment of the Generic ST7735R Display Shield
+=====================================================
+
++-----------------------+--------------------------------------------+
+| Arduino Connector Pin | Function |
++=======================+===============+============================+
+| D8 | ST7735R Reset | |
++-----------------------+---------------+----------------------------+
+| D9 | ST7735R 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) |
++-----------------------+---------------+----------------------------+
+
+Current supported displays
+==========================
+
++----------------------+------------------------------+
+| Display | Shield Designation |
+| | |
++======================+==============================+
+| adafruit | st7735r_ada_160x128 |
+| 160x128 18bit TFT | |
++----------------------+------------------------------+
+
+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=st7735r_ada_160x128`` when you invoke ``west build``. For example:
+
+.. zephyr-app-commands::
+ :zephyr-app: samples/gui/lvgl
+ :board: nrf52840dk_nrf52840
+ :shield: st7735r_ada_160x128
+ :goals: build
+
+References
+**********
+
+.. target-notes::
+
+.. _ST7735R Datasheet:
+ https://www.crystalfontz.com/controllers/Sitronix/ST7735R/319/
diff --git a/boards/shields/st7735r/st7735r_ada_160x128.overlay b/boards/shields/st7735r/st7735r_ada_160x128.overlay
new file mode 100644
index 0000000..ec515f2
--- /dev/null
+++ b/boards/shields/st7735r/st7735r_ada_160x128.overlay
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2020, Kim Bøndergaard, <kim@fam-boendergaard.dk>
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+&arduino_spi {
+ status = "okay";
+ cs-gpios = <&arduino_header 16 GPIO_ACTIVE_LOW>; /* D10 */
+
+ st7735r@0 {
+ compatible = "sitronix,st7735r";
+ label = "ST7735R";
+ spi-max-frequency = <20000000>;
+ reg = <0>;
+ cmd-data-gpios = <&arduino_header 15 GPIO_ACTIVE_LOW>; /* D9 */
+ reset-gpios = <&arduino_header 14 GPIO_ACTIVE_LOW>; /* D8 */
+ width = <160>;
+ height = <128>;
+ x-offset = <0>;
+ y-offset = <0>;
+ madctl = <0x60>;
+ colmod = <0x55>;
+ vmctr1 = <0x0e>;
+ pwctr1 = [a2 02 84];
+ pwctr2 = [c5];
+ pwctr3 = [0a 00];
+ pwctr4 = [8a 2a];
+ pwctr5 = [8a ee];
+ frmctr1 = [01 2c 2d];
+ frmctr2 = [01 2c 2d];
+ frmctr3 = [01 2c 2d 01 2c 2d];
+ gamctrp1 = [02 1c 07 12 37 32 29 2d 29 25 2b 39 00 01 03 10];
+ gamctrn1 = [03 1d 07 06 2e 2c 29 2d 2e 2e 37 3f 00 00 02 10];
+ };
+};