From d79b00375898eeb36e04bbc74eefb59344a011d6 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Mon, 26 Oct 2020 17:55:53 +0100 Subject: [PATCH] boards: shields: add support for buydisplay 3.5" TFT Add support for the BuyDisplay 3.5" TFT + touch shield based on ILI9488 controller and FT6236 touch. Signed-off-by: Gerard Marull-Paretas --- .../Kconfig.defconfig | 74 +++++++++++++++++ .../Kconfig.shield | 5 ++ .../boards/nrf52840dk_nrf52840.overlay | 10 +++ .../buydisplay_3_5_tft_touch_arduino.overlay | 38 +++++++++ .../doc/index.rst | 79 +++++++++++++++++++ 5 files changed, 206 insertions(+) create mode 100644 boards/shields/buydisplay_3_5_tft_touch_arduino/Kconfig.defconfig create mode 100644 boards/shields/buydisplay_3_5_tft_touch_arduino/Kconfig.shield create mode 100644 boards/shields/buydisplay_3_5_tft_touch_arduino/boards/nrf52840dk_nrf52840.overlay create mode 100644 boards/shields/buydisplay_3_5_tft_touch_arduino/buydisplay_3_5_tft_touch_arduino.overlay create mode 100644 boards/shields/buydisplay_3_5_tft_touch_arduino/doc/index.rst diff --git a/boards/shields/buydisplay_3_5_tft_touch_arduino/Kconfig.defconfig b/boards/shields/buydisplay_3_5_tft_touch_arduino/Kconfig.defconfig new file mode 100644 index 0000000000..a895885afb --- /dev/null +++ b/boards/shields/buydisplay_3_5_tft_touch_arduino/Kconfig.defconfig @@ -0,0 +1,74 @@ +# Copyright (c) 2020 Teslabs Engineering S.L. +# SPDX-License-Identifier: Apache-2.0 + +if SHIELD_BUYDISPLAY_3_5_TFT_TOUCH_ARDUINO + +if DISPLAY + +config SPI + default y + +config ILI9488 + default y + +if KSCAN + +config I2C + default y + +config KSCAN_FT5336 + default y + +# NOTE: Enable if IRQ line is available (requires to solder jumper) +config KSCAN_FT5336_INTERRUPT + default n + +config KSCAN_INIT_PRIORITY + default 60 + +endif # KSCAN + +if LVGL + +config LVGL_DISPLAY_DEV_NAME + default "DISPLAY" + +config LVGL_HOR_RES_MAX + default 320 + +config LVGL_VER_RES_MAX + default 480 + +config LVGL_VDB_SIZE + default 32 + +config LVGL_BITS_PER_PIXEL + default 24 + +choice LVGL_COLOR_DEPTH + default LVGL_COLOR_DEPTH_16 +endchoice + +config KSCAN + default y + +config LVGL_POINTER_KSCAN + default y + +config LVGL_POINTER_KSCAN_DEV_NAME + default "TOUCH" + +config LVGL_POINTER_KSCAN_SWAP_XY + default y + +config LVGL_POINTER_KSCAN_INVERT_X + default y + +config LVGL_POINTER_KSCAN_INVERT_Y + default y + +endif # LVGL + +endif # DISPLAY + +endif # SHIELD_BUYDISPLAY_3_5_TFT_TOUCH_ARDUINO diff --git a/boards/shields/buydisplay_3_5_tft_touch_arduino/Kconfig.shield b/boards/shields/buydisplay_3_5_tft_touch_arduino/Kconfig.shield new file mode 100644 index 0000000000..2515df22d2 --- /dev/null +++ b/boards/shields/buydisplay_3_5_tft_touch_arduino/Kconfig.shield @@ -0,0 +1,5 @@ +# Copyright (c) 2020 Teslabs Engineering S.L. +# SPDX-License-Identifier: Apache-2.0 + +config SHIELD_BUYDISPLAY_3_5_TFT_TOUCH_ARDUINO + def_bool $(shields_list_contains,buydisplay_3_5_tft_touch_arduino) diff --git a/boards/shields/buydisplay_3_5_tft_touch_arduino/boards/nrf52840dk_nrf52840.overlay b/boards/shields/buydisplay_3_5_tft_touch_arduino/boards/nrf52840dk_nrf52840.overlay new file mode 100644 index 0000000000..20cbeb7576 --- /dev/null +++ b/boards/shields/buydisplay_3_5_tft_touch_arduino/boards/nrf52840dk_nrf52840.overlay @@ -0,0 +1,10 @@ +/* + * Copyright (c) 2020 Teslabs Engineering S.L. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/* NOTE: spi1 MISO pin is used by the display for the cmd/data line */ +&spi1 { + status = "disabled"; +}; diff --git a/boards/shields/buydisplay_3_5_tft_touch_arduino/buydisplay_3_5_tft_touch_arduino.overlay b/boards/shields/buydisplay_3_5_tft_touch_arduino/buydisplay_3_5_tft_touch_arduino.overlay new file mode 100644 index 0000000000..f6d2c2c288 --- /dev/null +++ b/boards/shields/buydisplay_3_5_tft_touch_arduino/buydisplay_3_5_tft_touch_arduino.overlay @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2020 Teslabs Engineering S.L. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include + +&arduino_spi { + status = "okay"; + cs-gpios = <&arduino_header 15 GPIO_ACTIVE_LOW>; /* D9 */ + + ili9488@0 { + compatible = "ilitek,ili9488"; + label = "DISPLAY"; + spi-max-frequency = <25000000>; + reg = <0>; + cmd-data-gpios = <&arduino_header 13 GPIO_ACTIVE_LOW>; /* D7 */ + reset-gpios = <&arduino_header 16 GPIO_ACTIVE_LOW>; /* D10 */ + pixel-format = ; + rotation = <0>; + frmctr1 = [a0 11]; + pwctrl1 = [17 15]; + pwctrl2 = [41]; + pgamctrl = [00 03 09 08 16 0a 3f 78 4c 09 0a 08 16 1a 0f]; + ngamctrl = [00 16 19 03 0f 05 32 45 46 04 0e 0d 35 37 0f]; + }; +}; + +&arduino_i2c { + ft5336@38 { + compatible = "focaltech,ft5336"; + reg = <0x38>; + label = "TOUCH"; + /* Uncomment if IRQ line is available (requires to solder jumper) */ + /* int-gpios = <&arduino_header 11 GPIO_ACTIVE_LOW>; */ /* D5 */ + }; +}; diff --git a/boards/shields/buydisplay_3_5_tft_touch_arduino/doc/index.rst b/boards/shields/buydisplay_3_5_tft_touch_arduino/doc/index.rst new file mode 100644 index 0000000000..0ebbd394b4 --- /dev/null +++ b/boards/shields/buydisplay_3_5_tft_touch_arduino/doc/index.rst @@ -0,0 +1,79 @@ +.. _buydisplay_3_5_tft_touch_arduino: + +Buydisplay 3.5" TFT Touch Shield with Arduino adapter +##################################################### + +Overview +******** + +The Buydisplay 3.5" TFT Touch Shield has a resolution of 320x480 +pixels and is based on the ILI9488 controller. On the capacitive touch +version this shield comes with a FT6236 touch controller. The Arduino +adapter is required to use this shield. Note that both display and +Arduino shields are sold in multiple combinations of interfaces. The +current Zephyr driver only supports the 4-wire SPI interface. + +More information about the shield and Arduino adapter can be found at +the `Buydisplay 3.5" TFT Touch Shield website`_ and +`Arduino adapter website`_. + +Pin Assignments +=============== + ++-----------------------+---------------------------------------------+ +| Shield Connector Pin | Function | ++=======================+=============================================+ +| D5 | Touch Controller IRQ (see note below) | ++-----------------------+---------------------------------------------+ +| D7 | ILI9488 DC (Data/Command) | ++-----------------------+---------------------------------------------+ +| D10 | ILI9488 Reset | ++-----------------------+---------------------------------------------+ +| D9 | ILI9488 SPI CSn | ++-----------------------+---------------------------------------------+ +| D11 | SPI MOSI (Serial Data Input) | ++-----------------------+---------------------------------------------+ +| D12 | SPI MISO (Serial Data Out) | ++-----------------------+---------------------------------------------+ +| D13 | SPI SCK (Serial Clock Input) | ++-----------------------+---------------------------------------------+ +| SDA | FT6236 SDA | ++-----------------------+---------------------------------------------+ +| SCL | FT6236 SCL | ++-----------------------+---------------------------------------------+ + +.. note:: + Touch controller IRQ line is not connected by default. You will need + to solder the ``5 INT`` jumper to use it. You will also need to + adjust driver configuration and its Device Tree entry to make use of + it. + +Requirements +************ + +This shield can only be used with a board which provides a configuration +for Arduino connectors and defines node aliases for SPI and GPIO interfaces +(see :ref:`shields` for more details). + +Programming +*********** + +Set ``-DSHIELD=buydisplay_3_5_tft_touch_arduino`` when you invoke +``west build``. For example: + +.. zephyr-app-commands:: + :zephyr-app: samples/gui/lvgl + :board: nrf52840dk_nrf52840 + :shield: buydisplay_3_5_tft_touch_arduino + :goals: build + +References +********** + +.. target-notes:: + +.. _Buydisplay 3.5" TFT Touch Shield website: + https://www.buydisplay.com/lcd-3-5-inch-320x480-tft-display-module-optl-touch-screen-w-breakout-board + +.. _Arduino adapter website: + https://www.buydisplay.com/arduino-3-5-tft-lcd-touch-shield-serial-spi-example-for-mega-due