17 #ifndef _ADAFRUIT_MPU6050_H 18 #define _ADAFRUIT_MPU6050_H 21 #include <Adafruit_BusIO_Register.h> 22 #include <Adafruit_I2CDevice.h> 23 #include <Adafruit_Sensor.h> 26 #define MPU6050_I2CADDR_DEFAULT \ 28 #define MPU6050_DEVICE_ID 0x68 30 #define MPU6050_SELF_TEST_X \ 32 #define MPU6050_SELF_TEST_Y \ 34 #define MPU6050_SELF_TEST_Z \ 36 #define MPU6050_SELF_TEST_A \ 38 #define MPU6050_SMPLRT_DIV 0x19 39 #define MPU6050_CONFIG 0x1A 40 #define MPU6050_GYRO_CONFIG 0x1B 41 #define MPU6050_ACCEL_CONFIG \ 43 #define MPU6050_INT_PIN_CONFIG 0x37 44 #define MPU6050_INT_ENABLE 0x38 45 #define MPU6050_INT_STATUS 0x3A 46 #define MPU6050_WHO_AM_I 0x75 47 #define MPU6050_SIGNAL_PATH_RESET 0x68 48 #define MPU6050_USER_CTRL 0x6A 49 #define MPU6050_PWR_MGMT_1 0x6B 50 #define MPU6050_PWR_MGMT_2 0x6C 51 #define MPU6050_TEMP_H 0x41 52 #define MPU6050_TEMP_L 0x42 53 #define MPU6050_ACCEL_OUT 0x3B 54 #define MPU6050_MOT_THR 0x1F 55 #define MPU6050_MOT_DUR \ 64 MPU6050_FSYNC_OUT_DISABLED,
65 MPU6050_FSYNC_OUT_TEMP,
66 MPU6050_FSYNC_OUT_GYROX,
67 MPU6050_FSYNC_OUT_GYROY,
68 MPU6050_FSYNC_OUT_GYROZ,
69 MPU6050_FSYNC_OUT_ACCELX,
70 MPU6050_FSYNC_OUT_ACCELY,
71 MPU6050_FSYNC_OUT_ACCEL_Z,
85 MPU6050_PLL_EXT_19MHz,
134 MPU6050_HIGHPASS_DISABLE,
135 MPU6050_HIGHPASS_5_HZ,
136 MPU6050_HIGHPASS_2_5_HZ,
137 MPU6050_HIGHPASS_1_25_HZ,
138 MPU6050_HIGHPASS_0_63_HZ,
139 MPU6050_HIGHPASS_UNUSED,
140 MPU6050_HIGHPASS_HOLD,
167 int _sensorID = 0x650;
178 _theMPU6050 = parent;
184 int _sensorID = 0x651;
198 int _sensorID = 0x652;
212 int32_t sensorID = 0);
215 bool getEvent(sensors_event_t *accel, sensors_event_t *gyro,
216 sensors_event_t *temp);
224 void setInterruptPinPolarity(
bool active_low);
225 void setInterruptPinLatch(
bool held);
231 void setMotionInterrupt(
bool active);
232 void setMotionDetectionThreshold(uint8_t thr);
233 void setMotionDetectionDuration(uint8_t dur);
234 bool getMotionInterruptStatus(
void);
237 void setI2CBypass(
bool bypass);
245 void setSampleRateDivisor(uint8_t);
246 uint8_t getSampleRateDivisor(
void);
248 bool enableSleep(
bool enable);
249 bool enableCycle(
bool enable);
254 bool setGyroStandby(
bool xAxisStandby,
bool yAxisStandby,
bool zAxisStandby);
255 bool setAccelerometerStandby(
bool xAxisStandby,
bool yAxisStandby,
257 bool setTemperatureStandby(
bool enable);
261 Adafruit_Sensor *getTemperatureSensor(
void);
262 Adafruit_Sensor *getAccelerometerSensor(
void);
263 Adafruit_Sensor *getGyroSensor(
void);
266 void _getRawSensorData(
void);
267 void _scaleSensorData(
void);
278 Adafruit_I2CDevice *i2c_dev = NULL;
285 uint16_t _sensorid_accel,
290 virtual bool _init(int32_t sensor_id);
301 int16_t rawAccX, rawAccY, rawAccZ, rawTemp, rawGyroX, rawGyroY, rawGyroZ;
303 void fillTempEvent(sensors_event_t *temp, uint32_t timestamp);
304 void fillAccelEvent(sensors_event_t *accel, uint32_t timestamp);
305 void fillGyroEvent(sensors_event_t *gyro, uint32_t timestamp);
Adafruit_MPU6050_Temp(Adafruit_MPU6050 *parent)
Create an Adafruit_Sensor compatible object for the temp sensor.
Definition: Adafruit_MPU6050.h:162
enum clock_select mpu6050_clock_select_t
Clock source options.
mpu6050_cycle_rate_t
Periodic measurement options.
Definition: Adafruit_MPU6050.h:148
+/- 16g
Definition: Adafruit_MPU6050.h:98
Definition: Adafruit_MPU6050.h:189
+/- 250 deg/s (default value)
Definition: Adafruit_MPU6050.h:107
fsync_out
FSYNC output values.
Definition: Adafruit_MPU6050.h:63
+/- 2000 deg/s
Definition: Adafruit_MPU6050.h:110
mpu6050_highpass_t
Accelerometer high pass filter options.
Definition: Adafruit_MPU6050.h:133
bool getEvent(sensors_event_t *)
Gets the temperature as a standard sensor event.
Definition: Adafruit_MPU6050.cpp:875
Class that stores state and functions for interacting with the MPU6050 I2C Digital Potentiometer...
Definition: Adafruit_MPU6050.h:206
5 Hz
Definition: Adafruit_MPU6050.h:125
20 Hz
Definition: Adafruit_MPU6050.h:151
uint16_t _sensorid_temp
ID number for temperature.
Definition: Adafruit_MPU6050.h:285
Docs imply this disables the filter.
Definition: Adafruit_MPU6050.h:119
184 Hz
Definition: Adafruit_MPU6050.h:120
enum fsync_out mpu6050_fsync_out_t
FSYNC output values.
Adafruit_MPU6050_Gyro(Adafruit_MPU6050 *parent)
Create an Adafruit_Sensor compatible object for the gyro sensor.
Definition: Adafruit_MPU6050.h:193
Adafruit_MPU6050_Accelerometer(Adafruit_MPU6050 *parent)
Create an Adafruit_Sensor compatible object for the accelerometer sensor.
Definition: Adafruit_MPU6050.h:177
Definition: Adafruit_MPU6050.h:172
40 Hz
Definition: Adafruit_MPU6050.h:152
+/- 2g (default value)
Definition: Adafruit_MPU6050.h:95
10 Hz
Definition: Adafruit_MPU6050.h:124
Definition: Adafruit_MPU6050.h:158
+/- 1000 deg/s
Definition: Adafruit_MPU6050.h:109
float temperature
Last reading's temperature (C)
Definition: Adafruit_MPU6050.h:270
mpu6050_bandwidth_t
Digital low pass filter bandthwidth options.
Definition: Adafruit_MPU6050.h:118
void getSensor(sensor_t *)
Gets the sensor_t data for the MPU6050's tenperature.
Definition: Adafruit_MPU6050.cpp:852
#define MPU6050_I2CADDR_DEFAULT
MPU6050 default i2c address w/ AD0 high.
Definition: Adafruit_MPU6050.h:26
mpu6050_gyro_range_t
Gyroscope range options.
Definition: Adafruit_MPU6050.h:106
44 Hz
Definition: Adafruit_MPU6050.h:122
mpu6050_accel_range_t
Accelerometer range options.
Definition: Adafruit_MPU6050.h:94
+/- 4g
Definition: Adafruit_MPU6050.h:96
94 Hz
Definition: Adafruit_MPU6050.h:121
clock_select
Clock source options.
Definition: Adafruit_MPU6050.h:79
5 Hz
Definition: Adafruit_MPU6050.h:150
1.25 Hz
Definition: Adafruit_MPU6050.h:149
+/- 8g
Definition: Adafruit_MPU6050.h:97
21 Hz
Definition: Adafruit_MPU6050.h:123
+/- 500 deg/s
Definition: Adafruit_MPU6050.h:108