background image

 

PSoC 6 TFT Display Interface with EmWin Graphics Library 

www.cypress.com

 

Document Number: 002-23726 Rev. *B 

    

/* Start the parallel interface */

 

    GraphicLCDIntf_1_Start(); 
 
    

/* Reset - High, Low (reset), High */

 

    Cy_GPIO_Set(

LCD_RESET_N_0_PORT

LCD_RESET_N_0_NUM

); 

    GUI_Delay(20); 
    Cy_GPIO_Clr(

LCD_RESET_N_0_PORT

LCD_RESET_N_0_NUM

); 

    GUI_Delay(100); 
    Cy_GPIO_Set(

LCD_RESET_N_0_PORT

LCD_RESET_N_0_NUM

); 

    GUI_Delay(100); 

…. 

GraphicLCDIntf_1_Write8_A0(0x28); 
GraphicLCDIntf_1_Write8_A0(0x11); 

//Exit Sleep mode 

GUI_Delay(100); 
GraphicLCDIntf_1_Write8_A0(0x36); 
GraphicLCDIntf_1_Write8_A1(0xA0);

//MADCTL: memory data access control 

GraphicLCDIntf_1_Write8_A0(0x3A); 
GraphicLCDIntf_1_Write8_A1(0x65);

//COLMOD: Interface Pixel format

 

…. 

 

If a different display controller is used, this function must be modified to send the appropriate command and data bytes 
as defined in the controller data sheet. 

7.  In  the 

LCDConf.c

  file,  the 

LCD_X_Config

  function  configures  various  parameters  required  by  the  driver.    Some 

important parts of this function are shown below. 

The 

GUI_DEVICE_CreatAndLink

 function sets the display driver and color palette.   

GUI_DEVICE

 * pDevice; 

pDevice = GUI_DEVICE_CreateAndLink(

DISPLAY_DRIVER

COLOR_CONVERSION

, 0, 0);

 

 

The configuration structure is updated with the display orientation; the 

GUIDRV_FlexColor_Config

 function sets up 

the display driver.  The ST7789S controller has a resolution of 240x320. However, the display used in the TFT shield 
has a resolution of 320x240.  Because of this swapping of X and Y resolutions, the orientation is set to swap X and Y 
axes and mirror the Y axis. 

CONFIG_FLEXCOLOR

 Config = {0}; 

Config.Orientation   = 

GUI_MIRROR_Y

 | 

GUI_SWAP_XY

GUIDRV_FlexColor_Config(pDevice, &Config);

 

 

The PortAPI structure sets the pointers to the APIs that perform read and write through the GraphicLCDIntf parallel 
interface.  The 

GUIDRV_FlexColor_SetFunc

 function is called to configure the Port APIs, specific display controller, 

and interface. 

GUI_PORT_API

 PortAPI = {0}; 

PortAPI.pfWrite8_A0  = GraphicLCDIntf_1_Write8_A0; 
PortAPI.pfWrite8_A1  = GraphicLCDIntf_1_Write8_A1; 
PortAPI.pfWriteM8_A1 = GraphicLCDIntf_1_WriteM8_A1; 
PortAPI.pfRead8_A1  = GraphicLCDIntf_1_Read8_A1; 
PortAPI.pfReadM8_A1  = GraphicLCDIntf_1_ReadM8_A1; 
GUIDRV_FlexColor_SetFunc(pDevice, &PortAPI, 

GUIDRV_FLEXCOLOR_F66709

GUIDRV_FLEXCOLOR_M16C0B8

);

 

 

See Section 33.7.4 

“GUIDRV_FlexColor” in the EmWin user guide for details. 

8.  Open  the 

GUIConf.c

  file.    This  file  manages  the  RAM  allocation  for  the  EmWin  library.    The  value  of  the  macro 

GUI_NUMBYTES

  macro  must  be  set  according  to  the  approximate  memory  requirement  based  on  EmWin  library 

features used by the application. This will depend on the various options enabled in  the 

GUIConf.h

 file.  See Section 

37.2, 

“Memory Requirements” in the EmWin user guide for details on the memory usage for various features.  For this 

code example, the memory size has been set to an arbitrary 0x1000 bytes.  You can set this to a smaller value based 
on the features used in your application. 

9.  The 

GUI_X.c

  file  has  timing  functions  used  by  the  EmWin  library.    The  content  of  this  file  varies  based  on  the  OS 

support selected.  No modifications are required in this file for this code example. 

Содержание CE223726

Страница 1: ...Integrated Design Environment IDE If you are new to PSoC 6 MCU see the application note AN210781 Getting Started with PSoC 6 MCU with Bluetooth Low Energy BLE Connectivity For details of EmWin Graphi...

Страница 2: ...IT 062 BLE kit guide for details on how to program firmware into the device The TFT display shows the startup screen for three seconds followed by a screen that displays instructions to press SW2 to s...

Страница 3: ...PSoC 6 TFT Display Interface with EmWin Graphics Library www cypress com Document Number 002 23726 Rev B 3 Figure 3 Startup Screen and Instructions Screen...

Страница 4: ...lay Interface with EmWin Graphics Library www cypress com Document Number 002 23726 Rev B 4 Figure 4 Pages Shown in Sequence Important Note When you build the project you will see the following notifi...

Страница 5: ...TFT shield has a Newhaven 2 4 320 240 TFT display with a Sitronix ST7789 display controller and uses the 8080 Series Parallel Interface There are two important parts in this code example 1 EmWin Grap...

Страница 6: ...iver Library Under the Graphics emWin section select the Core and LCD Driver options Figure 7 Build Settings 2 Select the nOSnTS option for Core because this project does not use RTOS or Touch support...

Страница 7: ...controller has a resolution of 240x320 pixels This controller supports various color palettes This project uses the 16 bits per pixel RGB 5 6 5 color palette 5 bits R 6 bits G 6 bits G Per the EmWin...

Страница 8: ...esolutions the orientation is set to swap X and Y axes and mirror the Y axis CONFIG_FLEXCOLOR Config 0 Config Orientation GUI_MIRROR_Y GUI_SWAP_XY GUIDRV_FlexColor_Config pDevice Config The PortAPI st...

Страница 9: ...nent SW2 is a digital input that is connected to SW2 on the CY8CKIT 062 BLE kit This pin is configured as Resistive Pull Up SW2 is connected to a Status Register to read the switch status A 100 Hz clo...

Страница 10: ...ister Status_SW2 This status register is used to read SW2 status See the PSoC Creator project for more details on PSoC Component configurations and design wide resource settings Related Documents Appl...

Страница 11: ...ment Title CE223726 PSoC 6 TFT Display Interface with EmWin Graphics Library Document Number 002 23726 Revision ECN Orig of Change Submission Date Description of Change 6299269 GRAA 09 18 2018 New cod...

Страница 12: ...n Cypress hardware or software products Cypress shall have no liability arising out of any security breach such as unauthorized access to or use of a Cypress product CYPRESS DOES NOT REPRESENT WARRANT...

Отзывы: