Hi GertVc,
Nothing like that exists currently at the GPIO layer.
However, there is a "Button" interface in the pi4j-device project and a "GpioButtonComponent" implementation class that supports GPIO events and emits button PRESS and RELEASE events and additionally includes a button HOLD event.
Example:
Button button = new GpioButtonComponent(myInputPin);
button.addListener(1000, new ButtonHoldListener() {
@Override
public void onButtonHold(ButtonEvent event) {
// DO WORK HERE!
}
});
You might take a look at that and see if it meets your needs. You may need to extend or modify the impl to handle duration ranges for short vs long hold times for multiple hold events.
Thanks, Robert