Skip to main content
Jazman
Associate III
January 29, 2024
Question

Upgrading TouchGFX engine and external buttons

  • January 29, 2024
  • 1 reply
  • 1227 views

This is an outstanding issue that's been there for a while but since it just got me again, I'm finally taking the time to post about it.  When using external buttons and the button controller, the implementation instructions have you edit the ToughGFXConfiguration.cpp file to add the custom button controller instance and pass that instance in the touchgfx_init() function.  That whole file is flagged as
* This file is generated by TouchGFX Generator x.x.x. Please, do not edit!

But, you need to edit it to use the button controller.  So, when you do the upgrade of the TouchGFX engine in CubeIDE, this file must get re-generated since it overwrites my edits which then I have to rely on memory to go fix.

It would be great if we could add USER CODE BEGIN and USE CODE END sections that Cube uses elsewhere.  Or implement virtual or weak functions we can override so this can be implemented without editing a generated file.

Thanks,

Keith

This topic has been closed for replies.

1 reply

ST Employee
February 6, 2024

Hello @Jazman ,

I totally understand the difficulty, but I think you can add a button controller without changing TouchGFXConfiguration. There are a number of examples that indicate how to work with external buttons. You can find them under Demos -> Board Specific Demo tab.
Board Specific DemosBoard Specific Demos

You can just use one of them as inspiration for your development, especially STM32F769I-DISCO External Interrupt Line Demo can be a great help.
You can have your code for the Button, and then add them to TouchGFX from TouchGFXHAL.cpp, initialize() instead of TouchGFXConfiguration (By using setButtonController function). 

 

I hope this helps you

Jazman
JazmanAuthor
Associate III
February 9, 2024

I will take a look at that.  However, the documentation on the website clearly tells you to implement it in a completely different way (editing generated files)...  See "Other External Events" about halfway down...
https://support.touchgfx.com/docs/development/touchgfx-hal-development/touchgfx-architecture#report-touch-and-physical-button-events

ST Employee
February 9, 2024

Oh I see the problem. 
Yes, I am very sorry for the confusion that has been made here. We will update the documentation as soon as possible to reflect the correct method.
And, thanks a lot for pointing this out

 

Best regards,