The code in the button.c driver seems strange.
There is not a break before the "default" case. So it looks like state Button_LONGPRESSING is always owerwriten with Button_PRESSED.
Also the obj->buttonStateVariables.state = Button_LONGPRESSING is used twice, but anyway it is owerwriten.
case Button_RELEASING:
case Button_RELEASING_LONG:
case Button_RELEASING_DBLPRESSED:
/*
* We're releasing, but isn't released after debounce.
* Start count down again if interest in long-press
*/
if(obj->buttonEventMask &
(Button_EV_LONGPRESSED | Button_EV_LONGCLICKED))
{
obj->buttonStateVariables.state = Button_LONGPRESSING;
ClockP_setTimeout(obj->clockHandle, obj->longPressDuration - obj->debounceDuration);
ClockP_start(obj->clockHandle);
obj->buttonStateVariables.state = Button_LONGPRESSING;
}
else
{
obj->buttonStateVariables.state = Button_PRESSED;
}
/*
* Any other case, mark the button as pressed.
* Typically we should not come here
*/
default:
obj->buttonStateVariables.state = Button_PRESSED;
break;