title | description | author | tags | ||||
---|---|---|---|---|---|---|---|
GIGA Display Shield AppWizard Guide |
Learn how to use Segger AppWizard with the GIGA Display Shield. |
Benjamin Dannegård |
|
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 screenspace 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.
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.
The GIGA R1 core includes the Arduino_H7_Video library that handles the display.
In this guide, we will be using three different libraries:
- Arduino_H7_Video, this one is bundled with the core, so make sure you have the latest version of the Mbed core installed.
- Arduino_GigaDisplayTouch, handles touch on the GIGA Display Shield
- emWin Arduino Library
To install this, open the library manager and install the latest version by searching for "Arduino_GigaDisplayTouch".
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.
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.
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.
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.
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.
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.
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.
Now the complete project should look like this:
Let's move on to how we can export this project to be displayed on the GIGA Display Shield.
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.
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"
and #include "../Generated/ID_SCREEN_00.h"
to #include "Resource.h"
and #include "ID_SCREEN_00.h"
.
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:
name=AppWizardDemoLib
version=1.0.0
author=SEGGER Microcontroller GmbH
maintainer=SEGGER Microcontroller GmbH [email protected]
sentence=
paragraph=
category=Display
url=
architectures=
includes=
depends=
And lastly 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:
#include <Resource.h>
void setup() {
MainTask();
}
void loop() {
GUI_Exec();
}
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. And then in the Arduino IDE go to Sketch -> Include library -> Add .ZIP Library. Then select the created .zip file and add it.
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.
Now select your board and upload the sketch. The GUI created in AppWizard should now display on the GIGA Display Shield!
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!