17 #define LSM6DS33_ADDR 0b1101011
18 #define LIS3MDL_ADDR 0b0011110
25 #define LSM6DS33_REG_WHO_AM_I 0x0F
26 #define LSM6DS33_REG_CTRL1_XL 0x10
27 #define LSM6DS33_REG_CTRL2_G 0x11
28 #define LSM6DS33_REG_CTRL3_C 0x12
29 #define LSM6DS33_REG_STATUS_REG 0x1E
30 #define LSM6DS33_REG_OUTX_L_G 0x22
31 #define LSM6DS33_REG_OUTX_L_XL 0x28
33 #define LIS3MDL_REG_WHO_AM_I 0x0F
34 #define LIS3MDL_REG_CTRL_REG1 0x20
35 #define LIS3MDL_REG_CTRL_REG2 0x21
36 #define LIS3MDL_REG_CTRL_REG3 0x22
37 #define LIS3MDL_REG_CTRL_REG4 0x23
38 #define LIS3MDL_REG_STATUS_REG 0x27
39 #define LIS3MDL_REG_OUT_X_L 0x28
120 void writeReg(uint8_t addr, uint8_t reg, uint8_t value);
128 uint8_t
readReg(uint8_t addr, uint8_t reg);
165 uint8_t lastError = 0;
168 int16_t testReg(uint8_t addr, uint8_t reg);
169 void readAxes16Bit(uint8_t addr, uint8_t firstReg, vector<int16_t> & v);
Interfaces with the inertial sensors on the 3pi+ 32U4.
void configureForFaceUphill()
Configures the sensors with settings optimized for the FaceUphill example program.
void readGyro()
Takes a reading from the gyro and makes the measurements available in g.
bool gyroDataReady()
Indicates whether the gyro has new measurement data ready.
bool accDataReady()
Indicates whether the accelerometer has new measurement data ready.
bool init()
Initializes the inertial sensors and detects their type.
IMUType getType()
Returns the type of the inertial sensors on the 3pi+ 32U4.
void writeReg(uint8_t addr, uint8_t reg, uint8_t value)
Writes an 8-bit sensor register.
vector< int16_t > m
Raw magnetometer readings.
uint8_t getLastError()
Returns 0 if the last I2C communication with the IMU was successful, or a non-zero status code if the...
void configureForCompassHeading()
Configures the sensors with settings optimized for determining a compass heading with the magnetomete...
void readAcc()
Takes a reading from the accelerometer and makes the measurements available in a.
void readMag()
Takes a reading from the magnetometer and makes the measurements available in m.
void enableDefault()
Enables all of the inertial sensors with a default configuration.
uint8_t readReg(uint8_t addr, uint8_t reg)
Reads an 8-bit sensor register.
vector< int16_t > a
Raw accelerometer readings.
vector< int16_t > g
Raw gyro readings.
void read()
Takes a reading from all three sensors (accelerometer, gyro, and magnetometer) and makes their measur...
void configureForTurnSensing()
Configures the sensors with settings optimized for turn sensing.
bool magDataReady()
Indicates whether the magnetometer has new measurement data ready.
Top-level namespace for the Pololu3piPlus32U4 library.
IMUType
The type of the inertial sensors.
@ Unknown
Unknown or unrecognized.
@ LSM6DS33_LIS3MDL
LSM6DS33 gyro + accelerometer, LIS3MDL magnetometer.
Represents a 3-dimensional vector with x, y, and z components.