stemwin graphical library
Post on 17-Feb-2022
7 Views
Preview:
TRANSCRIPT
© BME-MIT 2018Budapest University of Technology and EconomicsDepartment of Measurement and Information Systems
ARM Cortex core microcontrollers
STemWin Graphical Library
Balázs Scherer
© BME-MIT 2018 2.
LCD display drivers
© BME-MIT 2018 3.
LCD display drivers
LCD with integrated controller and pixel memory
o Typicaly programmable through SPI
o Pixels are mapped to memory values
LCD without an integrated controller
o Complicated, requires high speed interfacing and huge amount of pixel memory
o Cannot be done without hardware peripheral support
© BME-MIT 2018 4.
LCD controller
TFT LCD controller
© BME-MIT 2018 5.
LCD controller
© BME-MIT 2018 6.
Memory requirement of LCD controllers
Usually single buffer is not enough. For multi layer graphical display multiple of the amount in the table is needed.
© BME-MIT 2018 7.
Graphical controller support of STM32f429
© BME-MIT 2018 8.
Graphical controller support of STM32f429
Uses 3 different clockso memória interface, regiszter, LCD control
Programable LCD timing: V, H sync
Up to 24 bit RBG color
Maximum 800x600 pixels
Support for multi layers: 2 + background
Ditherelés 2 bit / color
© BME-MIT 2018 9.
Chrom-ART Accelerator (DMA2D)
CPU can do other jobs: o Copying pictures, creating layered display
© BME-MIT 2018 10.
STM32 FMC controller: external memory
interface
External memory interfacing:o SDRAM, SRAM, Flash
o Max. 90 MHz, max. 32bit
SDRAM handling:o Periodic refresh is needed
o Low power modes are present
© BME-MIT 2018 11.
The emWIN Graphical library
© BME-MIT 2018 12.
Segger emWin Graphical Library
Portable graphical library
For 8,16, 32-bit microcontrollers
Optional RTOS support
Minimum configuration ~20kbyte Flash ~1k RAM
Not a free software library
o Many manufacturer made it free for their chipsets
© BME-MIT 2018 13.
Basic 2D library
Basic shapes and text datao Lines, squares, Circuits, triangles
o JPEG, PNG and bitmap displaying
o Shapes are drown with the front color, which is setable
GUI_SetColor(GUI_RED);
© BME-MIT 2018 14.
Example for using the 2D library I.
© BME-MIT 2018 15.
Example for using the 2D library II.
© BME-MIT 2018 16.
Example for using the 2D library III.
© BME-MIT 2018 17.
Example for using the 2D library IV.
Bárhova a képernyőn, akár saját betűtípusokkal
Szövegdobozok és létrehozhatók
© BME-MIT 2018 18.
Text displaying
With an external program user can create own character set.
© BME-MIT 2018 19.
Displaying pictures
Using an external program to create const data from the pictureo BmpCvt.exe: from bitmap
o Bin2c.exe: from other binary data
© BME-MIT 2018 20.
Human interface
Typically there are keyboard, key or cursor data
There are interface functions to handle these data
o GUI_StoreKeyMsg(): handling keyboard incoming data
o GUI_PID_StoreState(): Pointer Input Device event
o GUI_TOUCH_StoreState(): Touch screenevent
© BME-MIT 2018 21.
Windows system in emWin
Hierarchical windowed system
Using callbacks to handle data
Widget are used for user interface
Can work with RTOS, or without it.
© BME-MIT 2018 22.
Working without an RTOS
GUI_Exec() function should be called periodicaly
Need to use the interface functions of the human interface devices too.
© BME-MIT 2018 23.
With RTOS
A dedicated thread is needed. Functions to call:GUI_Exec(), GUI_Delay()
Need to configure in a header file (GUIConf.h)
© BME-MIT 2018 24.
Widget: Window + Gadget
Typically used embedded user interfaces
© BME-MIT 2018 25.
Creating a widget
Directly
o All widget has a handler and a dedicated function to create
o <WIDGET>_CreateEx() // Creation without user data.
o <WIDGET>_CreateUser() // Creation with user data
Indirectly
o Embedded to a dialog
o Dialog will contain the creation table
o <WIDGET>_CreateIndirect()
© BME-MIT 2018 26.
GUI builder
Windows based program to create a UI
© BME-MIT 2018 27.
Using STemWin
© BME-MIT 2018 28.
Creating a simple example
Currently no support for graphical library in CubeMx to the AtollicTruestudio
Download the example project from the home page
o STemwin_01.zip
o Unzip it into the Workspace
o Import / existing project into the workspace
© BME-MIT 2018 29.
Checking the project setups
Project uses external libraries and files from the Cube software library, The paths to these include folders and libraries should be given precisely and should be modified in different environment
o Project expect the Cube Repository under C:\Users\first_user\STM32Cube\
o And the STemWinC:\Users\first_user\STM32Cube\Repository\STM32Cube_FW_F4_V1.21.0\Middlewares\ST\STemWin
o Properties / C/C++ General / Paths and Symbols
Include
Libraries
Library paths
© BME-MIT 2018 30.
Includes
© BME-MIT 2018 31.
Libraries
© BME-MIT 2018 32.
Library path
© BME-MIT 2018 33.
Architecture of the demo project
Main function:
o Development board and, LCD inicialisation
o Starting the Demo
o Touch screen interrupt handling, timing handling
Basic_HelloWorld:
o Gui clear
o Setting character set
o Displaying a text
© BME-MIT 2018 34.
2D graphic example
void MainTask(void) {GUI_SetBkColor(GUI_WHITE);GUI_Clear();GUI_SetColor(GUI_RED);GUI_FillCircle(120, 120, 80);GUI_SetColor(GUI_BLUE);GUI_FillCircle(140, 140, 80);GUI_SetFont(&GUI_Font20_1);GUI_DispStringAt("Hello world!", (LCD_GetXSize()-
100)/2, (LCD_GetYSize()-20)/2);while(1);
}
© BME-MIT 2018 35.
Creating Widgets
Use Gui builder
Copy the generated file into the project
Call the Window inicialisation function (Create…)
Modify bahaviour
Call the GUI_Exec() periodically
© BME-MIT 2018 36.
GUI builder
void MainTask(void) {GUI_Clear();CreateAblak();while(1){GUI_Exec();}
}
top related