Skip to content

Commit 402af53

Browse files
authored
Merge pull request #515 from arduino/karlsoderby/gdisplay-gettingstarted
[GIGA Display Shield] Getting started + touch guides
2 parents 46cd510 + 3ec6e51 commit 402af53

File tree

8 files changed

+188
-0
lines changed

8 files changed

+188
-0
lines changed
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
---
2+
title: 'GIGA Display Shield Touch Interface'
3+
description: 'Learn how to use the touch interface on the GIGA Display Shield.'
4+
author: Karl Söderby
5+
tags: [Display, Touch Screen]
6+
---
7+
8+
The [GIGA Display Shield](/hardware/giga-display-shield) has an advanced touch interface, supported via the [Arduino_GigaDisplayTouch](https://github.com/arduino-libraries/Arduino_GigaDisplayTouch) library.
9+
10+
This library is used to return the number of contact points, and the `x,y` coordinates for each of these. For example, touching the screen with two fingers somewhere on the screen would generate the following:
11+
12+
- `x` - 0-480 (x-axis)
13+
- `y` - 0-800 (y-axis)
14+
- `contacts` - number of touchpoints (fingers on the screen).
15+
16+
***Please note that any example with the GIGA Display Shield requires a GIGA R1 WiFi board. To get started with the shield, visit the [Getting Started with GIGA Display Shield](/tutorials/giga-display-shield/getting-started).***
17+
18+
## Hardware & Software Needed
19+
20+
- [GIGA R1 WiFi](/hardware/giga-r1).
21+
- [GIGA Display Shield](/hardware/giga-display-shield)
22+
- [Arduino IDE](https://www.arduino.cc/en/software)
23+
24+
## Install Arduino_GigaDisplayTouch
25+
26+
The [Arduino_GigaDisplayTouch](https://www.arduino.cc/reference/en/libraries/arduino_gigadisplaytouch/) is used to read touchpoints across the screen, and returns the number of **contacts** and **coordinates**.
27+
28+
![Install Arduino_GigaDisplayTouch](assets/install-touchlib.png)
29+
30+
***For source code and issues with the Arduino_GigaDisplayTouch library, please see the [GitHub repository](https://github.com/arduino-libraries/Arduino_GigaDisplayTouch).***
31+
32+
## LVGL
33+
34+
This library works with the [lvgl](https://github.com/lvgl/lvgl) framework, which provides a rich set of interactive widgets like buttons, dropdowns, radio buttons etc. This requires a touch interface, and the **Arduino_GigaDisplayTouch** provides just that.
35+
36+
***Learn more about how to use the lvgl framework with the GIGA Display Shield in [this tutorial](/tutorials/giga-display-shield/lvgl-guide).***
37+
38+
## Coordinates Example
39+
40+
To retrieve the coordinates when touching the display, we can use the **Touch_Polling** example from the library. You will find it at **Arduino_GigaDisplayTouch > Touch_Polling** in the IDE (library needs to be installed), or you will find it just below:
41+
42+
<CodeBlock url="https://github.com/arduino-libraries/Arduino_GigaDisplayTouch/tree/main/examples/Touch_Polling" className="arduino"/>
43+
44+
Upload the example to your GIGA R1 WiFi board, and open the **Serial Monitor** tool. If there any initialization issues, it will be printed here. Otherwise, you should see:
45+
46+
```
47+
Touch controller init - OK
48+
```
49+
50+
Seeing this, you can start touching the display area with one or more fingers. The serial monitor will print out how many "contacts" aka fingers you are using, and the coordinates for each point. Here's an example response:
51+
52+
```
53+
Contacts: 2 <---- two fingers used
54+
245 346 <---- x = 245, y = 346
55+
178 473 <---- x = 178, y = 473
56+
```
57+
58+
In this case, we have two touchpoints, and the coordinates for each of them printed below (`x`,`y`). And that's pretty much it to obtain a successful reading from the touch interface.
59+
60+
You can use this to build customised gestures on the screen such as swiping two fingers left to trigger an animation, or three fingers up to change the background color.
61+
62+
## Summary
63+
64+
In this tutorial, we have explored the **Arduino_GigaDisplayTouch** library and tested out an example that allows us to read the coordinates of our touches. This library is essential for developing sophisticated touch displays using the lvgl framework.
Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
---
2+
title: 'Getting Started with the GIGA Display Shield'
3+
description: 'Learn how to set up and use the GIGA Display Shield and get an overview of the features.'
4+
author: 'Karl Söderby'
5+
tags: [Displays, LVGL, GIGA, IMU]
6+
---
7+
8+
The [GIGA Display Shield](/hardware/giga-display-shield) is an accessory shield designed for the [GIGA R1 WiFi](/hardware/giga-r1) board. With it, you can render fast & sophisticated user interfaces on a **800x480** display with **touch support**.
9+
10+
In this guide you will learn how to set your board up with the GIGA R1 WiFi board & become familiar with the available libraries to control it.
11+
12+
## Hardware & Software Needed
13+
14+
- [GIGA R1 WiFi](/hardware/giga-r1).
15+
- [GIGA Display Shield](/hardware/giga-display-shield)
16+
- [Arduino IDE](https://www.arduino.cc/en/software)
17+
18+
## Overview
19+
20+
There are three official libraries available to use the display & touch interface:
21+
- [Arduino_H7_Video](https://github.com/arduino/ArduinoCore-mbed/tree/main/libraries/Arduino_H7_Video) - manages the video output and integrates third party libraries such as [LVGL](https://lvgl.io/) and [emWin](https://www.segger.com/products/user-interface/emwin/). This library is used to configure and initialize the display and to perform basic draw functions.
22+
- [ArduinoGraphics](https://www.arduino.cc/reference/en/libraries/arduinographics/) - a graphics primitive library that provides draw, text and animation functions.
23+
- [Arduino_GigaDisplayTouch](https://github.com/arduino-libraries/Arduino_GigaDisplayTouch) - to handle the touch interface of the display.
24+
25+
The above libraries provides a basic set of functionalities. To build more sophisticated UI's, frameworks such as [LVGL](https://lvgl.io/) is required.
26+
27+
The LVGL framework allows you to build user interfaces using existing widgets such as buttons, gauges, text fields, drop down menus and much more.
28+
29+
***To get started with LVGL and get access to some useful examples, visit the [Guide to LVGL with GIGA Display Shield](/tutorials/giga-display-shield/lvgl-guide) tutorial.***
30+
31+
## Installation
32+
33+
The GIGA Display Shield requires you to install the core for GIGA boards, along with some additional software libraries.
34+
35+
### Install GIGA Core
36+
37+
To use the shield you will need to have a GIGA R1 WiFi board. To use the GIGA R1 WiFi, you will need to install the **GIGA core**, which can be done directly in the Arduino IDE, under "Board Manager".
38+
39+
![Install GIGA core.](assets/install-giga.png)
40+
41+
***For more details, see [Getting Started with GIGA R1 WiFi](/tutorials/giga-r1-wifi/giga-getting-started).***
42+
43+
44+
### Install ArduinoGraphics
45+
46+
The [ArduinoGraphics](https://www.arduino.cc/reference/en/libraries/arduinographics/) is required for drawing operations on the screen.
47+
48+
You can install it directly in the IDE, in the "Library Manager":
49+
50+
![Install ArduinoGraphics](assets/install-arduinographics.png)
51+
52+
***For source code and issues with the ArduinoGraphics library, please see the [GitHub repository](https://github.com/arduino-libraries/ArduinoGraphics).***
53+
54+
### Install Arduino_GigaDisplayTouch
55+
56+
The [Arduino_GigaDisplayTouch](https://www.arduino.cc/reference/en/libraries/arduino_gigadisplaytouch/) is required for reading touch points on the screen, and is needed when using the LVGL's framework.
57+
58+
![Install Arduino_GigaDisplayTouch](assets/install-touchlib.png)
59+
60+
***For source code and issues with the Arduino_GigaDisplayTouch library, please see the [GitHub repository](https://github.com/arduino-libraries/Arduino_GigaDisplayTouch).***
61+
62+
## Hardware Setup
63+
64+
To use the GIGA Display Shield, mount it on the **bottom** side of the GIGA R1 WiFi board. The GIGA R1 WiFi board will be flipped upside down when the display is used.
65+
66+
![Bottom View](assets/mounted.png)
67+
68+
### Camera Connector
69+
70+
Located on the top side of the shield is a camera connector that enables when you connect it to the GIGA R1 WiFi board.
71+
72+
## IMU
73+
74+
This shield has a built-in IMU module, the **BMI270**. This sensor can be used for a number of purposes, for example to automatically orientate an object on the screen, see the following tutorial:
75+
76+
- [Giga Display Shield Automatic Orientation](/tutorials/giga-display-shield/image-orientation)
77+
78+
To access **BMI270**, use the [BMI270-250](https://www.arduino.cc/reference/en/libraries/arduino_bmi270_bmm150/) library. Please note that the sensor is not connected to the main I2C bus, so you will need to initialize the sensor on another bus. To do so, simply add the line below to the top of your sketch:
79+
80+
```arduino
81+
BoschSensorClass imu(Wire1);
82+
```
83+
84+
Note that the examples uses the default `IMU` (uppercase) class, which you will need to replace. Example:
85+
86+
```
87+
IMU.begin() //for other boards
88+
imu.begin() //for GIGA Display Shield
89+
```
90+
91+
## Microphone
92+
93+
This shield has an embedded omnidirectional microphone, **MP34DT06JTR**, which can be used to together with the [PDM](https://docs.arduino.cc/learn/built-in-libraries/pdm) library. This library is shipped with the GIGA core, so there's no need to install it.
94+
95+
Below is a minimal sketch that will print out the samples in the serial plotter (a tool that is part of the Arduino IDE).
96+
97+
<CodeBlock url="https://github.com/arduino/ArduinoCore-mbed/blob/main/libraries/PDM/examples/PDMSerialPlotter/PDMSerialPlotter.ino" className="arduino"/>
98+
99+
## RGB
100+
101+
This shield has a built in RGB pixel that is controlled via I2C. To use this, install the [Arduino_GigaDisplay](https://github.com/arduino-libraries/Arduino_GigaDisplay) library. The following sketch is a minimal example that will blink the blue pixel every second.
102+
103+
```arduino
104+
#include <Arduino_GigaDisplay.h>
105+
106+
GigaDisplayRGB rgb; //create rgb object
107+
108+
void setup() {
109+
rgb.begin(); //init the library
110+
}
111+
112+
void loop() {
113+
rgb.on(0, 0, 255); //turn on blue pixel
114+
delay(1000);
115+
rgb.off(); //turn off all pixels
116+
delay(1000);
117+
}
118+
```
119+
120+
## Summary
121+
122+
In this guide we have covered the requirements & installation needs for using the GIGA Display Shield, as well as demonstrating how to access the RGB, IMU & Microphone peripherals.
123+
124+
For more tutorials, visit the [documentation page for GIGA Display Shield](/hardware/giga-display-shield).

0 commit comments

Comments
 (0)