hardware-projects/sc-panel/sc-panel.ino

53 lines
1.5 KiB
Arduino
Raw Normal View History

#include <Joystick.h>
#include <Mux.h>
using namespace admux;
Joystick joystick;
void setup() {
Mux* mux = new Mux(Pin(A4, INPUT_PULLUP, PinType::Digital), Pinset(A5, A6, A7));
// Power switches
joystick.AddButton(2, BUTTON_PULSED_DOUBLE_ACTION_SPLIT);
joystick.AddButton(3, BUTTON_PULSED_DOUBLE_ACTION_SPLIT);
joystick.AddButton(4, BUTTON_PULSED_DOUBLE_ACTION_SPLIT);
joystick.AddButton(5, BUTTON_PULSED_DOUBLE_ACTION_SPLIT);
// HUD modes
joystick.AddButton(6, BUTTON_PASSTHRU);
joystick.AddButton(7, BUTTON_PASSTHRU);
joystick.AddButton(8, BUTTON_PASSTHRU);
// Encoders
joystick.AddEncoder(9, 10, ENCODER_PULSED_SPLIT);
joystick.AddEncoder(11, 12, ENCODER_PULSED_SPLIT);
// Mining Modules
joystick.AddButton(13, BUTTON_PASSTHRU);
joystick.AddButton(A0, BUTTON_PASSTHRU);
joystick.AddButton(A1, BUTTON_PASSTHRU);
// Doors & Lights
joystick.AddButton(A2, BUTTON_PASSTHRU);
joystick.AddButton(A3, BUTTON_PASSTHRU);
joystick.AddButton(0, BUTTON_PASSTHRU, true, mux);
// Flight Modes
joystick.AddButton(1, BUTTON_PASSTHRU, true, mux);
joystick.AddButton(2, BUTTON_PASSTHRU, true, mux);
joystick.AddButton(3, BUTTON_PASSTHRU, true, mux);
joystick.AddButton(4, BUTTON_PASSTHRU, true, mux);
// Emergency Panel
joystick.AddButton(5, BUTTON_PASSTHRU, true, mux);
joystick.AddButton(6, BUTTON_PASSTHRU, true, mux);
joystick.AddButton(7, BUTTON_PASSTHRU, true, mux);
joystick.Init();
}
void loop() {
joystick.Update();
}