emWin Graphics Library and GUI for PSoC | Cypress Semiconductor

emWin Graphics Library and GUI for PSoC

CY8CKIT-028-TFT Display Shield using emWinemWin is an embedded graphic library and graphical user interface (GUI) framework. It provides an efficient, processor- and display-controller-independent graphics platform for applications that need a display. Examples include home appliances as well as automotive, IoT, and industrial applications. emWin is compatible with single-task and multitask environments. SEGGER Microcontroller가 개발한 emWin은 임베디드 산업에서 가장 널리 애용되고 있는 라이브러리입니다. Cypress has licensed the emWin library from SEGGER and offers it free to PSoC® customers.

emWin can be used with PSoC 3, PSoC 4, PSoC 5LP, and PSoC 6 MCUs. Supported features vary as shown in the table.

특징 PSoC 3 PSoC 4, PSoC 5LP PSoC 6
General Features

2D Graphics Library

Display Bitmap files

Multitask

Virtual Screens / Virtual Pages

2D Graphics library

Display Bitmap files

Fonts

Memory Devices

Multitask

Window Manager

Window Objects (Widgets)

Virtual Screens / Virtual Pages

Antialiasing

Input Devices Keyboard Input

Pointer Input Devices

Touch Screen Support

Sprites and Cursors

Language Support Unicode

Unicode

Text and Language Resource Files

Right to Left and Bidirectional Text

Display Drivers

LCDLin

LCD667xx

LCDTemplate

LCDNull

BitPlains

FlexColor

CompactColor_16

GraphicLCDCtrl custom driver

BitPlains

FlexColor

CompactColor_16

Lin

Spage

Template

Toolchains

Keil PK51

GCC

Keil MDK

GCC

Keil MDK

ARM compiler v6

IAR v8

GCC

emWin Overview

The block diagram below shows the high-level details of how emWin integrates into an application.

EmWin Block Diagram

 

emWin Library has two parts, the GUI framework and the display drivers. The GUI framework has functions like displaying text, bitmap images, widgets and drawing 2D graphics (lines, rectangles, circles etc). The display drivers interface with different types of display controllers. Peripheral drivers are the hardware interface to the display like SPI, UART, parallel interface, etc. The application layer implements Port API functions that control the hardware interface and perform operations like command write, single byte data write, multiple byte data writes, etc. The emWin display driver uses these functions to communicate with the display. The application layer allocates display memory that is used by the display driver. The application layer uses the functions provided by the emWin GUI framework to perform graphic operations on the display.

 

Design Flow:

The block diagram shows the emWin design flow. Some of these steps may be optional depending on the device family and design platform.

EmWin Design Flow

1) Select emWin core: emWin supports various combinations of OS and Touch support. The method to select the option for different platforms can be found in the respective Getting Started documentation.

2) Select display driver: The list of display drivers and display controllers supported by these drivers can be found in the emWin user guide. From the user guide, select the display driver.

3) Copy library and configuration files: Depending on the selected core option and display driver, copy the relevant files into the project.

4) Port APIs and display configuration: Write Port API functions to communicate with the display and update emWin’s Port access functions with pointer to these functions. Configure display parameters like number of pixels, orientation, color profile, number of bits per pixel etc. in emWin’s configuration file.

5) Application code: In application code, call emWin’s graphic functions to draw graphics.

 

 

Getting Started Information for various device families.

 

PSoC 6:

Development Tool: PSoC Creator or ModusToolbox

Code Examples:

emWin Software: emWin Middleware Github Repository

  • For PSoC 6 device families, emWin is provided as a middleware package for ModusToolbox and Mbed OS.

Getting Started:

Once installed in the default location, the Getting Started information can be found in the following locations

  • PSoC Creator: <PDL Installation Folder>/doc/pdl_api_reference_manual.html
  • ModusToolbox 2.0: <Middleware Installation Folder>/docs

emWin User Guide:

Details on graphic APIs, features and display drivers may be found in the emWin User Guide.

  • PSoC 6 Mbed OS: {{middleware:1}}\docs\UM03001_emWin5.pdf
  • PSoC 6 ModusToolbox 2.0: <Middleware Installation Folder>\docs\UM03001_emWin5.pdf

 

PSoC 3, PSoC 4 and PSoC 5LP:

Development Tool: PSoC Creator

Code Examples: PSoC Creator Code Examples

emWin Software: SEGGER emWin Graphic Library Version 5.46

  • emWin is provided as a library package that can be manually included in a project.
  • This package has the limited feature 8051 library for PSoC 3 and the full feature library for PSoC 4 and PSoC 5LP. This library can be used with Keil_PK51, GCC, and Keil MDK toolchains.

Getting Started: Once installed in the default location, the Getting Started information can be found in the following location.

<PDL Installation Folder>/doc/pdl_api_reference_manual.html

emWin User Guide:

Details on graphic APIs, features and display drivers may be found in the emWin User Guide. The user guide may be found in the following folder when the emWin v5.46 package (emWinGraphics_v5_46.zip) is unpacked.

  • PSoC 3: emWinGraphics_v5_46\Documentation\PSoC3\UM03002_emWin_8051.pdf
  • PSoC 4 & PSoC 5LP: emWinGraphics_v5_46\Documentation\PSoC4_5\UM03001_emWin5.pdf
 

Segger has developed various tools to enhance the development of graphic applications. Following tools are included in the Cypress emWin package.

Bitmap Converter:

The Bitmap Converter converts common image file formats like BMP, PNG or GIF into the desired emWin bitmap format. That can be a C file that can be compiled and linked with the project, or a binary format that can be loaded at runtime. Simply load an image into the application. Convert the color format if necessary and save it in the appropriate format.

emWinView:

The emWin viewer allows viewing the display output while stepping through (debugging) the simulation. The display output normally could not be seen while stepping through code. When the debug thread is halted, all other threads of the process are also halted. This includes the thread that outputs the simulated display on the screen.

GUIBuilder:

The GUIBuilder application is a tool for creating dialogs. Instead of writing source code the widgets can be placed and sized by drag and drop. Additional properties can be added by context menu. Fine tuning can be done by editing the properties of the widgets. This does not require any knowledge of the C programming language. The dialogs can be saved as C files which can be enhanced by adding user defined code.

Location of Tools:

In Mbed OS, when emWin middlware is imported into the Mbed project, the tools are located in the following folder inside the Mbed project.

<Middleware Installation Folder>\Tool

In ModusToolbox, the tools are located in the following folders.

For ModusToolbox 2.0:

<Middleware Installation Folder>/Tool

The emWin User Guide has information on how to use these tools. Location of emWin User Guide may be found in the Getting Started tab