summaryrefslogtreecommitdiff
path: root/gyroscope.hpp
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2021-11-23 09:24:48 +0100
committerHampusM <hampus@hampusmat.com>2021-11-23 09:24:48 +0100
commitc4d200330b71276abee2d2c18906991e0f4e5c13 (patch)
tree60872d2b703a266aa7eea64552d850c2dbfda5f0 /gyroscope.hpp
parent8cf0b19088eb832d3555137da388068adf205626 (diff)
add core files
Diffstat (limited to 'gyroscope.hpp')
-rw-r--r--gyroscope.hpp37
1 files changed, 37 insertions, 0 deletions
diff --git a/gyroscope.hpp b/gyroscope.hpp
new file mode 100644
index 0000000..627aa8c
--- /dev/null
+++ b/gyroscope.hpp
@@ -0,0 +1,37 @@
+#ifndef GYROSCOPE_H
+#define GYROSCOPE_H
+
+namespace Addresses
+{
+ const int ID_HIGH = 0b1101011;
+ const int ID_LOW = 0b1101010;
+ const int WHO_ID = 0xD7;
+}
+
+namespace RegisterAddresses
+{
+ const int WHO_AM_I = 0x0F;
+ const int LOW_ODR = 0x39;
+ const int CTRL4 = 0x23;
+ const int CTRL1 = 0x20;
+ const int OUT_X_L = 0x28;
+}
+
+class ReadGyroscopeData
+{
+public:
+ int16_t x, y, z;
+};
+
+class Gyroscope
+{
+public:
+ int gyroscope_id;
+ Gyroscope(int gyroscope_id);
+ ReadGyroscopeData read();
+ void writeRegistry(uint8_t registry, uint8_t value);
+ static int initialize();
+ static int testRegistry(int gyroscope_id, uint8_t registry);
+};
+
+#endif \ No newline at end of file