|
| 1 | +--- |
| 2 | +title: GIGA Display Shield AppWizard Guide |
| 3 | +description: 'Learn how to use Segger AppWizard with the GIGA Display Shield.' |
| 4 | +author: Benjamin Dannegård |
| 5 | +tags: [Display, appwizard, segger, GUI] |
| 6 | +--- |
| 7 | + |
| 8 | +## Introduction |
| 9 | + |
| 10 | +Segger AppWizard is a graphical framework for building powerful UIs, and is fully compatible with the GIGA Display Shield. It allows you to build UIs, using pre-made widgets like buttons, images, loading bars, sliders, checkboxes, etc. It also allows you to fully customize the screen space on the display. In this guide, we will go through some of the different components and interactions, so you can learn how to best use AppWizard for your own projects. |
| 11 | + |
| 12 | + |
| 13 | + |
| 14 | +Specifically, we will show you how to create a screen with AppWizard that includes some of the most common elements: a button, a text label, a progress bar, and a slider. We will also demonstrate how to export the code from AppWizard and create an Arduino library that implements the designed screen. |
| 15 | + |
| 16 | +## Hardware & Software Needed |
| 17 | + |
| 18 | +- [Arduino GIGA R1 WiFi](https://store.arduino.cc/products/giga-r1-wifi) |
| 19 | +- [Arduino GIGA Display Shield](https://store.arduino.cc/products/giga-display-shield) |
| 20 | +- [Arduino IDE](https://www.arduino.cc/en/software) |
| 21 | +- [AppWizard V1.44_6.38](https://www.segger.com/products/user-interface/emwin/tools/appwizard/) |
| 22 | +- [emWin Arduino Library](https://github.com/SEGGERMicro/emWin-Arduino-Library/) |
| 23 | + |
| 24 | +## Downloading the Library and Core |
| 25 | + |
| 26 | +The GIGA R1 core includes the [Arduino_H7_Video](https://github.com/arduino/ArduinoCore-mbed/tree/main/libraries/Arduino_H7_Video) library that handles the display. |
| 27 | + |
| 28 | +In this guide, we will be using three different libraries: |
| 29 | +- [Arduino_H7_Video](https://github.com/arduino/ArduinoCore-mbed/tree/main/libraries/Arduino_H7_Video), this one is bundled with the core, so make sure you have the latest version of the [Mbed core](https://github.com/arduino/ArduinoCore-mbed) installed. |
| 30 | +- [Arduino_GigaDisplayTouch](https://www.arduino.cc/reference/en/libraries/arduino_gigadisplaytouch/), handles touch on the GIGA Display Shield |
| 31 | +- [emWin Arduino Library](https://github.com/SEGGERMicro/emWin-Arduino-Library/) |
| 32 | + |
| 33 | +To install this, open the library manager and install the latest version by searching for **"Arduino_GigaDisplayTouch"**. |
| 34 | + |
| 35 | +## Creating an App Wizard Project |
| 36 | + |
| 37 | +First go to **File -> New Project** to start your new project. Here we need to configure certain settings so it will work on the GIGA Display Shield. Set the `display size x` to **480** and `display size y` to **800**. Then we need to disable the `Enable simulation` and `Generate loop in MainTask()` options. It should look like the image below. |
| 38 | + |
| 39 | + |
| 40 | + |
| 41 | +## Setting Up The Project |
| 42 | +First add a **screen** element to your project, this will be the base that contains all the other elements of the project. To add a background color add the **Box** object and set the color on the right side "Properties" menu. |
| 43 | + |
| 44 | + |
| 45 | + |
| 46 | +## Creating Objects |
| 47 | + |
| 48 | +### Button |
| 49 | + |
| 50 | +Add a button from the object menu. On the right hand properties menu you can set the color of the button when it is unpressed and pressed. |
| 51 | + |
| 52 | + |
| 53 | + |
| 54 | +In the right hand properties menu you can also add text to the button. Press the **set text** option. This will bring up a window that contains all the text elements in the project. Press **add text**, this will create a new text object with a unique id. Now to set the text that will be displayed press **New language** and enter **En**, we will be using English in this tutorial. Under the new **En** tab you can set the text that will be visible, change the **-** to **Button** and this text will be displayed on the button. |
| 55 | + |
| 56 | + |
| 57 | + |
| 58 | +### Slider |
| 59 | + |
| 60 | +Next create a slider by pressing the **Slider** button on the top left menu. You can configure the visual elements of the slider in the right "Properties" menu. |
| 61 | + |
| 62 | + |
| 63 | + |
| 64 | +### Switch |
| 65 | + |
| 66 | +Next create a slider by pressing the **Switch** button on the top left menu. You can configure the visual elements of the switch in the right "Properties" menu. |
| 67 | + |
| 68 | + |
| 69 | + |
| 70 | +### Rotary |
| 71 | + |
| 72 | +Next create a slider by pressing the **Rotary** button on the top left menu. You can configure the visual elements of the rotary in the right "Properties" menu. |
| 73 | + |
| 74 | + |
| 75 | + |
| 76 | +Now the complete project should look like this: |
| 77 | + |
| 78 | + |
| 79 | + |
| 80 | +Let's move on to how we can export this project to be displayed on the GIGA Display Shield. |
| 81 | + |
| 82 | +## Exporting the Project |
| 83 | + |
| 84 | +In AppWizard, go to **File -> Export & Save** in the upper left of the window. Now open the folder of the project. Create a new folder which we will put the exported files into, in this new folder create another folder named **src**. Now from the exported project folder, copy all the files contained in the **Resource** and **Source** subfolders (without copying the subfolders themselves) into the newly created **src** folder. Take all the files out of the folders before putting them in the **src** folder, if you have any folders inside of the **src** folder it will not import into the Arduino IDE later. |
| 85 | + |
| 86 | + |
| 87 | + |
| 88 | +Now the folder name needs to be removed from the `#include` directives of the generated files. Inside the **ID_SCREEN_00_Slots.c** file change the `#include "../Generated/Resource.h"` |
| 89 | +and `#include "../Generated/ID_SCREEN_00.h"` to `#include "Resource.h"` and `#include "ID_SCREEN_00.h"`. |
| 90 | + |
| 91 | + |
| 92 | + |
| 93 | +When this is done create a **library.properties** file inside the root of the newly created folder. Then put this text into the file, you can change the name to whatever you like: |
| 94 | + |
| 95 | +```arduino |
| 96 | +name=AppWizardDemoLib |
| 97 | +version=1.0.0 |
| 98 | +author=SEGGER Microcontroller GmbH |
| 99 | +maintainer=SEGGER Microcontroller GmbH [email protected] |
| 100 | +sentence= |
| 101 | +paragraph= |
| 102 | +category=Display |
| 103 | +url= |
| 104 | +architectures= |
| 105 | +includes= |
| 106 | +depends= |
| 107 | +``` |
| 108 | + |
| 109 | + |
| 110 | + |
| 111 | +Finally, to create the Arduino sketch, create an **examples** folder inside the root of the newly created folder, inside this **examples** folder you can create another folder containing the **demo.ino** file. Use the following code for the **demo.ino**: |
| 112 | + |
| 113 | +```arduino |
| 114 | +#include <Resource.h> |
| 115 | +void setup() { |
| 116 | + MainTask(); |
| 117 | +} |
| 118 | +void loop() { |
| 119 | + GUI_Exec(); |
| 120 | +} |
| 121 | +``` |
| 122 | + |
| 123 | + |
| 124 | + |
| 125 | +Now all that is left is to import this whole folder as a library into the Arduino IDE. First, **compress** the folder into a **.zip** format, then in the Arduino IDE go to **Sketch -> Include library -> Add .ZIP Library**, select the created .zip file and add it. |
| 126 | + |
| 127 | + |
| 128 | + |
| 129 | +Now the demo sketch should be accessible under the examples tab inside the library. The library will have the name given inside the **library.properties** file. |
| 130 | + |
| 131 | + |
| 132 | + |
| 133 | +Now select your board and upload the sketch. The GUI created in AppWizard should now display on the GIGA Display Shield! |
| 134 | + |
| 135 | + |
| 136 | + |
| 137 | +### Conclusion |
| 138 | + |
| 139 | +Now you have an idea of how to use the basic features of AppWizard! This tutorial went through how easy it is to import your design to your Arduino board using the Arduino IDE. You are now ready to create your own design and play around with AppWizard! |
0 commit comments