FTDI EVE - FT800 easy display development

JUGmobile:
So now you will say: "Hey you were talking about touch input in the first post!". Yep, so now that we know how to show some primitives, lets make touch enabled GUI.

We will continue with our project in the post #2, where we have some text showed.

If we want to use touch screen we need to calibrate it first. This can be done very easily with calibrate() functon

void Calibrate()

{  
FTImpl.DLStart(); // Start display list
FTImpl.ClearColorRGB(102, 179, 26); // Background color
FTImpl.Clear(1,1,1);     // Background color set
FTImpl.ColorRGB(0xff, 0xff, 0xff); // Font color
FTImpl.Cmd_Text((FT_DISPLAYWIDTH/2), (FT_DISPLAYHEIGHT/2), 27, FT_OPT_CENTER, "Please press in the middle of circles"); // Show instructions
FTImpl.Cmd_Calibrate(0);
FTImpl.Finish(); // Display list
}




This code has to be called after BootupConfigure() function is called in the setup(). You will need to perform this every time you will power on FT800 chip. There is an option to manualy set calibrate parameters, but that is for another post.

Now add a button to the HelloWorld() function:


void HelloWorld(int tagoption)
{
/* Change the below string for experimentation */
const char Display_string[12] = "Hello World";

/* Display list to display "Hello World" at the centre of display area */
FTImpl.DLStart();//start the display list. Note DLStart and DLEnd are helper apis, Cmd_DLStart() and Display() can also be utilized.
FTImpl.ColorRGB(0xFF,0xFF,0xFF);//set the color of the string to while color
FTImpl.Cmd_Text(FT_DISPLAYWIDTH/2, FT_DISPLAYHEIGHT/2, 29, FT_OPT_CENTER, Display_string);//display "Hello World at the center of the screen using inbuilt font handle 29 "

// Here we want to create a button
FTImpl.Tag(12); // This is tag value for button
FTImpl.Cmd_Button((FT_DISPLAYWIDTH/4) - (50), (FT_DISPLAYHEIGHT*2/4) - (20), 100, 20, 26, tagoption, "Tag12");

FTImpl.DLEnd();//end the display list
FTImpl.Finish();//render the display list and wait for the completion of the DL
}




Note that we added tagoption in the function input ( HelloWorld(int tagoption) )

FTImpl.Tag(x); is an command to connect touch input of the following button ( FTImpl.Cmd_Button() ) with some value ( x ).

Also we added a button. First argument is x-coordinate of the button. Second is y-coordinate, third is width of a button in px, next is height of a button. Than we have font, that we want to be showed on the button (26). 6th argument is button appearing ( 0 means it is regular (3D effect), FT_OPT_FLAT means it is pressed (just flat without 3D effect) ). The last argument is just text to be showed on button.

If we compile this code and upload it to the arduino, we will now see a "Hello World" text on the screen and a button with "Tag12" written on.

Now we want to read touch input.



int tagval = sTagxy.tag; // Read tag touch input

int tagoption = 0;	
if(12 == tagval)
{
	tagoption = FT_OPT_FLAT;		// Flat, if button is pressed
	HelloWorld(tagoption);
}
else
{
	tagoption = 0;
	HelloWorld(tagoption);			// 3D if it's not
}



Copy and paste this code to the loop() function.

This won't work because we haven't declared sTagxy. So copy and paste this code right after #include statements:


sTagXY sTagxy;




Now we have complete code:


/*****************************************************************************

  • Copyright (c) Future Technology Devices International 2014
  • propriety of Future Technology devices International.
  • Software License Agreement
  • This code is provided as an example only and is not guaranteed by FTDI.
  • FTDI accept no responsibility for any issues resulting from its use.
  • The developer of the final application incorporating any parts of this
  • sample project is responsible for ensuring its safe and correct operation
  • and for any consequences resulting from its use.
    ***************************************************************************/
    /
  • @file                           HelloWorld.ino
  • @brief                          Sketch to display hello world on FT800.
     Tested platform version: Arduino 1.0.4 and later
  • @version                        0.1.0
  • @date                           2014/17/05

*/

/* This application demonstrates the usage of FT800 library on VM800P4350 platform */

/* Arduino standard includes */
#include "SPI.h"
#include "Wire.h"

/* Platform specific includes */
#include "FT_VM800P43_50.h"

/* Global object for FT800 Implementation */
FT800IMPL_SPI FTImpl(10, 3, 5);

/* Api to bootup ft800, verify FT800 hardware and configure display/audio pins /
/
Returns 0 in case of success and 1 in case of failure */
int16_t BootupConfigure()
{
uint32_t chipid = 0;
FTImpl.Init(FT_DISPLAY_RESOLUTION);//configure the display to the WQVGA

delay(20);//for safer side
chipid = FTImpl.Read32(FT_ROM_CHIPID);

/* Identify the chip */
if(FT800_CHIPID != chipid)
{
Serial.print("Error in chip id read ");
Serial.println(chipid,HEX);
return 1;
}

/* Set the Display & audio pins */
FTImpl.SetDisplayEnablePin(FT_DISPENABLE_PIN);
FTImpl.SetAudioEnablePin(FT_AUDIOENABLE_PIN);
FTImpl.DisplayOn();
FTImpl.AudioOn();  
return 0;
}

void Calibrate()
{  
FTImpl.DLStart(); // Start display list
FTImpl.ClearColorRGB(102, 179, 26); // Background color
FTImpl.Clear(1,1,1);     // Background color set
FTImpl.ColorRGB(0xff, 0xff, 0xff); // Font color
FTImpl.Cmd_Text((FT_DISPLAYWIDTH/2), (FT_DISPLAYHEIGHT/2), 27, FT_OPT_CENTER, "Please press in the middle of circles"); // Show instructions
FTImpl.Cmd_Calibrate(0);
FTImpl.Finish(); // Display list
}

/* API to display Hello World string on the screen /
void HelloWorld(int tagoption)
{
/
Change the below string for experimentation */
const char Display_string[12] = "Hello World";

/* Display list to display "Hello World" at the centre of display area */
FTImpl.DLStart();//start the display list. Note DLStart and DLEnd are helper apis, Cmd_DLStart() and Display() can also be utilized.
FTImpl.ColorRGB(0xFF,0xFF,0xFF);//set the color of the string to while color
FTImpl.Cmd_Text(FT_DISPLAYWIDTH/2, FT_DISPLAYHEIGHT/2, 29, FT_OPT_CENTER, Display_string);//display "Hello World at the center of the screen using inbuilt font handle 29 "

// Here we want to create a button
FTImpl.Tag(12); // This is tag value for button
FTImpl.Cmd_Button((FT_DISPLAYWIDTH/4) - (50), (FT_DISPLAYHEIGHT*2/4) - (20), 100, 20, 26, tagoption, "Tag12");

FTImpl.DLEnd();//end the display list
FTImpl.Finish();//render the display list and wait for the completion of the DL
}

/* bootup the module and display "Hello World" on screen /
void setup()
{
/
Initialize serial print related functionality */
Serial.begin(9600);

/* Set the Display Enable pin*/  
Serial.println("--Start Application--");
if(BootupConfigure())
{
 Calibrate();
 //error case - do not do any thing
}
  else
{
HelloWorld();
}
Serial.println("--End Application--");
}

/* Nothing in loop api */
void loop()
{
int tagval = sTagxy.tag; // Read tag touch input

int tagoption = 0;	
if(12 == tagval)
{
	tagoption = FT_OPT_FLAT;		// Flat, if button is pressed
	HelloWorld(tagoption);
}
else
{
	tagoption = 0;
	HelloWorld(tagoption);			// 3D if it's not
}

}

I ran your complete code in the end of post #3
and got this error

exit status 1
Error compiling for board Arduino/Genuino Uno.