Fix encoders.

This commit is contained in:
Anna Rose 2021-12-21 04:58:41 +00:00
parent 859e06a781
commit f576102af6

View File

@ -1,7 +1,7 @@
#include <Joystick.h> #include <Joystick.h>
#include <Matrix.h> #include <Matrix.h>
Joystick joystick(false); Joystick joystick(true);
// These defines match the board schematic // These defines match the board schematic
#define ENC1 2, 4 #define ENC1 2, 4
@ -41,12 +41,13 @@ Joystick joystick(false);
void setup() { void setup() {
// Encoders // Encoders
joystick.AddEncoder(ENC1, ENCODER_PULSED_SPLIT); joystick.AddEncoder(ENC1, 4, ENCODER_PULSED_SPLIT);
joystick.AddEncoder(ENC2, ENCODER_PULSED_SPLIT); joystick.AddEncoder(ENC2, 4, ENCODER_PULSED_SPLIT);
// We will add the 2-stage "key buttons" in a slightly odd order // We will add the 2-stage "key buttons" in a slightly odd order
// in order to keep columns together for faster scanning. // in order to keep columns together for faster scanning.
Matrix* matrix = new Matrix({C0, C1, C2, C3}, 4); uint8_t columns[] = {C0, C1, C2, C3};
Matrix* matrix = new Matrix(columns, 4);
// Flight modes // Flight modes
joystick.AddMatrixButton(BTN1, matrix, BUTTON_PASSTHRU); joystick.AddMatrixButton(BTN1, matrix, BUTTON_PASSTHRU);