Digit Recognition AI/ML Application on SAM E51 IGAT Curiosity Evaluation Kit Using MPLAB® Harmony v3: Step 5

Last modified by Microchip on 2023/11/09 09:08

Configure Legato Graphics on GFX composer

To launch the Legato Graphics Composer window from the Project Graph tab, select Plugins > Legato Graphics Composer.
Open Legato graphics composer
Click image to enlarge.
When it prompts to create a new project or load an existing project, choose Create a new project using the new project wizard on the Legato Graphics Composer window.
Legato welcome window
Click image to enlarge.

Configure the Display Configuration as shown in the accompanying image and click Next.

The display resolution used in the SAM E51 IGAT Curiosity Evaluation Kit is 480X320.
Display resolution

Display configuration
Click image to enlarge.
Configure the Color Mode, select the RGB_565 as Nomenclature as shown in the accompanying image and click Next.
Color mode
Click image to enlarge.
Select the Memory Profile as M4 as the SAM E51 is a Cortex M4 microcontroller device and click Next.
Memory profile
Click image to enlarge.

Disable Start with a basic quick start project template as shown.

Click Next.

Project template enable

When prompted, click the Finish button.

Graphics finish button

You will see the window as shown here.

Basic quick start project window

Back to top


Add Images, Fonts, Strings, and Global Palette

You can add required Images, Fonts, Strings and Global Palette as assets under the Asset tab. These assets will be useful in the further development of Display Screen Design.

Asset tab

Images

Add the required images under Asset > Image.

Click on Import RGB Image and redirect to the image files under <your unzip folder>/digit_recognition/dev_files/images as described.

Import RGB image​​

Select RGB image

Once the image is added to the Image asset, configure the Image Properties first then configure the Raw Image Settings as shown here.

Similarly, import all the required images under the ../dev_files/images folder.

Configure image properties

Fonts

Add and configure the required font\fonts under Asset > Fonts as shown in the accompanying image.

Configure fonts

Strings

Add and configure the required strings under Asset > Strings as shown in the accompanying image.

  • StartDrawing value : Start Drawing
  • TouchTitle value : Digit Recognition

Configure strings

 

Global Palette

You can use the default Global Palette configuration of the GFX Composer as shown in the accompanying image.

Global palette

Back to top


Add Schemes

From the Schemes tab on the lower left of the Legato Graphics Composer window.

Click on the green Plus button to add a new scheme.

Schemes

Once the scheme is added, configure the scheme in the Scheme Editor tab with the properties shown in the accompanying image.

Scheme configuration

Scheme configuration

Add one more scheme and configure the scheme in Scheme Editor with the properties shown in the accompanying image.

Scheme configuration

Scheme configuration

Base color editor configuration

Scheme configuration

Foreground Inactive color editor configuration

Back to top


Add Screen Tree

Select and delete the BackgroundPanel object under Layer 0 by clicking on Delete Selected Objects.

Delete selected objects

  • Add and configure the four Panel widgets on four sides of the display screen as shown here. These four-panel widgets will reduce the screen load time when the screen needs to update in the run time to display the result or output of the application
  • Configure the panel widget by using the panel widget parameters shown in the following steps
Step 1

Double-click on Panel in the Toolbox window and drop on the screen area to add the Panel widget to the Layer 0.

Panel widget instructions

 

Step 2

Configure the Panel widget parameters in the Object Editor.

Panel widget parameters 0

PanelWidget0 Parameters

Panel widget parameters 1

PanelWidget1 Parameters

Panel widget parameters 2

PanelWidget2 Parameters

Panel widget parameters 3

PanelWidget3 Parameters

 

Add and configure the Draw Surface widget on the display screen design as shown here. This will be useful to read the drawn points on this specific area (configured area). This surface widget can notify when the user has drawn on this defined screen area if this option is enabled.

Configure the surface widget by using surface widget parameters and with the following instructions.

Step 1

Double-click on Draw Surface in the Toolbox window and drop on the screen area to add the Draw Surface widget to the Layer 0.

Surface widget instructions

Caption

 

 

Step 2

Configure the Draw Surface widget parameters in the Object Editor

  • Define the Draw Surface area size in multiples of 28 x 28, as the final image will be compressed to a 28x28 pixel size and the image will be passed to the TensorFlow Interpreter to process and compare with the 28x28 pixel grayscale image database
  • Make sure the Draw Surface area size is in multiples of 2 (2, 4, 8, 16, etc…). This will be helpful to convert the image to a 28 x 28 pixel size using the left-shift binary division method (dividing technique when the divider is a multiple of 2)
Example:
In this project, the Draw Surface area is defined as 224 x 224. Note that 224 is in multiples of 28 and 8.
Surface widget parameters

DrawSurfaceWidget0 Parameters

 

 

 

Add and configure the Image widget on the display screen design as shown here.

Configure the image widget by using the image widget parameters shown in the following steps.

Step 1

Double-click on Image in the Toolbox window and drop on the screen area to add the Image widget to the Layer 0.

Image widget instructions

Caption

Step 2

Configure the Image widget parameters in the Object Editor.

GestureImageWiget Parameters

This image area is to display the result of the Gesture Image drawn by the user on the display screen.

Image widget parameters

ImageWidget0 Parameters

This image is to display the Microchip Logo on the display screen.

Image widget parameters

ImageWidget1 Parameters

This image is to display the Application Logo on the display screen.

Image widget parameters

Add and configure the Label widget on the display screen design as shown here.

Configure the Label widget by using the Label widget parameters shown in the following steps

Step 1

Double-click on Label in the Toolbox window and drop on the screen area to add the Label widget to the Layer 0.

Label widget instructions

Step 2

Configure the Label widget parameters in the Object Editor.

DrawInstructionLabel Parameters

This label is to display the Draw Instruction to the user on the display screen.

Label widget parameters

LabelWidget0 Parameters

This label is to display the Application Name on the display screen.

Label widget parameters

 

You can configure the Legato Graphics Settings like Assets, Code Generator, Display, Editor, Library, Memory, 

Renderer and Widget under Project > Project Settings.

Project settings tab

Use the default Legato Graphic Project settings created by the Legato Graphics composer except for the Renderer settings.
Click on Renderer and configure the Scratch Buffer Size then click on the OK button.

Renderer configuration

You can configure Legato Graphics project Memory Configuration under 

Project > Memory Locations.

Memory locations tab

Click on the green Plus button and configure the QSPI_XIP configuration as shown here.

QSPI memory configuration

Update the Internal SRAM capacity as shown in the accompanying image.

Internal SRAM configuration

 

Configure the display screen configuration by clicking an empty area of the display screen design as shown in the accompanying image.
Display screen configuration
Click image to enlarge.

After completing the previous steps, save the design by clicking on the Save Design Save design icon button.
If it prompts for a path, choose the required path and ZIP file name. In general, use the default project path and ZIP file name suggested by the Legato Graphics Composer.
Once the design is saved, generate the code by clicking on the Generate Code Generate code icon button.

With this, you have completed the Display Graphics design on Legato Graphics Composer.

Save design
Click image to enlarge.

Back to top