Skip to content

Commit c1fa899

Browse files
authored
Merge pull request #534 from arduino/karlsoderby/gds-fixes-monday
Karlsoderby/gds fixes monday
2 parents dd3904d + 96b8991 commit c1fa899

File tree

33 files changed

+366
-237
lines changed

33 files changed

+366
-237
lines changed
Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
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 its features.'
4+
author: 'Karl Söderby'
5+
hardware:
6+
- hardware/08.mega/boards/giga-r1-wifi
7+
- hardware/08.mega/shields/giga-display-shield
8+
tags: [Display, Touch, LVGL, GIGA, IMU, GFX]
9+
---
10+
11+
The [GIGA Display Shield](/hardware/giga-display-shield) is an accessory shield designed for the [GIGA R1 WiFi](/hardware/giga-r1-wifi) board. With it, you can render fast & sophisticated user interfaces on a **800x480** display with **touch support**.
12+
13+
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.
14+
15+
## Hardware & Software Needed
16+
17+
- [GIGA R1 WiFi](https://store.arduino.cc/products/giga-r1-wifi).
18+
- [GIGA Display Shield](https://store.arduino.cc/products/giga-display-shield)
19+
- [Arduino IDE](https://www.arduino.cc/en/software)
20+
21+
## Overview
22+
23+
To use the GIGA Display Shield, there are currently three supported alternatives to draw on the display.
24+
25+
### Option 1: GFX Library
26+
27+
The [Arduino_GigaDisplay_GFX](https://github.com/arduino/Arduino_GigaDisplay_GFX) library is a layer library for the [Adafruit_GFX](https://github.com/adafruit/Adafruit-GFX-Library) graphic core library. This library makes it easy to draw geometrical shapes, printing values, drawing pixels and more.
28+
29+
To get started with the GFX library, visit the [GIGA Display Shield GFX Guide](/tutorials/giga-display-shield/gfx-guide).
30+
31+
### Option 2: LVGL
32+
33+
The LVGL framework supports building more advanced UIs with dropdown menus, interactive buttons, scroll functionality using a grid system.
34+
35+
To get started, visit the [GIGA Display LVGL Guide](/tutorials/giga-display-shield/lvgl-guide)
36+
37+
### Option 3: ArduinoGraphics
38+
39+
[ArduinoGraphics](https://www.arduino.cc/reference/en/libraries/arduinographics/) is a simple library for more primitive drawings with a similar API to the GFX library.
40+
41+
To get started, visit the [GIGA Display Shield Draw Images Guide](/tutorials/giga-display-shield/basic-draw-and-image).
42+
43+
## Core & Libraries
44+
45+
The GIGA Display Shield requires you to install the core for GIGA boards, along with some additional software libraries.
46+
47+
The libraries can be installed via the Arduino IDE's library manager, where you will also discover examples.
48+
49+
### GIGA Core
50+
51+
To use the shield you will need a [GIGA R1 WiFi](https://store.arduino.cc/products/giga-r1-wifi) board. You also need to install the **GIGA core**, which can be done directly in the Arduino IDE, under "Board Manager". The source code for this core can be found in [this GitHub repository](https://github.com/arduino/ArduinoCore-mbed).
52+
53+
***For more details, see [Getting Started with GIGA R1 WiFi](/tutorials/giga-r1-wifi/giga-getting-started).***
54+
55+
### Arduino_H7_Video
56+
57+
The [Arduino_H7_Video](https://github.com/arduino/ArduinoCore-mbed/tree/main/libraries/Arduino_H7_Video) manages the video output and integrates third party frameworks such as [LVGL](https://lvgl.io/). This library is used to configure and initialize the display and to perform basic draw functions.
58+
59+
***This library is included with the GIGA core, and does not need to be installed. The documentation for this library is available [here](https://github.com/arduino/ArduinoCore-mbed/tree/main/libraries/Arduino_H7_Video/docs).***
60+
61+
### ArduinoGraphics
62+
63+
The [ArduinoGraphics](https://www.arduino.cc/reference/en/libraries/arduinographics/) is required for drawing operations on the screen.
64+
65+
***For source code and issues with the ArduinoGraphics library, please see the [GitHub repository](https://github.com/arduino-libraries/ArduinoGraphics).***
66+
67+
### Arduino_GigaDisplayTouch
68+
69+
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.
70+
71+
***For source code and issues with the Arduino_GigaDisplayTouch library, please see the [GitHub repository](https://github.com/arduino-libraries/Arduino_GigaDisplayTouch).***
72+
73+
### Arduino_GigaDisplay_GFX
74+
75+
The [Arduino_GigaDisplay_GFX](https://github.com/arduino-libraries/Arduino_GigaDisplay_GFX) library is a layer library for the [Adafruit_GFX](https://github.com/adafruit/Adafruit-GFX-Library) graphics core library.
76+
77+
This library is great for drawing geometrical shapes, printing text & values, drawing pixels and so on. It is recommended for beginners.
78+
79+
***Learn more about this library in the [GIGA Display Shield GFX Guide](/tutorials/giga-display-shield/gfx-guide).***
80+
81+
### Arduino_GigaDisplay
82+
83+
The [Arduino_GigaDisplay](https://github.com/arduino-libraries/Arduino_GigaDisplay) provides a large set of examples that can be used with the shield, many of which are included in the guides found in the documentation.
84+
85+
This library is also required to use the built-in RGB, which you can read more about in the [RGB](#rgb) section.
86+
87+
***This library lists out all recommended libraries as dependencies. Installing it through the IDE will also prompt you to install the libraries listed above.***
88+
89+
### Arduino_BMI270_BMM150 (IMU)
90+
91+
To access the onboard IMU, use the [Arduino_BMI270_BMM150](https://github.com/arduino-libraries/Arduino_BMI270_BMM150) library.
92+
93+
You can read more about its methods in the [library documentation](https://www.arduino.cc/reference/en/libraries/arduino_bmi270_bmm150/).
94+
95+
More information available in the [IMU section](#imu) in this document.
96+
97+
## Hardware Setup
98+
99+
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.
100+
101+
![Bottom View](assets/mounted.png)
102+
103+
This makes it possible to freely use the GIGA R1 WiFi's pins while the display shield is connected.
104+
105+
## Camera Connector
106+
107+
Located on the top side of the shield is a 20 pin camera connector, which is Arducam® compatible and supports a wide range of cameras. The connector is connected to the [GIGA R1 WiFi's camera connector](/tutorials/giga-r1-wifi/giga-camera#camera-connector), and is compatible with a wide range of cameras ([see Arducam cameras](https://www.arducam.com/camera-for-arduino-giga/)).
108+
109+
The connector is located just above the display, which makes it possible to see camera's feed directly on the display! Read more about this in the [GIGA Display Camera Connector Guide](/tutorials/giga-display-shield/camera-tutorial), complete with an example.
110+
111+
## IMU
112+
113+
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:
114+
115+
- [Giga Display Shield Automatic Orientation](/tutorials/giga-display-shield/image-orientation)
116+
117+
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:
118+
119+
```arduino
120+
BoschSensorClass imu(Wire1);
121+
```
122+
123+
Note that the examples use the default `IMU` (uppercase) class, which you will need to replace. Example:
124+
125+
```
126+
IMU.begin() //for other boards
127+
imu.begin() //for GIGA Display Shield
128+
```
129+
130+
## Microphone
131+
132+
This shield has an embedded omnidirectional microphone, **MP34DT06JTR**, which can be used 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 manually install it.
133+
134+
Below is a minimal sketch that will print out the samples in the serial plotter (See [Using the Serial Plotter Tool](/software/ide-v2/tutorials/ide-v2-serial-plotter) for more information).
135+
136+
<CodeBlock url="https://github.com/arduino/ArduinoCore-mbed/blob/main/libraries/PDM/examples/PDMSerialPlotter/PDMSerialPlotter.ino" className="arduino"/>
137+
138+
To get started with the microphone, visit the [GIGA Display Shield Microphone Guide](/tutorials/giga-display-shield/microphone-tutorial).
139+
140+
## RGB
141+
142+
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.
143+
144+
```arduino
145+
#include <Arduino_GigaDisplay.h>
146+
147+
GigaDisplayRGB rgb; //create rgb object
148+
149+
void setup() {
150+
rgb.begin(); //init the library
151+
}
152+
153+
void loop() {
154+
rgb.on(0, 0, 255); //turn on blue pixel
155+
delay(1000);
156+
rgb.off(); //turn off all pixels
157+
delay(1000);
158+
}
159+
```

content/hardware/10.mega/shields/giga-display-shield/tutorials/basic-draw-and-image/content.md renamed to content/hardware/10.mega/shields/giga-display-shield/tutorials/04.basic-draw-and-image/content.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
---
2-
title: Using Draw and Image Functions with the GIGA Display Shield
2+
title: GIGA Display Shield Draw Images Guide
33
description: 'Learn how to use basic draw functions to create and display images on the GIGA Display Shield.'
44
author: Benjamin Dannegård
55
hardware:
66
- hardware/10.mega/boards/giga-r1-wifi
77
- hardware/10.mega/shields/giga-display-shield
8-
tags: [Display, Draw]
8+
tags: [Display, Draw, Images]
99
---
1010

1111
The most basic use of the GIGA Display Shield is to draw an image on the screen using code. This is made easy by using the library `ArduinoGraphics`. In this tutorial we will go through how to draw the Arduino logo on the GIGA Display Shield with the commands provided by this library.
Lines changed: 201 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,201 @@
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 contacts, and in this guide you will learn about different methods to obtain the data.
11+
12+
## Hardware & Software Needed
13+
14+
- [GIGA R1 WiFi](/hardware/giga-r1-wifi).
15+
- [GIGA Display Shield](/hardware/giga-display-shield)
16+
- [Arduino IDE](https://www.arduino.cc/en/software)
17+
18+
## Overview
19+
20+
The **Arduino_GigaDisplayTouch** library can be used in combination with any of the available graphics libraries ([see available options](/tutorials/giga-display-shield/getting-started#overview)), but is independent from them and works standalalone.
21+
22+
The library has two methods of reading sensor data:
23+
- **Polling** - continuously read the sensor data through the `getTouchPoint()` method.
24+
- **IRQ** - only read data when the display is touched through an interrupt and a callback function, using the `onDetect()` method.
25+
26+
The number of contacts (fingers touching) can be retrieved and stored as an integer:
27+
28+
```arduino
29+
contacts = touchDetector.getTouchPoints(points);
30+
```
31+
32+
To read the `x` and `y` coordinates, we need to use a specific `struct` called `GDTpoint_t` which contains the values. The example belows simply iterates through the number of `contacts` and stores the coordinates of each contact.
33+
34+
```arduino
35+
GDTpoint_t points[5];
36+
uint8_t contacts;
37+
38+
for (uint8_t i = 0; i < contacts; i++) {
39+
x_coordinate = points[i].x;
40+
y_coordinate = points[i].y;
41+
}
42+
```
43+
44+
### Touch Interface
45+
46+
An option to consider
47+
48+
### Gesture Detection
49+
50+
As you are able to retrieve multiple touch points at very fast rates, it is possible to create **gesture detections**. You could for example:
51+
- change layout when swiping three fingers right,
52+
- zoom in and out using two fingers,
53+
- adjust the volume by swiping a finger from the bottom right corner and up,
54+
- and many more scenarios.
55+
56+
This library can together with the supported graphics libraries create really interactions that we are using in modern day smartphones, tablets etc., with an easy interface and very fast response times.
57+
58+
## Polling Example
59+
60+
The polling example demonstrates how to continuously read the touch sensor using the `getTouchPoints()` method. Whenever the display screen is touched, the number of contacts + the coordinates of each contact is printed to the Serial Monitor.
61+
62+
<CodeBlock url="https://github.com/arduino-libraries/Arduino_GigaDisplayTouch/blob/main/examples/Touch_Polling/Touch_Polling.ino" className="arduino"/>
63+
64+
## IRQ Example
65+
66+
The IRQ example demonstrates how to set up an interrupt that triggers a function anytime the screen is touched. The interrupt is set up inside of the `setup()` function, using the `onDetect(function)` method.
67+
68+
<CodeBlock url="https://github.com/arduino-libraries/Arduino_GigaDisplayTouch/blob/main/examples/Touch_IRQ/Touch_IRQ.ino" className="arduino"/>
69+
70+
## Delay Example
71+
72+
An important factor to consider is that the `loop()` on the GIGA R1 is executed at a very fast rate, meaning that you will register several touches each time you touch the screen.
73+
74+
This means that whenever you tap the screen, even quickly, you register somewhere between **5-20 touches**. So if you want a specific function to only execute once on a specific touch point, you will need to implement a delay in your code.
75+
76+
Using the conventional, but blocking `delay(microseconds)` method is possible but not ideal. The best method to register only a single touch is through using the `millis()` method.
77+
78+
The example below is based on the **Polling Example**, and limits the if statement to only execute once every `250` milliseconds. This can be edited in the `threshold` variable.
79+
80+
```arduino
81+
#include "Arduino_GigaDisplayTouch.h"
82+
83+
Arduino_GigaDisplayTouch touchDetector;
84+
int lastTouch;
85+
int threshold = 250; //time in milliseconds
86+
87+
void setup() {
88+
Serial.begin(115200);
89+
while(!Serial) {}
90+
91+
if (touchDetector.begin()) {
92+
Serial.print("Touch controller init - OK");
93+
} else {
94+
Serial.print("Touch controller init - FAILED");
95+
while(1) ;
96+
}
97+
}
98+
99+
void loop() {
100+
uint8_t contacts;
101+
GDTpoint_t points[5];
102+
103+
contacts = touchDetector.getTouchPoints(points);
104+
105+
// check if more time than the threshold defined has passed
106+
if (contacts > 0 && (millis() - lastTouch > threshold) ) {
107+
Serial.print("Contacts: ");
108+
Serial.println(contacts);
109+
110+
for (uint8_t i = 0; i < contacts; i++) {
111+
Serial.print(points[i].x);
112+
Serial.print(" ");
113+
Serial.println(points[i].y);
114+
}
115+
lastTouch = millis(); // register last touch
116+
}
117+
118+
delay(1);
119+
}
120+
```
121+
122+
## GFX Touch Example
123+
124+
The below example requires uses the [Arduino_GigaDisplay_GFX](https://github.com/arduino/Arduino_GigaDisplay_GFX) library, and demonstrates how to change a boolean whenever you touch the screen. It implements the `millis()` function to limit the number of executions.
125+
126+
Anytime the screen is touched, the background and text color inverts (black and white).
127+
128+
```arduino
129+
#include "Arduino_GigaDisplay_GFX.h"
130+
#include "Arduino_GigaDisplayTouch.h"
131+
132+
Arduino_GigaDisplayTouch touchDetector;
133+
GigaDisplay_GFX display;
134+
135+
#define WHITE 0xffff
136+
#define BLACK 0x0000
137+
138+
#define screen_size_x 480
139+
#define screen_size_y 800
140+
141+
int touch_x;
142+
int touch_y;
143+
144+
int lastTouch;
145+
int threshold = 250;
146+
147+
bool switch_1;
148+
149+
void setup() {
150+
// put your setup code here, to run once:
151+
Serial.begin(9600);
152+
display.begin();
153+
154+
if (touchDetector.begin()) {
155+
Serial.print("Touch controller init - OK");
156+
} else {
157+
Serial.print("Touch controller init - FAILED");
158+
while (1)
159+
;
160+
}
161+
changeSwitch();
162+
}
163+
164+
void loop() {
165+
uint8_t contacts;
166+
GDTpoint_t points[5];
167+
contacts = touchDetector.getTouchPoints(points);
168+
169+
if (contacts > 0 && (millis() - lastTouch > threshold)) {
170+
Serial.print("Contacts: ");
171+
Serial.println(contacts);
172+
173+
//record the x,y coordinates
174+
for (uint8_t i = 0; i < contacts; i++) {
175+
touch_x = points[i].x;
176+
touch_y = points[i].y;
177+
}
178+
179+
//as the display is 480x800, anywhere you touch the screen it will trigger
180+
if (touch_x < screen_size_x && touch_y < screen_size_y) {
181+
switch_1 = !switch_1;
182+
Serial.println("switched");
183+
changeSwitch();
184+
}
185+
lastTouch = millis();
186+
}
187+
}
188+
189+
void changeSwitch() {
190+
if (switch_1) {
191+
display.fillScreen(BLACK);
192+
display.setTextColor(WHITE);
193+
} else {
194+
display.fillScreen(WHITE);
195+
display.setTextColor(BLACK);
196+
}
197+
display.setCursor(50, screen_size_y/2);
198+
display.setTextSize(5);
199+
display.print("Switched");
200+
}
201+
```

content/hardware/10.mega/shields/giga-display-shield/tutorials/image-orientation/content.md renamed to content/hardware/10.mega/shields/giga-display-shield/tutorials/06.image-orientation/content.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: Screen Orientation With IMU Readings
2+
title: GIGA Display Shield Automatic Screen Orientation with IMU
33
description: "Learn how to use the GIGA Display Shield's IMU to determine the shield's orientation."
44
author: Benjamin Dannegård
55
tags: [Display, IMU, orientation, LVGL]

content/hardware/10.mega/shields/giga-display-shield/tutorials/microphone-tutorial/content.md renamed to content/hardware/10.mega/shields/giga-display-shield/tutorials/07.microphone-tutorial/content.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: GIGA Display Shield Microphone & LVGL Tutorial
2+
title: GIGA Display Shield Microphone Guide
33
description: "Learn how to use the GIGA Display Shield's microphone with LVGL."
44
author: Benjamin Dannegård
55
tags: [Display, microphone, LVGL]

0 commit comments

Comments
 (0)