cancel
Showing results for 
Search instead for 
Did you mean: 

Interfacing with hardware in TouchGFX Applications

Martin KJELDSEN
Chief III

Due to popular demand, here's the information we have on interfacing with peripherals on an STM32F769-DISCO board in a TouchGFX Application.

I have two resources for this:

  1. Video: I did a webinar last year on this topic where we create an application using v4.9.3 of the TouchGFX designer and interact with push buttons through a GUI + turn on an LED using a TouchGFX Button: https://www.youtube.com/watch?v=jQO7zhX0e0Q
  2. Article: https://support.touchgfx.com/docs/development/ui-development/touchgfx-engine-features/backend-communication/. Here are the direct links for the demos i did in TouchGFX 4.9.3 (should be upgradeable) using GPIO and EXTI approach: EXTI, GPIO.

Disclaimer: The examples in the article are not maintained throughout new versions of TouchGFX.

Feel free to comment if you have any issues. Thank you!

Best regards,

Martin

23 REPLIES 23
NMung.1
Associate II

Hello everyone, I've started developing a custom board based on stm32f767IGTX MCU with LDTC display (800*480), it's now two months since I've started. so far so good...I just want help on how to had more buttons via the buttoncontroller class and how to add them into the touchgfx application (touchgfx template). bellow you will find the class for buttoncontroller that handle the physical button too...but I am stuck on How to add more physical buttons. If you gotta time, your help will be great.

thank you....

class F767ButtonController : public touchgfx::ButtonController
{
	virtual void init() {  }
 
 
	/**
	* Implement all the hardware buttons handlers by the defining the port address and carrier name
	*/
	void delay(int d)
	{
		int i; 
	/**for loop counter for the timer, if your using crusial Real time application please implement
	 * find a better to implement this delay function for more accuraccy.
	 */
		for (i= 0; i < (d*10000); i++)
		{
			float a = 0.0f; // local variable a for the for custom time to monitor the tigger state
			a += (i / 0.1f);
		}
	}
 
 
	virtual bool debounce(bool last)
	{
		
		bool current = HAL_GPIO_ReadPin(GPIOC, GPIO_PIN_13); //Read the button state
		if (last != current) //if it's different…
		{
			delay(1000);
			current = HAL_GPIO_ReadPin(GPIOC, GPIO_PIN_13); //read it again
		}
		return current; //return the current value
	}
 
 
	virtual bool sample(uint8_t& key)
	{
 
		bool lastButton = false;
		bool currentButton = false;
 
		currentButton = debounce(lastButton); //read deboucned state
		if (lastButton == false && currentButton == true) //if it was pressed...
		{
			key = 1; //toggle the state of the button
 
			return true;
		}
 
		lastButton = currentButton; //reset button value
 
		return false;	
	}
 
private:
 
};

Hi,

I would recommend creating a new topic with maybe a link to this one. This question might otherwise be lost in the older comments.

/Romain

NMung.1
Associate II

Thank you very much Romain, I am really a "newbie"....do you mind to tell =) me how to create a new topic?

Go to https://community.st.com/s/topic/0TO0X0000003iw6WAA/touchgfx

and press the "Ask a question" button =) Also, maybe clarify what you mean by "adding more physical buttons". Do you mean in hardware or in software?

/Martin