commit 132dc5c462238ccbcc51f2717e0236712b26713b Author: Anna Wiggins Date: Mon Nov 8 01:41:26 2021 +0000 Initial commit - including a project file for the Star Citizen flight control panel. diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d6c2e45 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +*.elf +*.hex diff --git a/sc-panel/Makefile b/sc-panel/Makefile new file mode 100644 index 0000000..a0ab417 --- /dev/null +++ b/sc-panel/Makefile @@ -0,0 +1,8 @@ +TARGET_BOARD=arduino:avr:nano +COM_PORT=/dev/ttyACM0 + +build: + arduino-cli compile -b ${TARGET_BOARD} + +upload: + arduino-cli upload -b ${TARGET_BOARD} -p ${COM_PORT} diff --git a/sc-panel/sc-panel.ino b/sc-panel/sc-panel.ino new file mode 100644 index 0000000..a6409dd --- /dev/null +++ b/sc-panel/sc-panel.ino @@ -0,0 +1,52 @@ +#include +#include + +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(); +}