Skip to content

Button Events

Lance A. Endres edited this page Jun 27, 2021 · 3 revisions

Introduction

The ButtonSuite breaks a button press sequence down into various events in the ButtonBase::update() function. Below is a guide to help visualize when each of these events occurs.

There are two main types of button presses, short presses and long presses. They are divided by the _longPressInterval member in ButtonBase. If a derived class wants to use long press functionality, they should expose a function to set the long press interval.

The following image is a legend for the other figures.

Button sequence legend.

Short Press Sequence

The following is the sequence of events detected during short presses of a button.

Short press button sequence.

Long Press Sequence

The following is the sequence of events detected during long presses of a button. Note that after a button is pressed down, there is an interval where ISSHORTPRESSED is returned. This is because it cannot be determined at this point that a long press is intended. Only once the long press interval has expired is ISLONGPRESSED returned.

Long press button sequence.

Clone this wiki locally