Skip to main content
EBond.1
Associate
February 22, 2021
Solved

How to work with buttons without touch panel?

  • February 22, 2021
  • 5 replies
  • 2252 views

Hi, I recently started learning TouchGFX. And faced with the need to use the graphics work with the screen without the Touch panel. Instead, there will be physical buttons. Is there an example of how to implement this?

Best answer by Alexandre RENOUX

Hello Ebond.1,

You can also have a look at the Application Template for G0-Nucleo available in TouchGFX Designer. There, you will find the implementation of external buttons with TouchGFX since the screen is not touchable. The file to look at is Core/Src/ MB1642ButtonController.cpp and TouchGFX/target/TouchGFXHAL.cpp.

Hope this will help,

/Alexandre

5 replies

Andrew Neil
Super User
February 22, 2021

Surely, in that case, your TouchGFX just becomes an output-only project - the buttons are entirely separate, and nothing to do with the graphics?

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
EBond.1
EBond.1Author
Associate
February 22, 2021

The buttons interact directly with the graphics. The buttons will be used to navigate through the menu of the graphical interface

Peter BENSCH
Technical Moderator
February 22, 2021

Yes, you will find e.g. the UI Template Pool Demo within TouchGFX.

Regards

/Peter

Romain DIELEMAN
ST Employee
February 22, 2021

Hi,

You can look at the backend communication article in the documentation. It will help you understand how to communicate between your UI and your physical buttons. There are also projects you can download and look at.

There is also a good video online made by Gustavo from ST which will help you do this. In his project he communicates both ways: from a physical button to the UI to make a box appear/disappear, and from the UI to turn a LED on/off.

/Romain

Alexandre RENOUX
Alexandre RENOUXBest answer
Visitor II
February 23, 2021

Hello Ebond.1,

You can also have a look at the Application Template for G0-Nucleo available in TouchGFX Designer. There, you will find the implementation of external buttons with TouchGFX since the screen is not touchable. The file to look at is Core/Src/ MB1642ButtonController.cpp and TouchGFX/target/TouchGFXHAL.cpp.

Hope this will help,

/Alexandre

AAlis.23
Associate III
March 1, 2025

I’m working with TouchGFX and I have the state of a physical key, GPIO button, available when MB1642ButtonController::sample is called (în my case the class has another name). What is the simplest way to interact with TouchGFX based on this key state?

Specifically, I want to know:

Do I have to handle everything through code by manually triggering events for widgets?

Is there any way to map a key press (e.g., key "1") to a TouchGFX button press, similar to how the touch interface works, directly from the GUI?


Thanks in advance for any help or suggestions!