-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathIMU.h
56 lines (53 loc) · 1.2 KB
/
IMU.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#pragma once
#include "Arduino.h"
#include "Wire.h"
#include "SPI.h"
// IMU driver interface
class IMUInterface {
public:
enum DLPF {
DLPF_OFF,
DLPF_MAX,
DLPF_100HZ_APPROX,
DLPF_50HZ_APPROX,
DLPF_5HZ_APPROX,
DLPF_MIN
};
enum AccelRange {
ACCEL_RANGE_MIN,
ACCEL_RANGE_2G,
ACCEL_RANGE_4G,
ACCEL_RANGE_8G,
ACCEL_RANGE_16G,
ACCEL_RANGE_MAX
};
enum GyroRange {
GYRO_RANGE_MIN,
GYRO_RANGE_250DPS,
GYRO_RANGE_500DPS,
GYRO_RANGE_1000DPS,
GYRO_RANGE_2000DPS,
GYRO_RANGE_MAX
};
enum Rate {
RATE_MIN,
RATE_50HZ_APPROX,
RATE_1KHZ_APPROX,
RATE_8KHZ_APPROX,
RATE_MAX
};
virtual bool begin() = 0;
virtual void reset() = 0;
virtual uint8_t whoAmI() = 0;
virtual bool read() = 0;
virtual void waitForData() = 0;
virtual void getAccel(float& x, float& y, float& z) const = 0;
virtual void getGyro(float& x, float& y, float& z) const = 0;
virtual void getMag(float& x, float& y, float& z) const = 0;
virtual float getTemp() const = 0;
virtual bool setRate(const Rate rate) = 0;
virtual bool setAccelRange(const AccelRange range) = 0;
virtual bool setGyroRange(const GyroRange range) = 0;
virtual bool setDLPF(const DLPF dlpf) = 0;
virtual const char* getModel() const = 0;
};