The CPU is in a tight loop when it is detecting the trigger condition, it cannot exit this loop unless there is an interrupt./\r\n/To generate a long press, the program needs to detect the button (which does create an interrupt), and then check if the button is still pressed in the MAIN loop./\r\n/The long press cannot be detected when the trigger is set at NORMAL or SINGLE, since the device goes back to the trigger loop after pressing the button./\r\n//\r\n/This could be changed by:/\r\n/1) Using a 2 second interrupt from a timer, but this will disrupt the triggering after 2 seconds of pressing a button./\r\n/2) Checking the long press inside the triggering loop, but this will make the triggering less responsive, and make it miss quick trigger events./\r\n//\r\n/I decided to have a better triggering at the expense of not always detecting a long press.