• AVR Freaks

Hot!Button pressed event being called when button toggled off

Author
ryanjones
New Member
  • Total Posts : 2
  • Reward points : 0
  • Joined: 2019/01/07 13:51:21
  • Location: 0
  • Status: offline
2019/02/03 20:17:38 (permalink)
0

Button pressed event being called when button toggled off

General Background
Harmony Version: v2.06
MPLAB Version: 5.10
Chip: PIC32MZ2064DAG169

I've run into a bit of an issue in the project I'm working on.
I have some buttons which I've set to be toggleable and they work fine when toggling them on and off through the touchscreen.
But whenever I change the state of the button (usually through `button->state = LA_BUTTON_STATE_UP` or `DOWN`) it seems to reset which event should get called.
E.g. If I don't change the state of the button elsewhere and I toggle the button on and then off, I get a button pressed event followed by a button released event.
But if I toggle the button on, and then update the state of the button elsewhere in the code (usually it's the same state, it's just being confirmed) and go to toggle the button off with the touchscreen I'll get another button pressed event, and will have to press it again to get the button released event.

Is there some function I should be calling to change the state without calling the update events rather than just setting the state on the struct itself.

Thanks
#1

1 Reply Related Threads

    Ed@Microchip
    Super Member
    • Total Posts : 134
    • Reward points : 0
    • Joined: 2017/04/06 09:39:29
    • Location: 0
    • Status: offline
    Re: Button pressed event being called when button toggled off 2019/02/04 09:01:48 (permalink)
    0
    To change the pressed state of a button, use the widget API:

    laResult laButtonWidget_SetPressed(laButtonWidget* btn, laBool pressed);
    #2
    Jump to:
    © 2019 APG vNext Commercial Version 4.5