12 #define LSM303D_ADDR 0b0011101
13 #define L3GD20H_ADDR 0b1101011
14 #define LSM6DS33_ADDR 0b1101011
15 #define LIS3MDL_ADDR 0b0011110
23 #define LSM303D_REG_STATUS_M 0x07
24 #define LSM303D_REG_OUT_X_L_M 0x08
25 #define LSM303D_REG_WHO_AM_I 0x0F
26 #define LSM303D_REG_CTRL1 0x20
27 #define LSM303D_REG_CTRL2 0x21
28 #define LSM303D_REG_CTRL5 0x24
29 #define LSM303D_REG_CTRL6 0x25
30 #define LSM303D_REG_CTRL7 0x26
31 #define LSM303D_REG_STATUS_A 0x27
32 #define LSM303D_REG_OUT_X_L_A 0x28
34 #define L3GD20H_REG_WHO_AM_I 0x0F
35 #define L3GD20H_REG_CTRL1 0x20
36 #define L3GD20H_REG_CTRL4 0x23
37 #define L3GD20H_REG_STATUS 0x27
38 #define L3GD20H_REG_OUT_X_L 0x28
40 #define LSM6DS33_REG_WHO_AM_I 0x0F
41 #define LSM6DS33_REG_CTRL1_XL 0x10
42 #define LSM6DS33_REG_CTRL2_G 0x11
43 #define LSM6DS33_REG_CTRL3_C 0x12
44 #define LSM6DS33_REG_STATUS_REG 0x1E
45 #define LSM6DS33_REG_OUTX_L_G 0x22
46 #define LSM6DS33_REG_OUTX_L_XL 0x28
48 #define LIS3MDL_REG_WHO_AM_I 0x0F
49 #define LIS3MDL_REG_CTRL_REG1 0x20
50 #define LIS3MDL_REG_CTRL_REG2 0x21
51 #define LIS3MDL_REG_CTRL_REG3 0x22
52 #define LIS3MDL_REG_CTRL_REG4 0x23
53 #define LIS3MDL_REG_STATUS_REG 0x27
54 #define LIS3MDL_REG_OUT_X_L 0x28
131 void writeReg(uint8_t addr, uint8_t reg, uint8_t value);
139 uint8_t
readReg(uint8_t addr, uint8_t reg);
178 uint8_t lastError = 0;
181 int16_t testReg(uint8_t addr, uint8_t reg);
182 void readAxes16Bit(uint8_t addr, uint8_t firstReg, vector<int16_t> & v);
Zumo32U4IMUType
The type of the inertial sensors.
Interfaces with the inertial sensors on the Zumo 32U4.
void readAcc()
Takes a reading from the accelerometer and makes the measurements available in a.
void readGyro()
Takes a reading from the gyro and makes the measurements available in g.
vector< int16_t > a
Raw accelerometer readings.
vector< int16_t > m
Raw magnetometer readings.
vector< int16_t > g
Raw gyro readings.
bool accDataReady()
Indicates whether the accelerometer has new measurement data ready.
void configureForBalancing()
Configures the sensors with settings optimized for balancing.
bool gyroDataReady()
Indicates whether the gyro has new measurement data ready.
void readMag()
Takes a reading from the magnetometer and makes the measurements available in m.
uint8_t readReg(uint8_t addr, uint8_t reg)
Reads an 8-bit sensor register.
Zumo32U4IMUType getType()
Returns the type of the inertial sensors on the Zumo 32U4.
void read()
Takes a reading from all three sensors (accelerometer, gyro, and magnetometer) and makes their measur...
void writeReg(uint8_t addr, uint8_t reg, uint8_t value)
Writes an 8-bit sensor register.
bool init()
Initializes the inertial sensors and detects their type.
void enableDefault()
Enables all of the inertial sensors with a default configuration.
uint8_t getLastError()
Returns 0 if the last I2C communication with the IMU was successful, or a non-zero status code if the...
void configureForTurnSensing()
Configures the sensors with settings optimized for turn sensing.
bool magDataReady()
Indicates whether the magnetometer has new measurement data ready.
void configureForFaceUphill()
Configures the sensors with settings optimized for the FaceUphill example program.
Represents a 3-dimensional vector with x, y, and z components.