Add the ability to use a custom delay time for button presses.
This commit is contained in:
6
Button.h
6
Button.h
@ -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;
|
||||
|
Reference in New Issue
Block a user