Update for 0.1 version of panel - half the buttons don't work yet.

This commit is contained in:
Anna Rose 2021-11-13 05:54:46 +00:00
parent 132dc5c462
commit 1ba01f7d4e
2 changed files with 13 additions and 21 deletions

View File

@ -1,5 +1,5 @@
TARGET_BOARD=arduino:avr:nano TARGET_BOARD=arduino:avr:nano:cpu=atmega328old
COM_PORT=/dev/ttyACM0 COM_PORT=/dev/ttyUSB0
build: build:
arduino-cli compile -b ${TARGET_BOARD} arduino-cli compile -b ${TARGET_BOARD}

View File

@ -1,13 +1,8 @@
#include <Joystick.h> #include <Joystick.h>
#include <Mux.h>
using namespace admux; Joystick joystick(false);
Joystick joystick;
void setup() { void setup() {
Mux* mux = new Mux(Pin(A4, INPUT_PULLUP, PinType::Digital), Pinset(A5, A6, A7));
// Power switches // Power switches
joystick.AddButton(2, BUTTON_PULSED_DOUBLE_ACTION_SPLIT); joystick.AddButton(2, BUTTON_PULSED_DOUBLE_ACTION_SPLIT);
joystick.AddButton(3, BUTTON_PULSED_DOUBLE_ACTION_SPLIT); joystick.AddButton(3, BUTTON_PULSED_DOUBLE_ACTION_SPLIT);
@ -20,29 +15,26 @@ void setup() {
joystick.AddButton(8, BUTTON_PASSTHRU); joystick.AddButton(8, BUTTON_PASSTHRU);
// Encoders // Encoders
joystick.AddEncoder(9, 10, ENCODER_PULSED_SPLIT); // FIXME: these seem to be wired wrong.
joystick.AddEncoder(11, 12, ENCODER_PULSED_SPLIT); // joystick.AddEncoder(10, 11, ENCODER_PULSED_SPLIT);
// joystick.AddEncoder(12, 13, ENCODER_PULSED_SPLIT);
// Mining Modules // Mining Modules
joystick.AddButton(13, BUTTON_PASSTHRU); joystick.AddButton(9, BUTTON_PASSTHRU);
joystick.AddButton(A0, BUTTON_PASSTHRU); joystick.AddButton(A0, BUTTON_PASSTHRU);
joystick.AddButton(A1, BUTTON_PASSTHRU); joystick.AddButton(A1, BUTTON_PASSTHRU);
// Doors & Lights // Flight Modes
joystick.AddButton(A2, BUTTON_PASSTHRU); joystick.AddButton(A2, BUTTON_PASSTHRU);
joystick.AddButton(A3, BUTTON_PASSTHRU); joystick.AddButton(A3, BUTTON_PASSTHRU);
joystick.AddButton(0, BUTTON_PASSTHRU, true, mux); joystick.AddButton(A4, BUTTON_PASSTHRU);
joystick.AddButton(A5, BUTTON_PASSTHRU);
// Flight Modes // Doors & Lights
joystick.AddButton(1, BUTTON_PASSTHRU, true, mux); // TODO: Need multiplexer setup
joystick.AddButton(2, BUTTON_PASSTHRU, true, mux);
joystick.AddButton(3, BUTTON_PASSTHRU, true, mux);
joystick.AddButton(4, BUTTON_PASSTHRU, true, mux);
// Emergency Panel // Emergency Panel
joystick.AddButton(5, BUTTON_PASSTHRU, true, mux); // TODO: Need multiplexer setup
joystick.AddButton(6, BUTTON_PASSTHRU, true, mux);
joystick.AddButton(7, BUTTON_PASSTHRU, true, mux);
joystick.Init(); joystick.Init();
} }