Add some logic to the encoder to only register a button press after a certain number of inputs.
This commit is contained in:
@ -53,12 +53,12 @@ void Joystick::AddMatrixButton(uint8_t row, uint8_t col, Matrix* matrix, ButtonT
|
||||
_addButton(type, new MatrixReader(row, col, matrix, pullup));
|
||||
}
|
||||
|
||||
void Joystick::AddEncoder(uint8_t pin1, uint8_t pin2, ButtonType type) {
|
||||
void Joystick::AddEncoder(uint8_t pin1, uint8_t pin2, int8_t tick_threshold, ButtonType type) {
|
||||
Button *button;
|
||||
switch (type) {
|
||||
case ENCODER_PULSED_SPLIT:
|
||||
// add an encoder button. _BuildButton() doesn't do everything we need, however...
|
||||
button = new EncoderButton(pin1, pin2, _virtual_buttons);
|
||||
button = new EncoderButton(pin1, pin2, _virtual_buttons, tick_threshold);
|
||||
_buttons[_num_buttons] = button;
|
||||
_num_buttons++;
|
||||
_virtual_buttons += 2;
|
||||
|
Reference in New Issue
Block a user