Add the ability to use a custom delay time for button presses.

This commit is contained in:
2021-12-22 22:07:57 +00:00
parent 70d7bdd3b2
commit aef35f96a0
5 changed files with 23 additions and 17 deletions

View File

@ -50,12 +50,13 @@ class LatchedButton : public Button {
class PulsedButton : public Button {
public:
PulsedButton(uint8_t vbutton, Reader* reader, bool double_action = false, bool split = false);
PulsedButton(uint8_t vbutton, Reader* reader, uint8_t release_delay, bool double_action = false, bool split = false);
bool Update(Joystick* js);
protected:
bool double_action;
bool split;
uint8_t release_delay;
unsigned long release_time1;
unsigned long release_time2;
uint8_t vbutton2;
@ -63,13 +64,14 @@ class PulsedButton : public Button {
class EncoderButton : public Button {
public:
EncoderButton(uint8_t pin1, uint8_t pin2, uint8_t vbutton, int8_t tick_threshold);
EncoderButton(uint8_t pin1, uint8_t pin2, uint8_t vbutton, int8_t tick_threshold, uint8_t release_delay);
bool Update(Joystick* js);
protected:
Encoder* encoder;
long last_value;
uint8_t vbutton2;
uint8_t release_delay;
unsigned long release_time1;
unsigned long release_time2;
int8_t ticks;