diff --git a/source/Cockpit-Switch-Panel.ino b/source/Cockpit-Switch-Panel.ino new file mode 100644 index 0000000..66d98a2 --- /dev/null +++ b/source/Cockpit-Switch-Panel.ino @@ -0,0 +1,56 @@ +#include +#include + +#define BUTTONS 16 +#define FAUXBUTTONS 5 + +const long speedLimit = 10; + +unsigned long lastSend = 0; + +int buttonPins[BUTTONS] = { 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, A0, A1, A2, A3 }; +int analogButtonPin = A4; + +EasyTransfer ET; + +struct SEND_DATA_STRUCTURE{ + //THIS MUST BE EXACTLY THE SAME ON THE OTHER ARDUINO + int16_t joyx; + int16_t joyy; + int8_t joyz; + int16_t joyxr; + int16_t joyyr; + int8_t joyzr; + uint32_t buttonState; +}; + +SEND_DATA_STRUCTURE controllerState; + +void setup() { + Serial.begin(2000000); + ET.begin(details(controllerState), &Serial); + for (int i = 0; i < BUTTONS; i++) { pinMode(buttonPins[i], INPUT_PULLUP); } + pinMode(analogButtonPin, INPUT); +} + +uint32_t readButtons(){ + uint32_t buttonStateNow = 0; + for (int i=0; i speedLimit ) { + ET.sendData(); + lastSend = millis(); + } +} diff --git a/src b/src deleted file mode 160000 index 5507d20..0000000 --- a/src +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 5507d2003993a0c1101494baa118944116857478