2025-01-08 07:47 AM - last edited on 2025-01-08 08:55 AM by SofLit
Hi,
I have been trying to implement the functionality to change the currently active screen on TouchGFX using a hardware button with no luck so far.
I'm using an STM32H743zit6.
Here are the resources I've looked at but haven't managed to get working:
https://www.youtube.com/watch?v=ufvJ5bcesL8
https://www.youtube.com/watch?v=QgEDSjvGAlk
https://support.touchgfx.com/docs/development/scenarios/example-gpio
https://support.touchgfx.com/docs/development/board-bring-up/how-to/10-physical-buttons
https://community.st.com/t5/stm32-mcus-touchgfx-and-gui/hardware-button/td-p/640357
Any help would be greatly appreciated,
Thanks.
2025-01-09 08:50 AM
Hi,
I have tried implementing as you said:
#include <gui/common/FrontendApplication.hpp>
Model::Model() : modelListener(0)
{
}
void Model::tick()
{
if (HAL_GPIO_ReadPin(GPIOD, GPIO_PIN_2) == GPIO_PIN_RESET)
{
static_cast<FrontendApplication*>(Application::getInstance())->handleKeyEvent('A');
}
}
But still have had no luck with it. Thanks for the suggestion though, I think that using handle key event to make it think I've pressed the 'A' key is a good way to do it. Just unsure why it hasn't worked in this case.
2025-01-09 08:52 AM
Hi,
Thanks for the response.
Is the MB1642ButtonController.cpp a file that you have created or one that is generated?
the reason I ask is that in my project I have ButtonController.hpp generated but don't have a file called ButtonController.cpp
Kind Regards,
Josh
2025-01-09 10:34 AM
Are you sure, you have on active screen created Interaction for handle A key , that start transition to next screen?
Next point is in debuger test if tick is realy executed and not blocked ...