summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2022-03-14 09:04:27 +0100
committerHampusM <hampus@hampusmat.com>2022-03-14 09:04:27 +0100
commit6b5754655f78a7f93b756ff902ce9fd80d9dc4ec (patch)
treebd7ec958358c81fbb25cb136ba792b0cdef953c9 /src
parentee076c66c99fbd7895459e80d679c374340a9ed2 (diff)
feat: add xinput
Diffstat (limited to 'src')
-rw-r--r--src/gyronardo.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/gyronardo.cpp b/src/gyronardo.cpp
index 1c75c80..7c01985 100644
--- a/src/gyronardo.cpp
+++ b/src/gyronardo.cpp
@@ -5,6 +5,7 @@
#include <Arduino.h>
#include <Wire.h>
+#include <XInput.h>
constexpr uint8_t SENSOR_ADDRESS = 0x68U;
constexpr uint32_t SENSOR_THROTTLE_TIME = 50U; // milliseconds
@@ -68,6 +69,8 @@ void setup()
<< "Gyro Z: " << sensor.gyro_cal_z << "\n";
sout << "Starting..." << endl;
+
+ XInput.begin();
}
void loop()
@@ -90,4 +93,8 @@ void loop()
}
sout << "Pitch: " << sensor.getPitch() << " Roll: " << sensor.getRoll() << endl;
+
+ XInput.setJoystick(JOY_LEFT, static_cast<int32_t>(sensor.getRoll()),
+ static_cast<int32_t>(sensor.getPitch()));
+ XInput.printDebug(Serial);
}