Calling different functions when a button is pressed or released (Partially Solved).
OK, it is probably a stupid question, but I'm no able to find a solution...
I need to call a function when a button is pressed, and a function when it is released.
I can handle pressed/released status by:
void Screen1View::handleClickEvent(const ClickEvent& event)
{
if((event.getType() == ClickEvent::PRESSED))
{
Instruction1();
HAL_Delay(50);
}
if((event.getType() == ClickEvent::RELEASED))
{
Instruction2();
HAL_Delay(50);
}
}but this is called every time I touch/release the screen and not the single button.
If I use flexButtonCallbackHandler(),
void Screen1ViewBase::flexButtonCallbackHandler(const touchgfx::AbstractButtonContainer& src)
{
if (&src == &Down_Button)
{
//Interaction1
//When Down_Button clicked call virtual function
//Call function1
Instruction1();
HAL_Delay(50);
}
}I can determine the button pressed, but I haven't a call when the button is released.
Any solution?
Thanks and best regards to all the community!
