Question
Adding Buzzer sound in Button (TouchGfx)
I am currently using the touch gfx button with its callback function to call PWM code to execute when I press the button on the GUI as shown below.
#include <main.h>
#include "cmsis_os.h"
extern TIM_HandleTypeDef htim4;
void MAINViewBase::buttonCallbackHandler(const touchgfx::AbstractButton& src)
{
if (&src== &button1)
{
TIM4->CCR2 = 50;
HAL_TIM_PWM_Start(&htim4, TIM_CHANNEL_2);
osDelay(50);
HAL_TIM_PWM_Stop(&htim4, TIM_CHANNEL_2);
//Interaction1
//When button1 clicked change screen to SETTINGS
//Go to SETTINGS with screen transition towards East
application().gotoSETTINGSScreenSlideTransitionEast();
}
}But I have to add this function manually every time I make any change in the GUI which is kind of repetitive to do, Is there any method of adding a custom Button function where I can write this code as default with the button?