blob: e3629942e8801e1f04ac89396e00f2d20312a6ca (
plain)
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
|
#ifndef MPU9250_H
#define MPU9250_H
class MPU9250 {
private:
MPU9250(const MPU9250 ©);
unsigned char const address = 0x68;
unsigned char txbuf[3];
unsigned char rxbuf[8];
signed int getWordReg(unsigned char const regBase);
public:
MPU9250() {}
void init();
int getAccelX() { return getWordReg(59); }
int getAccelY() { return getWordReg(61); }
int getAccelZ() { return getWordReg(63); }
int getGyroX() { return getWordReg(67); }
int getGyroY() { return getWordReg(69); }
int getGyroZ() { return getWordReg(71); }
void getMagnet(int *x, int *y, int *z);
void setAccelEnable(bool x, bool y, bool z);
void setGyroEnable(bool x, bool y, bool z);
void setPower(bool sleep, bool gyroStandby);
float getTemperature();
};
extern MPU9250 mpu9250;
#endif
|