|
1 | 1 | ---
|
2 |
| -title: Square Line With the GIGA Display Shield |
3 |
| -description: "Learn how to use Square Line to create LVGL elements for the GIGA Display Shield" |
| 2 | +title: SquareLine Studio With the GIGA Display Shield |
| 3 | +description: "Learn how to use SquareLine Studio to create LVGL elements for the GIGA Display Shield" |
4 | 4 | author: Benjamin Dannegård
|
5 |
| -tags: [Display, square line, LVGL] |
| 5 | +tags: [Display, squareline, LVGL] |
6 | 6 | ---
|
7 | 7 |
|
8 |
| - |
| 8 | +The GIGA Display Shield with the GIGA R1 WiFi board can run LVGL which allows for the creation of GUIs. To make the design of the GUI easier we can use the software SquareLine Studio. This will allow us to drag and drop different elements and then export it for usage on the display shield. |
9 | 9 |
|
10 | 10 | ## Hardware & Software Needed
|
11 | 11 |
|
12 | 12 | - [Arduino GIGA R1 WiFi](https://store.arduino.cc/products/giga-r1-wifi)
|
13 | 13 | - [Arduino GIGA Display Shield](https://store.arduino.cc/products/giga-display-shield)
|
14 | 14 | - [Arduino IDE](https://www.arduino.cc/en/software)
|
| 15 | +- [SquareLine Studio](https://squareline.io/) |
15 | 16 |
|
16 | 17 | ## Downloading the Library and Core
|
17 | 18 |
|
18 |
| -Make sure the latest GIGA Core is installed in the Arduino IDE. **Tools > Board > Board Manager...**. Here you need to look for the **Arduino Mbed OS Giga Boards** and install it, the [Arduino_H7_Video library](https://github.com/arduino/ArduinoCore-mbed/tree/main/libraries/Arduino_H7_Video) is included in the core. Now you have to install the library needed. Go to **Tools > Manage libraries..**, search for **LVGL**, and install it. |
| 19 | +Make sure the latest GIGA Core is installed in the Arduino IDE. **Tools > Board > Board Manager...**. Here you need to look for the **Arduino Mbed OS Giga Boards** and install it, the [Arduino_H7_Video library](https://github.com/arduino/ArduinoCore-mbed/tree/main/libraries/Arduino_H7_Video) is included in the core. Now you have to install the library needed. Go to **Tools > Manage libraries..**, search for [**LVGL**](https://github.com/lvgl/lvgl) and [**Arduino_GigaDisplayTouch**](https://github.com/arduino-libraries/Arduino_GigaDisplayTouch), install both of these libraries. |
| 20 | + |
| 21 | +## Using SquareLine Studio |
| 22 | + |
| 23 | +First download SquareLine Studio from the link above. Now in SquareLine Studio go to the "create" section and select the Arduino tab. On the right you can set the "project settings". These needs to be set like so: |
| 24 | + |
| 25 | +- **Project name**: Set the name of your project |
| 26 | +- **Resolution**: 800x480 (to fully use the 800x480 screen in landscape mode, select 480x800 for portrait) |
| 27 | +- **Color depth**: 16 bit |
| 28 | +- **LVGL version**: 8.3.x |
| 29 | + |
| 30 | +As show on this image: |
| 31 | + |
| 32 | + |
| 33 | + |
| 34 | +Finally click on the "create" button. |
| 35 | + |
| 36 | +### Creating the GUI |
| 37 | + |
| 38 | +Now it is time to create the GUI that will be on the display shield. Feel free to customize your GUI however you want. On the left there are plenty of handy widgets that can be drag and dropped. On the right you can set more specific options for the widgets. |
| 39 | + |
| 40 | + |
| 41 | + |
| 42 | +### Exporting a Project From SquareLine Studio |
| 43 | + |
| 44 | +Now that the project is ready it is time to export it. First click on the "Export" tab at the top, then select "Create Template Project" and select the destination for your exported files. When that is done click on the "Export UI Files" and wait for the process to finish. |
| 45 | + |
| 46 | + |
| 47 | + |
| 48 | +Now all the files should be in the folder that you specified. |
| 49 | + |
| 50 | +### Running the SquareLine Studio Project on Arduino IDE |
| 51 | + |
| 52 | +In the folder that you exported the files to, go into the "libraries" folder and then copy the "ui" folder. |
| 53 | + |
| 54 | + |
| 55 | + |
| 56 | +Place this folder in your **Arduino->Libraries** folder. |
| 57 | + |
| 58 | +Now to run the SquareLine Studio project, use this sketch: |
| 59 | + |
| 60 | +```arduino |
| 61 | +#include "Arduino_H7_Video.h" |
| 62 | +#include "Arduino_GigaDisplayTouch.h" |
19 | 63 |
|
20 |
| -## Downloading Square Line |
| 64 | +#include "lvgl.h" |
| 65 | +#include "ui.h" |
21 | 66 |
|
| 67 | +/* Insert resolution WxH according to your SquareLine studio project settings */ |
| 68 | +Arduino_H7_Video Display(800, 480, GigaDisplayShield); |
| 69 | +Arduino_GigaDisplayTouch Touch; |
22 | 70 |
|
23 |
| -### Using Square Line |
| 71 | +void setup() { |
| 72 | + Display.begin(); |
| 73 | + Touch.begin(); |
24 | 74 |
|
| 75 | + ui_init(); |
| 76 | +} |
25 | 77 |
|
26 |
| -### Running the Square Line Project on Arduino IDE |
| 78 | +void loop() { |
27 | 79 |
|
28 |
| -### Results |
| 80 | + /* Feed LVGL engine */ |
| 81 | + lv_timer_handler(); |
| 82 | +} |
| 83 | +``` |
29 | 84 |
|
30 |
| -## Testing It Out |
| 85 | +## Next Step |
31 | 86 |
|
| 87 | +If you are curious about how LVGL works with the GIGA Display Shield, take a look at our [LVGL Guide](/tutorials/giga-display-shield/lvgl-guide). |
32 | 88 |
|
| 89 | +LVGL can also be used in combination with the sensors on the display shield. Have a look at our [Image Orientation tutorial](/tutorials/giga-display-shield/image-orientation). |
0 commit comments