Initial commit - including a project file for the Star Citizen flight control panel.

This commit is contained in:
Anna Rose 2021-11-08 01:41:26 +00:00
commit 132dc5c462
3 changed files with 62 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
*.elf
*.hex

8
sc-panel/Makefile Normal file
View File

@ -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}

52
sc-panel/sc-panel.ino Normal file
View File

@ -0,0 +1,52 @@
#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();
}