Updating Button Text And Colour

FTDI/Bridgetek EVE2 & EVE3 SPI TFT Series by Matrix Orbital

Moderator: Mods

Post Reply
Andrew
LCD?
Posts: 4
Joined: Wed Jul 03, 2019 1:55 pm

Updating Button Text And Colour

Post by Andrew » Wed Jul 03, 2019 2:03 pm

Hello,

Thanks for taking the time to read my dismal plea for help.

I am wanting to have a button change color and text once pressed.

Here's my code:

Ft_Gpu_CoCmd_FgColor(phost,0xB5B5B5);
Ft_App_WrCoCmd_Buffer(phost,TAG_MASK(1));
Ft_App_WrCoCmd_Buffer(phost,TAG(1));
Ft_Gpu_CoCmd_Button(phost,11, 407, 175, 60, 31, 0, "DO IT!");
Ft_App_WrCoCmd_Buffer(phost,TAG_MASK(0));


Above this code at the start of my function:


while(1)
{
tag = Ft_Gpu_Hal_Rd8(phost,REG_TOUCH_TAG);

if(tag==1) // was do it pressed?
{
Ft_Gpu_CoCmd_Dlstart(phost);
Ft_App_WrCoCmd_Buffer(phost,CLEAR(1,1,1)); //Buffer Clear
Ft_Gpu_CoCmd_FgColor(phost,0xE5E5C5);

Ft_Gpu_CoCmd_Button(phost,11, 407, 175, 60, 31, 0, "GO BACK");
Ft_App_WrCoCmd_Buffer(phost,DISPLAY());
Ft_Gpu_CoCmd_Swap(phost);




What I want is:

When user presses Do It! The button color changes, the text changes and Do It! does something.
It could be anything.

Thanks for your help.

Daniel Divino
Matrix Orbital
Matrix Orbital
Posts: 247
Joined: Thu Sep 24, 2015 9:38 am

Re: Updating Button Text And Colour

Post by Daniel Divino » Thu Jul 04, 2019 5:03 pm

Hi Andrew,

Welcome to the forums!

Here's a piece of code that will change the state of the button when it's held down.

Code: Select all

	int tag = 0;
	while (1)
	{
		tag = Ft_Gpu_Hal_Rd8(phost, REG_TOUCH_TAG);
		Ft_Gpu_CoCmd_Dlstart(phost);
		Ft_App_WrCoCmd_Buffer(phost, CLEAR_COLOR_RGB(255, 255, 255));
		Ft_App_WrCoCmd_Buffer(phost, CLEAR(1, 1, 1));
		Ft_App_WrCoCmd_Buffer(phost, COLOR_RGB(0x80, 0x80, 0x00));

		switch (tag)
		{
		case 1:								
			Ft_Gpu_CoCmd_FgColor(phost, 0xE5E5C5);
			Ft_App_WrCoCmd_Buffer(phost, TAG(1));
			Ft_Gpu_CoCmd_Button(phost, 11, 407, 175, 60, 31, 0, "GO BACK");
			break;
		default:			
			Ft_Gpu_CoCmd_FgColor(phost, 0xB5B5B5);			
			Ft_App_WrCoCmd_Buffer(phost, TAG(1));
			Ft_Gpu_CoCmd_Button(phost, 11, 407, 175, 60, 31, 0, "DO IT!");			
			break;
		}
		Ft_App_WrCoCmd_Buffer(phost, DISPLAY());
		Ft_Gpu_CoCmd_Swap(phost);
		 //Download the commands into fifo 
		Ft_App_Flush_Co_Buffer(phost);

		//Wait till coprocessor completes the operation
		Ft_Gpu_Hal_WaitCmdfifo_empty(phost);			
	}
Give it a shot.

You'll have to manipulate the code a little bit in order for the button to act as a toggle instead of a momentary push button, but I suggest you try this code out first. Once you are familiar with how the code runs, you can make a few modifications and have the button act as a toggle instead.

Cheers,
Daniel
Daniel Divino
Technical Support
Matrix Orbital

Andrew
LCD?
Posts: 4
Joined: Wed Jul 03, 2019 1:55 pm

Re: Updating Button Text And Colour

Post by Andrew » Mon Jul 08, 2019 10:45 am

Thanks, I will give it a try.

Andrew
LCD?
Posts: 4
Joined: Wed Jul 03, 2019 1:55 pm

Re: Updating Button Text And Colour

Post by Andrew » Mon Jul 08, 2019 10:49 am

The code does not work.

At this point, we will be dumping this
display.

Only one of the examples provided worked.
The support is dismal.

Your GTT solution sounds promising.


Thanks
Last edited by Andrew on Mon Jul 08, 2019 1:08 pm, edited 2 times in total.

Andrew
LCD?
Posts: 4
Joined: Wed Jul 03, 2019 1:55 pm

Re: Updating Button Text And Colour

Post by Andrew » Mon Jul 08, 2019 12:13 pm

Hi Daniel, thanks for your time today.

The GTT display with software sounds like what we
have been looking for.

Thanks again for your time.
Regards
Andrew

Daniel Divino
Matrix Orbital
Matrix Orbital
Posts: 247
Joined: Thu Sep 24, 2015 9:38 am

Re: Updating Button Text And Colour

Post by Daniel Divino » Mon Jul 08, 2019 4:00 pm

Hi Andrew,

I'm sorry to hear that your experience with our EVE was not optimal. Understandably, the FT812/813, though very capable, has quite a steep learning curve.

I'm glad to hear that you would be willing to try out our GTT. Our GTT will be much easier to develop for, and I'm confident you'll find the experience to be much easier to learn and work with than the EVE series. As always, if you have any questions about the GTT, please let us know!

Cheers,
Daniel
Daniel Divino
Technical Support
Matrix Orbital

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest