A Free Template From Joomlashack

A Free Template From Joomlashack

Sign in with a social network::

Powered by OneAll Social Login

Chat with us

The FTDI EVE graphics controller (3) PDF Print E-mail
Written by Brian Millier   
Friday, 27 May 2016 00:00

 

SE1

Introducing some useful FT800 GUI Routines

At the end of last month's EVE article, I showed you the basic code needed to initialize the FT800 controller and to produce a simple start-up screen. I mentioned that you must do some form of touchscreen calibration if you wish to use the touchscreen capability.

FTDI makes this process simple by defining a high-level graphics co-processor command that does all of the necessary work. You need to include the following line in your program to start this calibration routine:

Ft_Gpu_CoCmd_Calibrate(phost,0);

You should note that you must call this command from within a routine that first sets up the graphics co-processor ring buffer properly, and afterwards initiates the actual transfer between the ring buffer and the FT800 co-processor engine. Here is how this is accomplished in the FTDI sample programs:

Ft_Gpu_CoCmd_Dlstart(phost);
Ft_App_WrCoCmd_Buffer(phost,CLEAR_COLOR_RGB(64,64,64));
Ft_App_WrCoCmd_Buffer(phost,CLEAR(1,1,1));
Ft_App_WrCoCmd_Buffer(phost,COLOR_RGB(0xff,0xff,0xff));
Ft_Gpu_CoCmd_Text(phost,(FT_DispWidth/2), (FT_DispHeight/2), 27, OPT_CENTER,"Please Tap on the dot");
Ft_Gpu_CoCmd_Calibrate(phost,0);
Ft_Gpu_CoCmd_Swap(phost);
/* Wait till coprocessor completes the operation */
Ft_Gpu_Hal_WaitCmdfifo_empty(phost);

LISTING 1

Most of the commands have already been covered in part 2, so I won't explain them again. The calibration routine places three small, flashing circles on the screen, one at a time, and you have to accurately tap each one of them as close to the center of the circle as possible. The routine makes use of the FT800's audio functions, so if you are using an FTDI VM800B43A evaluation module which contains an audio amplifier/speaker, you will hear a beep after you tap each circle.

What this routine does is to measure the touchscreen's ADC readings at the three pre-defined co-ordinates and then do some math to generate six 32-bit calibration constants. These six constants are automatically stored in the FT800's register space in the following locations:

REG_TOUCH_TRANSFORM_A

through

REG_TOUCH_TRANSFORM_F

downDownload program

downDownload article 

The FTDI EVE graphics controller (3)

2014_219_33

Last Updated on Tuesday, 31 May 2016 14:54
 
Free Joomla Templates: by JoomlaShack