tft
Vitis Drivers API Documentation
xtft_example.c File Reference

Overview

This file contains a design example using the driver functions of the XTft driver.

This example shows the usage of the driver/device to

  • Write a character and write a string of characters
  • Draw a line
  • Turn ON/OFF the TFT Device
Note

TFT_FRAME_ADDR specifies the starting address of the 2MB space for storing the frame data and has to be defined by the user based on the system memory map.

MODIFICATION HISTORY:
Ver    Who   Date      Changes


1.00a sg 03/24/08 First release 1.00a sg 09/24/08 Updated the example to update the Video Memory Base Address with the Memory specified by the application 2.00a ktn 07/09/09 Updated the example to poll the Vsync(Video address latch) status bit before writing to the Address Register (AR) 4.00a bss 01/22/13 Updated the example to use DDR_HIGH_ADDR to support for some AXI memory controllers, User needs to define it with a valid address. 6.00 ms 01/23/17 Added xil_printf statement in main function to ensure that "Successfully ran" and "Failed" strings are available in all examples. This is a fix for CR-965028. 6.4 sd 07/08/23 Added SDT support.

 

Macros

#define TFT_DEVICE_ID   XPAR_TFT_0_DEVICE_ID
 The following constants map to the XPAR parameters created in the xparameters.h file. More...
 
#define TFT_FRAME_ADDR   DDR_HIGH_ADDR - 0x001FFFFF
 User has to specify a 2MB memory space for filling the frame data. More...
 
#define FGCOLOR_VALUE   0x0000FF00
 Color Values. More...
 
#define BGCOLOR_VALUE   0x0
 Background Color - Black. More...
 
#define WHITECOLOR_VALUE   0x00FFFFFF
 Color - White. More...
 
#define X1POS   100
 Start and End point Coordinates for the line. More...
 
#define X2POS   100
 Column End Position. More...
 
#define Y1POS   50
 Row Start Position. More...
 
#define Y2POS   450
 Row End Position. More...
 

Functions

int TftExample (u32 TftDeviceId)
 This is the example function which performs the following operations on the TFT device -. More...
 
int main ()
 Main function that invokes the Tft example. More...
 

Macro Definition Documentation

#define BGCOLOR_VALUE   0x0

Background Color - Black.

Referenced by TftExample().

#define FGCOLOR_VALUE   0x0000FF00

Color Values.

Foreground Color - Green

Referenced by TftExample().

#define TFT_DEVICE_ID   XPAR_TFT_0_DEVICE_ID

The following constants map to the XPAR parameters created in the xparameters.h file.

They are defined here such that a user can easily change all the needed parameters in one place.

Referenced by main().

#define TFT_FRAME_ADDR   DDR_HIGH_ADDR - 0x001FFFFF

User has to specify a 2MB memory space for filling the frame data.

This constant has to be updated based on the memory map of the system.

Referenced by TftExample().

#define WHITECOLOR_VALUE   0x00FFFFFF

Color - White.

Referenced by TftExample().

#define X1POS   100

Start and End point Coordinates for the line.

Column Start Position

Referenced by TftExample().

#define X2POS   100

Column End Position.

Referenced by TftExample().

#define Y1POS   50

Row Start Position.

Referenced by TftExample().

#define Y2POS   450

Row End Position.

Referenced by TftExample().

Function Documentation

int main ( )

Main function that invokes the Tft example.

Parameters
None.
Returns
  • XST_SUCCESS if successful.
  • XST_FAILURE if unsuccessful.
Note
None.

References TFT_DEVICE_ID, and TftExample().

int TftExample ( u32  TftDeviceId)

This is the example function which performs the following operations on the TFT device -.

  • Set the color values of foreground and background
  • Write two characters (S) one after another
  • Write a string of characters
  • Draw a line and scroll the screen once
  • Disable the display (The screen goes blank)
  • Scroll the screen once and draw a line
  • Enable the TFT display
Parameters
TftDeviceIdis the unique Id of the device.
Returns
  • XST_SUCCESS if successful.
  • XST_FAILURE if unsuccessful.
Note
None.

References XTft_Config::BaseAddress, BGCOLOR_VALUE, FGCOLOR_VALUE, TFT_FRAME_ADDR, WHITECOLOR_VALUE, X1POS, X2POS, XTft_CfgInitialize(), XTft_ClearScreen(), XTft_DisableDisplay(), XTft_EnableDisplay(), XTft_GetVsyncStatus(), XTFT_IESR_VADDRLATCH_STATUS_MASK, XTft_LookupConfig(), XTft_Scroll(), XTft_SetColor(), XTft_SetFrameBaseAddr(), XTft_Write(), Y1POS, and Y2POS.

Referenced by main().