diff options
Diffstat (limited to 'gyroscope.hpp')
-rw-r--r-- | gyroscope.hpp | 37 |
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 |