samples: display: Remove ILI9340 sample

Remove ILI9340 display sample as there is a unified display sample
in samples/drivers/display.

Signed-off-by: Jan Van Winkel <jan.van_winkel@dxplore.eu>
This commit is contained in:
Jan Van Winkel 2020-01-16 21:36:02 +01:00 committed by Anas Nashif
commit b912df91cf
9 changed files with 0 additions and 353 deletions

View file

@ -1,8 +0,0 @@
# SPDX-License-Identifier: Apache-2.0
cmake_minimum_required(VERSION 3.13.1)
include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE)
project(ili9340)
FILE(GLOB app_sources src/*.c)
target_sources(app PRIVATE ${app_sources})

View file

@ -1,135 +0,0 @@
.. _ili9340-sample:
ILI9340 Display driver
######################
Overview
********
Every half-second, this sample application draws a color-filled rectangle in a
corner of the LCD display. The rectangle fill color cycles through red, green,
and blue on each update.
Requirements
************
- `ST NUCLEO-L476RG development board`_
- `Adafruit 2.2 inch TFT Display`_
or
- :ref:`nrf52_pca10040`
- `Seeed 2.8 inch TFT Touch Shield V2.0`_
or
- :ref:`nrf52840_pca10056`
- `Adafruit 2.8 inch TFT Touch Shield`_
Wiring
******
The NUCLEO-L476RG should be connected as follows to the Adafruit TFT display.
+------------------+-----------------+----------------+
| | NUCLEO-L476RG | | NUCLEO-L476RG | | Adafruit TFT |
| | Arduino Header | | Pin | | Pin |
+==================+=================+================+
| D3 | PB3 | SCK |
+------------------+-----------------+----------------+
| D7 | PA8 | D/C |
+------------------+-----------------+----------------+
| D8 | PA9 | RST |
+------------------+-----------------+----------------+
| D11 | PA7 | MOSI |
+------------------+-----------------+----------------+
| D12 | PA6 | MISO |
+------------------+-----------------+----------------+
| A2 | PA4 | NSS |
+------------------+-----------------+----------------+
The Seeed 2.8 inch TFT Touch Shield V2.0 should be plugged in the Arduino
header on :ref:`nrf52_pca10040`. The following pins will be connected except
the TFT reset pin. A separate wire should connect P0.21 pin to RESET pin on
the :ref:`nrf52_pca10040`.
+-------------+-------------+
| | nRF52832 | | Seeed TFT |
| | Pin | | Pin |
+=============+=============+
| P0.25 | SPI_SCK |
+-------------+-------------+
| P0.23 | SPI_MOSI |
+-------------+-------------+
| P0.24 | SPI_MISO |
+-------------+-------------+
| P0.16 | TFT_CS |
+-------------+-------------+
| P0.17 | TFT_DC |
+-------------+-------------+
| P0.21 | RESET |
+-------------+-------------+
The Adafruit 2.8 inch TFT Touch Shield should be plugged in the Arduino header
on :ref:`nrf52840_pca10056`. The following pins will be connected.
+-------------+----------------+
| | nRF52840 | | Adafruit TFT |
| | Pin | | Pin |
+=============+================+
| P1.15 | SCLK |
+-------------+----------------+
| P1.13 | MOSI |
+-------------+----------------+
| P1.14 | MISO |
+-------------+----------------+
| P1.12 | TFT_CS |
+-------------+----------------+
| P1.11 | TFT_DC |
+-------------+----------------+
Building and Running
********************
For NUCLEO-L476RG, build this sample application with the following commands:
.. zephyr-app-commands::
:zephyr-app: samples/display/ili9340
:board: nucleo_l476rg
:goals: build
:compact:
See :ref:`nucleo_l476rg_board` on how to flash the build.
For :ref:`nrf52_pca10040`, build this sample application with the following commands:
.. zephyr-app-commands::
:zephyr-app: samples/display/ili9340
:board: nrf52_pca10040
:goals: build
:compact:
See :ref:`nrf52_pca10040` on how to flash the build.
For :ref:`nrf52840_pca10056`, build this sample application with the following commands:
.. zephyr-app-commands::
:zephyr-app: samples/display/ili9340
:board: nrf52840_pca10056
:goals: build
:compact:
See :ref:`nrf52840_pca10056` on how to flash the build.
References
**********
- `ILI9340 datasheet`_
- `ILI9341 datasheet`_
.. _Adafruit 2.2 inch TFT Display: https://www.adafruit.com/product/1480
.. _ST NUCLEO-L476RG development board: http://www.st.com/en/evaluation-tools/nucleo-l476rg.html
.. _Seeed 2.8 inch TFT Touch Shield V2.0: https://www.seeedstudio.com/2-8-TFT-Touch-Shield-V2-0-p-1286.html
.. _Adafruit 2.8 inch TFT Touch Shield: https://www.adafruit.com/product/1947
.. _ILI9340 datasheet: https://cdn-shop.adafruit.com/datasheets/ILI9340.pdf
.. _ILI9341 datasheet: https://www.newhavendisplay.com/app_notes/ILI9341.pdf

View file

@ -1,5 +0,0 @@
CONFIG_SPI_1=y
CONFIG_SPI_1_NRF_SPI=y
CONFIG_ILI9340_RGB565=y
CONFIG_ILI9340_LCD_SEEED_TFTV2=y

View file

@ -1,22 +0,0 @@
/*
* Copyright (c) 2019 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: Apache-2.0
*/
&spi1 {
status = "okay";
sck-pin = <25>;
mosi-pin = <23>;
miso-pin = <24>;
cs-gpios = <&gpio0 16 0>;
ili9340@0 {
compatible = "ilitek,ili9340";
label = "DISPLAY";
spi-max-frequency = <10000000>;
reg = <0>;
reset-gpios = <&gpio0 21 0>;
cmd-data-gpios = <&gpio0 17 0>;
};
};

View file

@ -1,2 +0,0 @@
CONFIG_SPI_STM32=y
CONFIG_SPI_1=y

View file

@ -1,14 +0,0 @@
/* SPDX-License-Identifier: Apache-2.0 */
&spi1 {
status = "okay";
ili9340@0 {
compatible = "ilitek,ili9340";
label = "DISPLAY";
spi-max-frequency = <15151515>;
reg = <0>;
reset-gpios = <&gpioa 9 0>;
cmd-data-gpios = <&gpioa 8 0>;
};
};

View file

@ -1,12 +0,0 @@
CONFIG_PRINTK=y
CONFIG_HEAP_MEM_POOL_SIZE=16384
CONFIG_SPI=y
CONFIG_DISPLAY=y
CONFIG_ILI9340=y
CONFIG_DISPLAY_LOG_LEVEL_DBG=y
CONFIG_LOG=y

View file

@ -1,12 +0,0 @@
sample:
description: TBD
name: TBD
tests:
sample.display.ili9340:
build_only: true
platform_whitelist: nucleo_l476rg nrf52_pca10040
tags: display
sample.display.adafruit_2_8_tft_touch_v2:
platform_whitelist: nrf52840_pca10056
extra_args: SHIELD=adafruit_2_8_tft_touch_v2
tags: shield

View file

@ -1,143 +0,0 @@
/*
* Copyright (c) 2017 Jan Van Winkel <jan.van_winkel@dxplore.eu>
* Copyright (c) 2019 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <device.h>
#include <drivers/display.h>
#include <stdio.h>
#include <string.h>
#include <zephyr.h>
#define LOG_LEVEL CONFIG_LOG_DEFAULT_LEVEL
#include <logging/log.h>
LOG_MODULE_REGISTER(main);
/* This example will update each 500ms one of the LCD corners
* wit a rectangular bitmap.
* The color of the bit map is changed for every
* iteration and is picked out of a set of red, green and blue.
*/
void main(void)
{
struct device *dev;
struct display_capabilities capabilities;
struct display_buffer_descriptor buf_desc;
#ifdef CONFIG_ILI9340_RGB565
const size_t rgb_size = 2;
#else
const size_t rgb_size = 3;
#endif
/* size of the rectangle */
const size_t w = 40;
const size_t h = 20;
const size_t buf_size = rgb_size * w * h;
u8_t *buf;
/* xy coordinates where to place rectangles*/
size_t x0, y0, x1, y1, x2, y2, x3, y3;
size_t color = 0;
size_t cnt = 0;
int h_step;
dev = device_get_binding(DT_INST_0_ILITEK_ILI9340_LABEL);
if (dev == NULL) {
LOG_ERR("Device not found. Aborting test.");
return;
}
display_get_capabilities(dev, &capabilities);
x0 = 0;
y0 = 0;
x1 = capabilities.x_resolution - w;
y1 = 0;
x2 = capabilities.x_resolution - w;
y2 = capabilities.y_resolution - h;
x3 = 0;
y3 = capabilities.y_resolution - h;
/* Allocate rectangular buffer for corner data */
buf = k_malloc(buf_size);
if (buf == NULL) {
LOG_ERR("Could not allocate memory. Aborting test.");
return;
}
/* Clear ili9340 frame buffer before enabling LCD, reuse corner buffer
*/
(void)memset(buf, 0, buf_size);
h_step = (w * h) / capabilities.x_resolution;
buf_desc.buf_size = buf_size;
buf_desc.pitch = capabilities.x_resolution;
buf_desc.width = capabilities.x_resolution;
buf_desc.height = h_step;
for (int idx = 0; idx < capabilities.y_resolution; idx += h_step) {
display_write(dev, 0, idx, &buf_desc, buf);
}
display_blanking_off(dev);
buf_desc.pitch = w;
buf_desc.width = w;
buf_desc.height = h;
while (1) {
/* Update the color of the rectangle buffer and write the buffer
* to one of the corners
*/
#ifdef CONFIG_ILI9340_RGB565
/* RGB565 format */
uint16_t color_r;
uint16_t color_g;
uint16_t color_b;
uint16_t color_rgb;
color_r = (color == 0) ? 0xF800U : 0U;
color_g = (color == 1) ? 0x07E0U : 0U;
color_b = (color == 2) ? 0x001FU : 0U;
color_rgb = color_r + color_g + color_b;
for (size_t idx = 0; idx < buf_size; idx += rgb_size) {
*(buf + idx + 0) = (color_rgb >> 8) & 0xFFU;
*(buf + idx + 1) = (color_rgb >> 0) & 0xFFU;
}
#else
/* RGB888 format */
(void)memset(buf, 0, buf_size);
for (size_t idx = color; idx < buf_size; idx += rgb_size) {
*(buf + idx) = 255U;
}
#endif
switch (cnt % 4) {
case 0:
display_write(dev, x0, y0, &buf_desc, buf);
break;
case 1:
display_write(dev, x1, y1, &buf_desc, buf);
break;
case 2:
display_write(dev, x2, y2, &buf_desc, buf);
break;
case 3:
display_write(dev, x3, y3, &buf_desc, buf);
break;
}
++cnt;
++color;
if (color > 2) {
color = 0;
}
k_sleep(K_MSEC(500));
}
}