#include <MPU6050.h>

Classes

struct  Motion3
 
struct  Motion6
 

Public Types

using SlaveId = uint8_t
 

Public Member Functions

 MPU6050 ()
 
 MPU6050 (uint8_t address)
 
void initialize ()
 
bool testConnection ()
 
uint8_t getAuxVDDIOLevel ()
 
void setAuxVDDIOLevel (uint8_t level)
 
uint8_t getRate ()
 
void setRate (uint8_t rate)
 
uint8_t getExternalFrameSync ()
 
void setExternalFrameSync (uint8_t sync)
 
uint8_t getDLPFMode ()
 
void setDLPFMode (uint8_t mode)
 
uint8_t getFullScaleGyroRange ()
 
void setFullScaleGyroRange (uint8_t range)
 
uint8_t getAccelXSelfTestFactoryTrim ()
 
uint8_t getAccelYSelfTestFactoryTrim ()
 
uint8_t getAccelZSelfTestFactoryTrim ()
 
uint8_t getGyroXSelfTestFactoryTrim ()
 
uint8_t getGyroYSelfTestFactoryTrim ()
 
uint8_t getGyroZSelfTestFactoryTrim ()
 
bool getAccelXSelfTest ()
 
void setAccelXSelfTest (bool enabled)
 
bool getAccelYSelfTest ()
 
void setAccelYSelfTest (bool enabled)
 
bool getAccelZSelfTest ()
 
void setAccelZSelfTest (bool enabled)
 
uint8_t getFullScaleAccelRange ()
 
void setFullScaleAccelRange (uint8_t range)
 
uint8_t getDHPFMode ()
 
void setDHPFMode (uint8_t bandwidth)
 
uint8_t getFreefallDetectionThreshold ()
 
void setFreefallDetectionThreshold (uint8_t threshold)
 
uint8_t getFreefallDetectionDuration ()
 
void setFreefallDetectionDuration (uint8_t duration)
 
uint8_t getMotionDetectionThreshold ()
 
void setMotionDetectionThreshold (uint8_t threshold)
 
uint8_t getMotionDetectionDuration ()
 
void setMotionDetectionDuration (uint8_t duration)
 
uint8_t getZeroMotionDetectionThreshold ()
 
void setZeroMotionDetectionThreshold (uint8_t threshold)
 
uint8_t getZeroMotionDetectionDuration ()
 
void setZeroMotionDetectionDuration (uint8_t duration)
 
bool getTempFIFOEnabled ()
 
void setTempFIFOEnabled (bool enabled)
 
bool getXGyroFIFOEnabled ()
 
void setXGyroFIFOEnabled (bool enabled)
 
bool getYGyroFIFOEnabled ()
 
void setYGyroFIFOEnabled (bool enabled)
 
bool getZGyroFIFOEnabled ()
 
void setZGyroFIFOEnabled (bool enabled)
 
bool getAccelFIFOEnabled ()
 
void setAccelFIFOEnabled (bool enabled)
 
bool getSlave2FIFOEnabled ()
 
void setSlave2FIFOEnabled (bool enabled)
 
bool getSlave1FIFOEnabled ()
 
void setSlave1FIFOEnabled (bool enabled)
 
bool getSlave0FIFOEnabled ()
 
void setSlave0FIFOEnabled (bool enabled)
 
bool getMultiMasterEnabled ()
 
void setMultiMasterEnabled (bool enabled)
 
bool getWaitForExternalSensorEnabled ()
 
void setWaitForExternalSensorEnabled (bool enabled)
 
bool getSlave3FIFOEnabled ()
 
void setSlave3FIFOEnabled (bool enabled)
 
bool getSlaveReadWriteTransitionEnabled ()
 
void setSlaveReadWriteTransitionEnabled (bool enabled)
 
uint8_t getMasterClockSpeed ()
 
void setMasterClockSpeed (uint8_t speed)
 
uint8_t getSlaveAddress (SlaveId slaveId)
 
void setSlaveAddress (SlaveId slaveId, uint8_t address)
 
uint8_t getSlaveRegister (SlaveId slaveId)
 
void setSlaveRegister (SlaveId slaveId, uint8_t reg)
 
bool getSlaveEnabled (SlaveId slaveId)
 
void setSlaveEnabled (SlaveId slaveId, bool enabled)
 
bool getSlaveWordByteSwap (SlaveId slaveId)
 
void setSlaveWordByteSwap (SlaveId slaveId, bool enabled)
 
bool getSlaveWriteMode (SlaveId slaveId)
 
void setSlaveWriteMode (SlaveId slaveId, bool mode)
 
bool getSlaveWordGroupOffset (SlaveId slaveId)
 
void setSlaveWordGroupOffset (SlaveId slaveId, bool enabled)
 
uint8_t getSlaveDataLength (SlaveId slaveId)
 
void setSlaveDataLength (SlaveId slaveId, uint8_t length)
 
uint8_t getSlave4Address ()
 
void setSlave4Address (uint8_t address)
 
uint8_t getSlave4Register ()
 
void setSlave4Register (uint8_t reg)
 
void setSlave4OutputByte (uint8_t data)
 
bool getSlave4Enabled ()
 
void setSlave4Enabled (bool enabled)
 
bool getSlave4InterruptEnabled ()
 
void setSlave4InterruptEnabled (bool enabled)
 
bool getSlave4WriteMode ()
 
void setSlave4WriteMode (bool mode)
 
uint8_t getSlave4MasterDelay ()
 
void setSlave4MasterDelay (uint8_t delay)
 
uint8_t getSlate4InputByte ()
 
bool getPassthroughStatus ()
 
bool getSlave4IsDone ()
 
bool getLostArbitration ()
 
bool getSlave4Nack ()
 
bool getSlave3Nack ()
 
bool getSlave2Nack ()
 
bool getSlave1Nack ()
 
bool getSlave0Nack ()
 
bool getInterruptMode ()
 
void setInterruptMode (bool mode)
 
bool getInterruptDrive ()
 
void setInterruptDrive (bool drive)
 
bool getInterruptLatch ()
 
void setInterruptLatch (bool latch)
 
bool getInterruptLatchClear ()
 
void setInterruptLatchClear (bool clear)
 
bool getFSyncInterruptLevel ()
 
void setFSyncInterruptLevel (bool level)
 
bool getFSyncInterruptEnabled ()
 
void setFSyncInterruptEnabled (bool enabled)
 
bool getI2CBypassEnabled ()
 
void setI2CBypassEnabled (bool enabled)
 
bool getClockOutputEnabled ()
 
void setClockOutputEnabled (bool enabled)
 
uint8_t getIntEnabled ()
 
void setIntEnabled (uint8_t enabled)
 
bool getIntFreefallEnabled ()
 
void setIntFreefallEnabled (bool enabled)
 
bool getIntMotionEnabled ()
 
void setIntMotionEnabled (bool enabled)
 
bool getIntZeroMotionEnabled ()
 
void setIntZeroMotionEnabled (bool enabled)
 
bool getIntFIFOBufferOverflowEnabled ()
 
void setIntFIFOBufferOverflowEnabled (bool enabled)
 
bool getIntI2CMasterEnabled ()
 
void setIntI2CMasterEnabled (bool enabled)
 
bool getIntDataReadyEnabled ()
 
void setIntDataReadyEnabled (bool enabled)
 
uint8_t getIntStatus ()
 
bool getIntFreefallStatus ()
 
bool getIntMotionStatus ()
 
bool getIntZeroMotionStatus ()
 
bool getIntFIFOBufferOverflowStatus ()
 
bool getIntI2CMasterStatus ()
 
bool getIntDataReadyStatus ()
 
Motion6 getMotion6 ()
 
Motion3 getAcceleration ()
 
int16_t getAccelerationX ()
 
int16_t getAccelerationY ()
 
int16_t getAccelerationZ ()
 
int16_t getTemperature ()
 
Motion3 getAngularRate ()
 
int16_t getAngularRateX ()
 
int16_t getAngularRateY ()
 
int16_t getAngularRateZ ()
 
int16_t getAngularRateZ2 ()
 
uint8_t getExternalSensorByte (int position)
 
uint16_t getExternalSensorWord (int position)
 
uint32_t getExternalSensorDWord (int position)
 
uint8_t getMotionStatus ()
 
bool getXNegMotionDetected ()
 
bool getXPosMotionDetected ()
 
bool getYNegMotionDetected ()
 
bool getYPosMotionDetected ()
 
bool getZNegMotionDetected ()
 
bool getZPosMotionDetected ()
 
bool getZeroMotionDetected ()
 
void setSlaveOutputByte (SlaveId slaveId, uint8_t data)
 
bool getExternalShadowDelayEnabled ()
 
void setExternalShadowDelayEnabled (bool enabled)
 
bool getSlaveDelayEnabled (SlaveId slaveId)
 
void setSlaveDelayEnabled (SlaveId slaveId, bool enabled)
 
void resetGyroscopePath ()
 
void resetAccelerometerPath ()
 
void resetTemperaturePath ()
 
uint8_t getAccelerometerPowerOnDelay ()
 
void setAccelerometerPowerOnDelay (uint8_t delay)
 
uint8_t getFreefallDetectionCounterDecrement ()
 
void setFreefallDetectionCounterDecrement (uint8_t decrement)
 
uint8_t getMotionDetectionCounterDecrement ()
 
void setMotionDetectionCounterDecrement (uint8_t decrement)
 
bool getFIFOEnabled ()
 
void setFIFOEnabled (bool enabled)
 
bool getI2CMasterModeEnabled ()
 
void setI2CMasterModeEnabled (bool enabled)
 
void switchSPIEnabled (bool enabled)
 
void resetFIFO ()
 
void resetI2CMaster ()
 
void resetSensors ()
 
void reset ()
 
bool getSleepEnabled ()
 
void setSleepEnabled (bool enabled)
 
bool getWakeCycleEnabled ()
 
void setWakeCycleEnabled (bool enabled)
 
bool getTempSensorEnabled ()
 
void setTempSensorEnabled (bool enabled)
 
uint8_t getClockSource ()
 
void setClockSource (uint8_t source)
 
uint8_t getWakeFrequency ()
 
void setWakeFrequency (uint8_t frequency)
 
bool getStandbyXAccelEnabled ()
 
void setStandbyXAccelEnabled (bool enabled)
 
bool getStandbyYAccelEnabled ()
 
void setStandbyYAccelEnabled (bool enabled)
 
bool getStandbyZAccelEnabled ()
 
void setStandbyZAccelEnabled (bool enabled)
 
bool getStandbyXGyroEnabled ()
 
void setStandbyXGyroEnabled (bool enabled)
 
bool getStandbyYGyroEnabled ()
 
void setStandbyYGyroEnabled (bool enabled)
 
bool getStandbyZGyroEnabled ()
 
void setStandbyZGyroEnabled (bool enabled)
 
uint16_t getFIFOCount ()
 
uint8_t getFIFOByte ()
 
void setFIFOByte (uint8_t data)
 
void getFIFOBytes (uint8_t *data, uint8_t length)
 
uint8_t getDeviceID ()
 
void setDeviceID (uint8_t id)
 
uint8_t getOTPBankValid ()
 
void setOTPBankValid (bool enabled)
 
int8_t getXGyroOffsetTC ()
 
void setXGyroOffsetTC (int8_t offset)
 
int8_t getYGyroOffsetTC ()
 
void setYGyroOffsetTC (int8_t offset)
 
int8_t getZGyroOffsetTC ()
 
void setZGyroOffsetTC (int8_t offset)
 
int8_t getXFineGain ()
 
void setXFineGain (int8_t gain)
 
int8_t getYFineGain ()
 
void setYFineGain (int8_t gain)
 
int8_t getZFineGain ()
 
void setZFineGain (int8_t gain)
 
int16_t getXAccelOffset ()
 
void setXAccelOffset (int16_t offset)
 
int16_t getYAccelOffset ()
 
void setYAccelOffset (int16_t offset)
 
int16_t getZAccelOffset ()
 
void setZAccelOffset (int16_t offset)
 
int16_t getXGyroOffset ()
 
void setXGyroOffset (int16_t offset)
 
int16_t getYGyroOffset ()
 
void setYGyroOffset (int16_t offset)
 
int16_t getZGyroOffset ()
 
void setZGyroOffset (int16_t offset)
 
bool getIntPLLReadyEnabled ()
 
void setIntPLLReadyEnabled (bool enabled)
 
bool getIntDMPEnabled ()
 
void setIntDMPEnabled (bool enabled)
 
bool getDMPInt5Status ()
 
bool getDMPInt4Status ()
 
bool getDMPInt3Status ()
 
bool getDMPInt2Status ()
 
bool getDMPInt1Status ()
 
bool getDMPInt0Status ()
 
bool getIntPLLReadyStatus ()
 
bool getIntDMPStatus ()
 
bool getDMPEnabled ()
 
void setDMPEnabled (bool enabled)
 
void resetDMP ()
 
void setMemoryBank (uint8_t bank, bool prefetchEnabled=false, bool userBank=false)
 
void setMemoryStartAddress (uint8_t address)
 
uint8_t readMemoryByte ()
 
void writeMemoryByte (uint8_t data)
 
uint8_t getDMPConfig1 ()
 
void setDMPConfig1 (uint8_t config)
 
uint8_t getDMPConfig2 ()
 
void setDMPConfig2 (uint8_t config)
 

Member Typedef Documentation

◆ SlaveId

using MPU6050::SlaveId = uint8_t

Constructor & Destructor Documentation

◆ MPU6050() [1/2]

MPU6050::MPU6050 ( )
inline

Default constructor, uses default I2C address.

See also
MPU6050_DEFAULT_ADDRESS

◆ MPU6050() [2/2]

MPU6050::MPU6050 ( uint8_t  address)
inline

Specific address constructor.

Parameters
addressI2C address
See also
MPU6050_DEFAULT_ADDRESS
MPU6050_ADDRESS_AD0_LOW
MPU6050_ADDRESS_AD0_HIGH

Member Function Documentation

◆ getAcceleration()

Motion3 MPU6050::getAcceleration ( )

Get 3-axis accelerometer readings. These registers store the most recent accelerometer measurements. Accelerometer measurements are written to these registers at the Sample Rate as defined in Register 25.

The accelerometer measurement registers, along with the temperature measurement registers, gyroscope measurement registers, and external sensor data registers, are composed of two sets of registers: an internal register set and a user-facing read register set.

The data within the accelerometer sensors' internal register set is always updated at the Sample Rate. Meanwhile, the user-facing read register set duplicates the internal register set's data values whenever the serial interface is idle. This guarantees that a burst read of sensor registers will read measurements from the same sampling instant. Note that if burst reads are not used, the user is responsible for ensuring a set of single byte reads correspond to a single sampling instant by checking the Data Ready interrupt.

Each 16-bit accelerometer measurement has a full scale defined in ACCEL_FS (Register 28). For each full scale setting, the accelerometers' sensitivity per LSB in ACCEL_xOUT is shown in the table below:

AFS_SEL | Full Scale Range | LSB Sensitivity
--------+------------------+----------------
0       | +/- 2g           | 8192 LSB/mg
1       | +/- 4g           | 4096 LSB/mg
2       | +/- 8g           | 2048 LSB/mg
3       | +/- 16g          | 1024 LSB/mg
Parameters
x16-bit signed integer container for X-axis acceleration
y16-bit signed integer container for Y-axis acceleration
z16-bit signed integer container for Z-axis acceleration
See also
MPU6050_RA_GYRO_XOUT_H

◆ getAccelerationX()

int16_t MPU6050::getAccelerationX ( )
inline

Get X-axis accelerometer reading.

Returns
X-axis acceleration measurement in 16-bit 2's complement format
See also
getMotion6()
MPU6050_RA_ACCEL_XOUT_H

◆ getAccelerationY()

int16_t MPU6050::getAccelerationY ( )
inline

Get Y-axis accelerometer reading.

Returns
Y-axis acceleration measurement in 16-bit 2's complement format
See also
getMotion6()
MPU6050_RA_ACCEL_YOUT_H

◆ getAccelerationZ()

int16_t MPU6050::getAccelerationZ ( )
inline

Get Z-axis accelerometer reading.

Returns
Z-axis acceleration measurement in 16-bit 2's complement format
See also
getMotion6()
MPU6050_RA_ACCEL_ZOUT_H

◆ getAccelerometerPowerOnDelay()

uint8_t MPU6050::getAccelerometerPowerOnDelay ( )
inline

Get accelerometer power-on delay. The accelerometer data path provides samples to the sensor registers, Motion detection, Zero Motion detection, and Free Fall detection modules. The signal path contains filters which must be flushed on wake-up with new samples before the detection modules begin operations. The default wake-up delay, of 4ms can be lengthened by up to 3ms. This additional delay is specified in ACCEL_ON_DELAY in units of 1 LSB = 1 ms. The user may select any value above zero unless instructed otherwise by InvenSense. Please refer to Section 8 of the MPU-6000/MPU-6050 Product Specification document for further information regarding the detection modules.

Returns
Current accelerometer power-on delay
See also
MPU6050_RA_MOT_DETECT_CTRL
MPU6050_DETECT_ACCEL_ON_DELAY_BIT

◆ getAccelFIFOEnabled()

bool MPU6050::getAccelFIFOEnabled ( )
inline

Get accelerometer FIFO enabled value. When set to 1, this bit enables ACCEL_XOUT_H, ACCEL_XOUT_L, ACCEL_YOUT_H, ACCEL_YOUT_L, ACCEL_ZOUT_H, and ACCEL_ZOUT_L (Registers 59 to 64) to be written into the FIFO buffer.

Returns
Current accelerometer FIFO enabled value
See also
MPU6050_RA_FIFO_EN

◆ getAccelXSelfTest()

bool MPU6050::getAccelXSelfTest ( )
inline

Get self-test enabled setting for accelerometer X axis.

Returns
Self-test enabled value
See also
MPU6050_RA_ACCEL_CONFIG

◆ getAccelXSelfTestFactoryTrim()

uint8_t MPU6050::getAccelXSelfTestFactoryTrim ( )

Get self-test factory trim value for accelerometer X axis.

Returns
factory trim value
See also
MPU6050_RA_SELF_TEST_X

◆ getAccelYSelfTest()

bool MPU6050::getAccelYSelfTest ( )
inline

Get self-test enabled value for accelerometer Y axis.

Returns
Self-test enabled value
See also
MPU6050_RA_ACCEL_CONFIG

◆ getAccelYSelfTestFactoryTrim()

uint8_t MPU6050::getAccelYSelfTestFactoryTrim ( )

Get self-test factory trim value for accelerometer Y axis.

Returns
factory trim value
See also
MPU6050_RA_SELF_TEST_Y

◆ getAccelZSelfTest()

bool MPU6050::getAccelZSelfTest ( )
inline

Get self-test enabled value for accelerometer Z axis.

Returns
Self-test enabled value
See also
MPU6050_RA_ACCEL_CONFIG

◆ getAccelZSelfTestFactoryTrim()

uint8_t MPU6050::getAccelZSelfTestFactoryTrim ( )

Get self-test factory trim value for accelerometer Z axis.

Returns
factory trim value
See also
MPU6050_RA_SELF_TEST_Z

◆ getAngularRate()

Motion3 MPU6050::getAngularRate ( )

Get 3-axis gyroscope readings. These gyroscope measurement registers, along with the accelerometer measurement registers, temperature measurement registers, and external sensor data registers, are composed of two sets of registers: an internal register set and a user-facing read register set. The data within the gyroscope sensors' internal register set is always updated at the Sample Rate. Meanwhile, the user-facing read register set duplicates the internal register set's data values whenever the serial interface is idle. This guarantees that a burst read of sensor registers will read measurements from the same sampling instant. Note that if burst reads are not used, the user is responsible for ensuring a set of single byte reads correspond to a single sampling instant by checking the Data Ready interrupt.

Each 16-bit gyroscope measurement has a full scale defined in FS_SEL (Register 27). For each full scale setting, the gyroscopes' sensitivity per LSB in GYRO_xOUT is shown in the table below:

FS_SEL | Full Scale Range   | LSB Sensitivity
-------+--------------------+----------------
0      | +/- 250 degrees/s  | 131 LSB/deg/s
1      | +/- 500 degrees/s  | 65.5 LSB/deg/s
2      | +/- 1000 degrees/s | 32.8 LSB/deg/s
3      | +/- 2000 degrees/s | 16.4 LSB/deg/s
Returns
container for 3-axis gyro values
See also
getMotion6()
MPU6050_RA_GYRO_XOUT_H

◆ getAngularRateX()

int16_t MPU6050::getAngularRateX ( )
inline

Get X-axis gyroscope reading.

Returns
X-axis rotation measurement in 16-bit 2's complement format
See also
getMotion6()
MPU6050_RA_GYRO_XOUT_H

◆ getAngularRateY()

int16_t MPU6050::getAngularRateY ( )
inline

Get Y-axis gyroscope reading.

Returns
Y-axis rotation measurement in 16-bit 2's complement format
See also
getMotion6()
MPU6050_RA_GYRO_YOUT_H

◆ getAngularRateZ()

int16_t MPU6050::getAngularRateZ ( )
inline

Get Z-axis gyroscope reading.

Returns
Z-axis rotation measurement in 16-bit 2's complement format
See also
getMotion6()
MPU6050_RA_GYRO_ZOUT_H

◆ getAngularRateZ2()

int16_t MPU6050::getAngularRateZ2 ( )
inline

◆ getAuxVDDIOLevel()

uint8_t MPU6050::getAuxVDDIOLevel ( )
inline

Get the auxiliary I2C supply voltage level. When set to 1, the auxiliary I2C bus high logic level is VDD. When cleared to 0, the auxiliary I2C bus high logic level is VLOGIC. This does not apply to the MPU-6000, which does not have a VLOGIC pin.

Returns
I2C supply voltage level (0=VLOGIC, 1=VDD)

◆ getClockOutputEnabled()

bool MPU6050::getClockOutputEnabled ( )
inline

Get reference clock output enabled status. When this bit is equal to 1, a reference clock output is provided at the CLKOUT pin. When this bit is equal to 0, the clock output is disabled. For further information regarding CLKOUT, please refer to the MPU-60X0 Product Specification document.

Returns
Current reference clock output enabled status
See also
MPU6050_RA_INT_PIN_CFG
MPU6050_INTCFG_CLKOUT_EN_BIT

◆ getClockSource()

uint8_t MPU6050::getClockSource ( )
inline

Get clock source setting.

Returns
Current clock source setting
See also
MPU6050_RA_PWR_MGMT_1
MPU6050_PWR1_CLKSEL_BIT
MPU6050_PWR1_CLKSEL_LENGTH

◆ getDeviceID()

uint8_t MPU6050::getDeviceID ( )
inline

Get Device ID. This register is used to verify the identity of the device (0b110100, 0x34).

Returns
Device ID (6 bits only! should be 0x34)
See also
MPU6050_RA_WHO_AM_I
MPU6050_WHO_AM_I_BIT
MPU6050_WHO_AM_I_LENGTH

◆ getDHPFMode()

uint8_t MPU6050::getDHPFMode ( )
inline

Get the high-pass filter configuration. The DHPF is a filter module in the path leading to motion detectors (Free Fall, Motion threshold, and Zero Motion). The high pass filter output is not available to the data registers (see Figure in Section 8 of the MPU-6000/ MPU-6050 Product Specification document).

The high pass filter has three modes:

      Reset: The filter output settles to zero within one sample. This
             effectively disables the high pass filter. This mode may be toggled
             to quickly settle the filter.

      On:    The high pass filter will pass signals above the cut off frequency.

      Hold:  When triggered, the filter holds the present sample. The filter
             output will be the difference between the input sample and the held
             sample.
   
   ACCEL_HPF | Filter Mode | Cut-off Frequency
   ----------+-------------+------------------
   0         | Reset       | None
   1         | On          | 5Hz
   2         | On          | 2.5Hz
   3         | On          | 1.25Hz
   4         | On          | 0.63Hz
   7         | Hold        | None
   
Returns
Current high-pass filter configuration
See also
MPU6050_DHPF_RESET
MPU6050_RA_ACCEL_CONFIG

◆ getDLPFMode()

uint8_t MPU6050::getDLPFMode ( )
inline

Get digital low-pass filter configuration. The DLPF_CFG parameter sets the digital low pass filter configuration. It also determines the internal sampling rate used by the device as shown in the table below.

Note: The accelerometer output rate is 1kHz. This means that for a Sample Rate greater than 1kHz, the same accelerometer sample may be output to the FIFO, DMP, and sensor registers more than once.

            |   ACCELEROMETER    |           GYROSCOPE
   DLPF_CFG | Bandwidth | Delay  | Bandwidth | Delay  | Sample Rate
   ---------+-----------+--------+-----------+--------+-------------
   0        | 260Hz     | 0ms    | 256Hz     | 0.98ms | 8kHz
   1        | 184Hz     | 2.0ms  | 188Hz     | 1.9ms  | 1kHz
   2        | 94Hz      | 3.0ms  | 98Hz      | 2.8ms  | 1kHz
   3        | 44Hz      | 4.9ms  | 42Hz      | 4.8ms  | 1kHz
   4        | 21Hz      | 8.5ms  | 20Hz      | 8.3ms  | 1kHz
   5        | 10Hz      | 13.8ms | 10Hz      | 13.4ms | 1kHz
   6        | 5Hz       | 19.0ms | 5Hz       | 18.6ms | 1kHz
   7        |   -- Reserved --   |   -- Reserved --   | Reserved
   
Returns
DLFP configuration
See also
MPU6050_RA_CONFIG
MPU6050_CFG_DLPF_CFG_BIT
MPU6050_CFG_DLPF_CFG_LENGTH

◆ getDMPConfig1()

uint8_t MPU6050::getDMPConfig1 ( )
inline

◆ getDMPConfig2()

uint8_t MPU6050::getDMPConfig2 ( )
inline

◆ getDMPEnabled()

bool MPU6050::getDMPEnabled ( )
inline

◆ getDMPInt0Status()

bool MPU6050::getDMPInt0Status ( )
inline

◆ getDMPInt1Status()

bool MPU6050::getDMPInt1Status ( )
inline

◆ getDMPInt2Status()

bool MPU6050::getDMPInt2Status ( )
inline

◆ getDMPInt3Status()

bool MPU6050::getDMPInt3Status ( )
inline

◆ getDMPInt4Status()

bool MPU6050::getDMPInt4Status ( )
inline

◆ getDMPInt5Status()

bool MPU6050::getDMPInt5Status ( )
inline

◆ getExternalFrameSync()

uint8_t MPU6050::getExternalFrameSync ( )
inline

Get external FSYNC configuration. Configures the external Frame Synchronization (FSYNC) pin sampling. An external signal connected to the FSYNC pin can be sampled by configuring EXT_SYNC_SET. Signal changes to the FSYNC pin are latched so that short strobes may be captured. The latched FSYNC signal will be sampled at the Sampling Rate, as defined in register 25. After sampling, the latch will reset to the current FSYNC signal state.

The sampled value will be reported in place of the least significant bit in a sensor data register determined by the value of EXT_SYNC_SET according to the following table.

   EXT_SYNC_SET | FSYNC Bit Location
   -------------+-------------------
   0            | Input disabled
   1            | TEMP_OUT_L[0]
   2            | GYRO_XOUT_L[0]
   3            | GYRO_YOUT_L[0]
   4            | GYRO_ZOUT_L[0]
   5            | ACCEL_XOUT_L[0]
   6            | ACCEL_YOUT_L[0]
   7            | ACCEL_ZOUT_L[0]
   
Returns
FSYNC configuration value

◆ getExternalSensorByte()

uint8_t MPU6050::getExternalSensorByte ( int  position)
inline

Read single byte from external sensor data register. These registers store data read from external sensors by the Slave 0, 1, 2, and 3 on the auxiliary I2C interface. Data read by Slave 4 is stored in I2C_SLV4_DI (Register 53).

External sensor data is written to these registers at the Sample Rate as defined in Register 25. This access rate can be reduced by using the Slave Delay Enable registers (Register 103).

External sensor data registers, along with the gyroscope measurement registers, accelerometer measurement registers, and temperature measurement registers, are composed of two sets of registers: an internal register set and a user-facing read register set.

The data within the external sensors' internal register set is always updated at the Sample Rate (or the reduced access rate) whenever the serial interface is idle. This guarantees that a burst read of sensor registers will read measurements from the same sampling instant. Note that if burst reads are not used, the user is responsible for ensuring a set of single byte reads correspond to a single sampling instant by checking the Data Ready interrupt.

Data is placed in these external sensor data registers according to I2C_SLV0_CTRL, I2C_SLV1_CTRL, I2C_SLV2_CTRL, and I2C_SLV3_CTRL (Registers 39, 42, 45, and 48). When more than zero bytes are read (I2C_SLVx_LEN > 0) from an enabled slave (I2C_SLVx_EN = 1), the slave is read at the Sample Rate (as defined in Register 25) or delayed rate (if specified in Register 52 and 103). During each Sample cycle, slave reads are performed in order of Slave number. If all slaves are enabled with more than zero bytes to be read, the order will be Slave 0, followed by Slave 1, Slave 2, and Slave 3.

Each enabled slave will have EXT_SENS_DATA registers associated with it by number of bytes read (I2C_SLVx_LEN) in order of slave number, starting from EXT_SENS_DATA_00. Note that this means enabling or disabling a slave may change the higher numbered slaves' associated registers. Furthermore, if fewer total bytes are being read from the external sensors as a result of such a change, then the data remaining in the registers which no longer have an associated slave device (i.e. high numbered registers) will remain in these previously allocated registers unless reset.

If the sum of the read lengths of all SLVx transactions exceed the number of available EXT_SENS_DATA registers, the excess bytes will be dropped. There are 24 EXT_SENS_DATA registers and hence the total read lengths between all the slaves cannot be greater than 24 or some bytes will be lost.

Note: Slave 4's behavior is distinct from that of Slaves 0-3. For further information regarding the characteristics of Slave 4, please refer to Registers 49 to 53.

EXAMPLE: Suppose that Slave 0 is enabled with 4 bytes to be read (I2C_SLV0_EN = 1 and I2C_SLV0_LEN = 4) while Slave 1 is enabled with 2 bytes to be read so that I2C_SLV1_EN = 1 and I2C_SLV1_LEN = 2. In such a situation, EXT_SENS_DATA _00 through _03 will be associated with Slave 0, while EXT_SENS_DATA _04 and 05 will be associated with Slave 1. If Slave 2 is enabled as well, registers starting from EXT_SENS_DATA_06 will be allocated to Slave 2.

If Slave 2 is disabled while Slave 3 is enabled in this same situation, then registers starting from EXT_SENS_DATA_06 will be allocated to Slave 3 instead.

REGISTER ALLOCATION FOR DYNAMIC DISABLE VS. NORMAL DISABLE: If a slave is disabled at any time, the space initially allocated to the slave in the EXT_SENS_DATA register, will remain associated with that slave. This is to avoid dynamic adjustment of the register allocation.

The allocation of the EXT_SENS_DATA registers is recomputed only when (1) all slaves are disabled, or (2) the I2C_MST_RST bit is set (Register 106).

This above is also true if one of the slaves gets NACKed and stops functioning.

Parameters
positionStarting position (0-23)
Returns
Byte read from register

◆ getExternalSensorDWord()

uint32_t MPU6050::getExternalSensorDWord ( int  position)
inline

Read double word (4 bytes) from external sensor data registers.

Parameters
positionStarting position (0-20)
Returns
Double word read from registers
See also
getExternalSensorByte()

◆ getExternalSensorWord()

uint16_t MPU6050::getExternalSensorWord ( int  position)
inline

Read word (2 bytes) from external sensor data registers.

Parameters
positionStarting position (0-21)
Returns
Word read from register
See also
getExternalSensorByte()

◆ getExternalShadowDelayEnabled()

bool MPU6050::getExternalShadowDelayEnabled ( )
inline

Get external data shadow delay enabled status. This register is used to specify the timing of external sensor data shadowing. When DELAY_ES_SHADOW is set to 1, shadowing of external sensor data is delayed until all data has been received.

Returns
Current external data shadow delay enabled status.
See also
MPU6050_RA_I2C_MST_DELAY_CTRL
MPU6050_DELAYCTRL_DELAY_ES_SHADOW_BIT

◆ getFIFOByte()

uint8_t MPU6050::getFIFOByte ( )
inline

Get byte from FIFO buffer. This register is used to read and write data from the FIFO buffer. Data is written to the FIFO in order of register number (from lowest to highest). If all the FIFO enable flags (see below) are enabled and all External Sensor Data registers (Registers 73 to 96) are associated with a Slave device, the contents of registers 59 through 96 will be written in order at the Sample Rate.

The contents of the sensor data registers (Registers 59 to 96) are written into the FIFO buffer when their corresponding FIFO enable flags are set to 1 in FIFO_EN (Register 35). An additional flag for the sensor data registers associated with I2C Slave 3 can be found in I2C_MST_CTRL (Register 36).

If the FIFO buffer has overflowed, the status bit FIFO_OFLOW_INT is automatically set to 1. This bit is located in INT_STATUS (Register 58). When the FIFO buffer has overflowed, the oldest data will be lost and new data will be written to the FIFO.

If the FIFO buffer is empty, reading this register will return the last byte that was previously read from the FIFO until new data is available. The user should check FIFO_COUNT to ensure that the FIFO buffer is not read when empty.

Returns
Byte from FIFO buffer

◆ getFIFOBytes()

void MPU6050::getFIFOBytes ( uint8_t *  data,
uint8_t  length 
)
inline

◆ getFIFOCount()

uint16_t MPU6050::getFIFOCount ( )
inline

Get current FIFO buffer size. This value indicates the number of bytes stored in the FIFO buffer. This number is in turn the number of bytes that can be read from the FIFO buffer and it is directly proportional to the number of samples available given the set of sensor data bound to be stored in the FIFO (register 35 and 36).

Returns
Current FIFO buffer size

◆ getFIFOEnabled()

bool MPU6050::getFIFOEnabled ( )
inline

Get FIFO enabled status. When this bit is set to 0, the FIFO buffer is disabled. The FIFO buffer cannot be written to or read from while disabled. The FIFO buffer's state does not change unless the MPU-60X0 is power cycled.

Returns
Current FIFO enabled status
See also
MPU6050_RA_USER_CTRL
MPU6050_USERCTRL_FIFO_EN_BIT

◆ getFreefallDetectionCounterDecrement()

uint8_t MPU6050::getFreefallDetectionCounterDecrement ( )
inline

Get Free Fall detection counter decrement configuration. Detection is registered by the Free Fall detection module after accelerometer measurements meet their respective threshold conditions over a specified number of samples. When the threshold conditions are met, the corresponding detection counter increments by 1. The user may control the rate at which the detection counter decrements when the threshold condition is not met by configuring FF_COUNT. The decrement rate can be set according to the following table:

FF_COUNT | Counter Decrement
---------+------------------
0        | Reset
1        | 1
2        | 2
3        | 4

When FF_COUNT is configured to 0 (reset), any non-qualifying sample will reset the counter to 0. For further information on Free Fall detection, please refer to Registers 29 to 32.

Returns
Current decrement configuration
See also
MPU6050_RA_MOT_DETECT_CTRL
MPU6050_DETECT_FF_COUNT_BIT

◆ getFreefallDetectionDuration()

uint8_t MPU6050::getFreefallDetectionDuration ( )
inline

Get free-fall event duration threshold. This register configures the duration counter threshold for Free Fall event detection. The duration counter ticks at 1kHz, therefore FF_DUR has a unit of 1 LSB = 1 ms.

The Free Fall duration counter increments while the absolute value of the accelerometer measurements are each less than the detection threshold (Register 29). The Free Fall interrupt is triggered when the Free Fall duration counter reaches the time specified in this register.

For more details on the Free Fall detection interrupt, see Section 8.2 of the MPU-6000/MPU-6050 Product Specification document as well as Registers 56 and 58 of this document.

Returns
Current free-fall duration threshold value (LSB = 1ms)
See also
MPU6050_RA_FF_DUR

◆ getFreefallDetectionThreshold()

uint8_t MPU6050::getFreefallDetectionThreshold ( )
inline

Get free-fall event acceleration threshold. This register configures the detection threshold for Free Fall event detection. The unit of FF_THR is 1LSB = 2mg. Free Fall is detected when the absolute value of the accelerometer measurements for the three axes are each less than the detection threshold. This condition increments the Free Fall duration counter (Register 30). The Free Fall interrupt is triggered when the Free Fall duration counter reaches the time specified in FF_DUR.

For more details on the Free Fall detection interrupt, see Section 8.2 of the MPU-6000/MPU-6050 Product Specification document as well as Registers 56 and 58 of this document.

Returns
Current free-fall acceleration threshold value (LSB = 2mg)
See also
MPU6050_RA_FF_THR

◆ getFSyncInterruptEnabled()

bool MPU6050::getFSyncInterruptEnabled ( )
inline

Get FSYNC pin interrupt enabled setting. Will be set 0 for disabled, 1 for enabled.

Returns
Current interrupt enabled setting
See also
MPU6050_RA_INT_PIN_CFG
MPU6050_INTCFG_FSYNC_INT_EN_BIT

◆ getFSyncInterruptLevel()

bool MPU6050::getFSyncInterruptLevel ( )
inline

Get FSYNC interrupt logic level mode.

Returns
Current FSYNC interrupt mode (0=active-high, 1=active-low)
See also
getFSyncInterruptMode()
MPU6050_RA_INT_PIN_CFG
MPU6050_INTCFG_FSYNC_INT_LEVEL_BIT

◆ getFullScaleAccelRange()

uint8_t MPU6050::getFullScaleAccelRange ( )
inline

Get full-scale accelerometer range. The FS_SEL parameter allows setting the full-scale range of the accelerometer sensors, as described in the table below.

   0 = +/- 2g
   1 = +/- 4g
   2 = +/- 8g
   3 = +/- 16g
   
Returns
Current full-scale accelerometer range setting
See also
MPU6050_ACCEL_FS_2
MPU6050_RA_ACCEL_CONFIG
MPU6050_ACONFIG_AFS_SEL_BIT
MPU6050_ACONFIG_AFS_SEL_LENGTH

◆ getFullScaleGyroRange()

uint8_t MPU6050::getFullScaleGyroRange ( )
inline

Get full-scale gyroscope range. The FS_SEL parameter allows setting the full-scale range of the gyro sensors, as described in the table below.

   0 = +/- 250 degrees/sec
   1 = +/- 500 degrees/sec
   2 = +/- 1000 degrees/sec
   3 = +/- 2000 degrees/sec
   
Returns
Current full-scale gyroscope range setting
See also
MPU6050_GYRO_FS_250
MPU6050_RA_GYRO_CONFIG
MPU6050_GCONFIG_FS_SEL_BIT
MPU6050_GCONFIG_FS_SEL_LENGTH

◆ getGyroXSelfTestFactoryTrim()

uint8_t MPU6050::getGyroXSelfTestFactoryTrim ( )

Get self-test factory trim value for gyro X axis.

Returns
factory trim value
See also
MPU6050_RA_SELF_TEST_X

◆ getGyroYSelfTestFactoryTrim()

uint8_t MPU6050::getGyroYSelfTestFactoryTrim ( )

Get self-test factory trim value for gyro Y axis.

Returns
factory trim value
See also
MPU6050_RA_SELF_TEST_Y

◆ getGyroZSelfTestFactoryTrim()

uint8_t MPU6050::getGyroZSelfTestFactoryTrim ( )

Get self-test factory trim value for gyro Z axis.

Returns
factory trim value
See also
MPU6050_RA_SELF_TEST_Z

◆ getI2CBypassEnabled()

bool MPU6050::getI2CBypassEnabled ( )
inline

Get I2C bypass enabled status. When this bit is equal to 1 and I2C_MST_EN (Register 106 bit[5]) is equal to 0, the host application processor will be able to directly access the auxiliary I2C bus of the MPU-60X0. When this bit is equal to 0, the host application processor will not be able to directly access the auxiliary I2C bus of the MPU-60X0 regardless of the state of I2C_MST_EN (Register 106 bit[5]).

Returns
Current I2C bypass enabled status
See also
MPU6050_RA_INT_PIN_CFG
MPU6050_INTCFG_I2C_BYPASS_EN_BIT

◆ getI2CMasterModeEnabled()

bool MPU6050::getI2CMasterModeEnabled ( )
inline

Get I2C Master Mode enabled status. When this mode is enabled, the MPU-60X0 acts as the I2C Master to the external sensor slave devices on the auxiliary I2C bus. When this bit is cleared to 0, the auxiliary I2C bus lines (AUX_DA and AUX_CL) are logically driven by the primary I2C bus (SDA and SCL). This is a precondition to enabling Bypass Mode. For further information regarding Bypass Mode, please refer to Register 55.

Returns
Current I2C Master Mode enabled status
See also
MPU6050_RA_USER_CTRL
MPU6050_USERCTRL_I2C_MST_EN_BIT

◆ getIntDataReadyEnabled()

bool MPU6050::getIntDataReadyEnabled ( )
inline

Get Data Ready interrupt enabled setting. This event occurs each time a write operation to all of the sensor registers has been completed. Will be set 0 for disabled, 1 for enabled.

Returns
Current interrupt enabled status
See also
MPU6050_RA_INT_ENABLE
MPU6050_INTERRUPT_DATA_RDY_BIT

◆ getIntDataReadyStatus()

bool MPU6050::getIntDataReadyStatus ( )
inline

Get Data Ready interrupt status. This bit automatically sets to 1 when a Data Ready interrupt has been generated. The bit clears to 0 after the register has been read.

Returns
Current interrupt status
See also
MPU6050_RA_INT_STATUS
MPU6050_INTERRUPT_DATA_RDY_BIT

◆ getIntDMPEnabled()

bool MPU6050::getIntDMPEnabled ( )
inline

◆ getIntDMPStatus()

bool MPU6050::getIntDMPStatus ( )
inline

◆ getIntEnabled()

uint8_t MPU6050::getIntEnabled ( )
inline

Get full interrupt enabled status. Full register byte for all interrupts, for quick reading. Each bit will be set 0 for disabled, 1 for enabled.

Returns
Current interrupt enabled status
See also
MPU6050_RA_INT_ENABLE
MPU6050_INTERRUPT_FF_BIT

◆ getInterruptDrive()

bool MPU6050::getInterruptDrive ( )
inline

Get interrupt drive mode. Will be set 0 for push-pull, 1 for open-drain.

Returns
Current interrupt drive mode (0=push-pull, 1=open-drain)
See also
MPU6050_RA_INT_PIN_CFG
MPU6050_INTCFG_INT_OPEN_BIT

◆ getInterruptLatch()

bool MPU6050::getInterruptLatch ( )
inline

Get interrupt latch mode. Will be set 0 for 50us-pulse, 1 for latch-until-int-cleared.

Returns
Current latch mode (0=50us-pulse, 1=latch-until-int-cleared)
See also
MPU6050_RA_INT_PIN_CFG
MPU6050_INTCFG_LATCH_INT_EN_BIT

◆ getInterruptLatchClear()

bool MPU6050::getInterruptLatchClear ( )
inline

Get interrupt latch clear mode. Will be set 0 for status-read-only, 1 for any-register-read.

Returns
Current latch clear mode (0=status-read-only, 1=any-register-read)
See also
MPU6050_RA_INT_PIN_CFG
MPU6050_INTCFG_INT_RD_CLEAR_BIT

◆ getInterruptMode()

bool MPU6050::getInterruptMode ( )
inline

Get interrupt logic level mode. Will be set 0 for active-high, 1 for active-low.

Returns
Current interrupt mode (0=active-high, 1=active-low)
See also
MPU6050_RA_INT_PIN_CFG
MPU6050_INTCFG_INT_LEVEL_BIT

◆ getIntFIFOBufferOverflowEnabled()

bool MPU6050::getIntFIFOBufferOverflowEnabled ( )
inline

Get FIFO Buffer Overflow interrupt enabled status. Will be set 0 for disabled, 1 for enabled.

Returns
Current interrupt enabled status
See also
MPU6050_RA_INT_ENABLE
MPU6050_INTERRUPT_FIFO_OFLOW_BIT

◆ getIntFIFOBufferOverflowStatus()

bool MPU6050::getIntFIFOBufferOverflowStatus ( )
inline

Get FIFO Buffer Overflow interrupt status. This bit automatically sets to 1 when a Free Fall interrupt has been generated. The bit clears to 0 after the register has been read.

Returns
Current interrupt status
See also
MPU6050_RA_INT_STATUS
MPU6050_INTERRUPT_FIFO_OFLOW_BIT

◆ getIntFreefallEnabled()

bool MPU6050::getIntFreefallEnabled ( )
inline

Get Free Fall interrupt enabled status. Will be set 0 for disabled, 1 for enabled.

Returns
Current interrupt enabled status
See also
MPU6050_RA_INT_ENABLE
MPU6050_INTERRUPT_FF_BIT

◆ getIntFreefallStatus()

bool MPU6050::getIntFreefallStatus ( )
inline

Get Free Fall interrupt status. This bit automatically sets to 1 when a Free Fall interrupt has been generated. The bit clears to 0 after the register has been read.

Returns
Current interrupt status
See also
MPU6050_RA_INT_STATUS
MPU6050_INTERRUPT_FF_BIT

◆ getIntI2CMasterEnabled()

bool MPU6050::getIntI2CMasterEnabled ( )
inline

Get I2C Master interrupt enabled status. This enables any of the I2C Master interrupt sources to generate an interrupt. Will be set 0 for disabled, 1 for enabled.

Returns
Current interrupt enabled status
See also
MPU6050_RA_INT_ENABLE
MPU6050_INTERRUPT_I2C_MST_INT_BIT

◆ getIntI2CMasterStatus()

bool MPU6050::getIntI2CMasterStatus ( )
inline

Get I2C Master interrupt status. This bit automatically sets to 1 when an I2C Master interrupt has been generated. For a list of I2C Master interrupts, please refer to Register 54. The bit clears to 0 after the register has been read.

Returns
Current interrupt status
See also
MPU6050_RA_INT_STATUS
MPU6050_INTERRUPT_I2C_MST_INT_BIT

◆ getIntMotionEnabled()

bool MPU6050::getIntMotionEnabled ( )
inline

Get Motion Detection interrupt enabled status. Will be set 0 for disabled, 1 for enabled.

Returns
Current interrupt enabled status
See also
MPU6050_RA_INT_ENABLE
MPU6050_INTERRUPT_MOT_BIT

◆ getIntMotionStatus()

bool MPU6050::getIntMotionStatus ( )
inline

Get Motion Detection interrupt status. This bit automatically sets to 1 when a Motion Detection interrupt has been generated. The bit clears to 0 after the register has been read.

Returns
Current interrupt status
See also
MPU6050_RA_INT_STATUS
MPU6050_INTERRUPT_MOT_BIT

◆ getIntPLLReadyEnabled()

bool MPU6050::getIntPLLReadyEnabled ( )
inline

◆ getIntPLLReadyStatus()

bool MPU6050::getIntPLLReadyStatus ( )
inline

◆ getIntStatus()

uint8_t MPU6050::getIntStatus ( )
inline

Get full set of interrupt status bits. These bits clear to 0 after the register has been read. Very useful for getting multiple INT statuses, since each single bit read clears all of them because it has to read the whole byte.

Returns
Current interrupt status
See also
MPU6050_RA_INT_STATUS

◆ getIntZeroMotionEnabled()

bool MPU6050::getIntZeroMotionEnabled ( )
inline

Get Zero Motion Detection interrupt enabled status. Will be set 0 for disabled, 1 for enabled.

Returns
Current interrupt enabled status
See also
MPU6050_RA_INT_ENABLE
MPU6050_INTERRUPT_ZMOT_BIT

◆ getIntZeroMotionStatus()

bool MPU6050::getIntZeroMotionStatus ( )
inline

Get Zero Motion Detection interrupt status. This bit automatically sets to 1 when a Zero Motion Detection interrupt has been generated. The bit clears to 0 after the register has been read.

Returns
Current interrupt status
See also
MPU6050_RA_INT_STATUS
MPU6050_INTERRUPT_ZMOT_BIT

◆ getLostArbitration()

bool MPU6050::getLostArbitration ( )
inline

Get master arbitration lost status. This bit automatically sets to 1 when the I2C Master has lost arbitration of the auxiliary I2C bus (an error condition). This triggers an interrupt if the I2C_MST_INT_EN bit in the INT_ENABLE register (Register 56) is asserted.

Returns
Master arbitration lost status
See also
MPU6050_RA_I2C_MST_STATUS

◆ getMasterClockSpeed()

uint8_t MPU6050::getMasterClockSpeed ( )
inline

Get I2C master clock speed. I2C_MST_CLK is a 4 bit unsigned value which configures a divider on the MPU-60X0 internal 8MHz clock. It sets the I2C master clock speed according to the following table:

   I2C_MST_CLK | I2C Master Clock Speed | 8MHz Clock Divider
   ------------+------------------------+-------------------
   0           | 348kHz                 | 23
   1           | 333kHz                 | 24
   2           | 320kHz                 | 25
   3           | 308kHz                 | 26
   4           | 296kHz                 | 27
   5           | 286kHz                 | 28
   6           | 276kHz                 | 29
   7           | 267kHz                 | 30
   8           | 258kHz                 | 31
   9           | 500kHz                 | 16
   10          | 471kHz                 | 17
   11          | 444kHz                 | 18
   12          | 421kHz                 | 19
   13          | 400kHz                 | 20
   14          | 381kHz                 | 21
   15          | 364kHz                 | 22
   
Returns
Current I2C master clock speed
See also
MPU6050_RA_I2C_MST_CTRL

◆ getMotion6()

Motion6 MPU6050::getMotion6 ( )

Get raw 6-axis motion sensor readings (accel/gyro). Retrieves all currently available motion sensor values.

Returns
container for 3-axis accelerometer and 3-axis gyroscope values
See also
getAcceleration()
getAngularRate()
MPU6050_RA_ACCEL_XOUT_H

◆ getMotionDetectionCounterDecrement()

uint8_t MPU6050::getMotionDetectionCounterDecrement ( )
inline

Get Motion detection counter decrement configuration. Detection is registered by the Motion detection module after accelerometer measurements meet their respective threshold conditions over a specified number of samples. When the threshold conditions are met, the corresponding detection counter increments by 1. The user may control the rate at which the detection counter decrements when the threshold condition is not met by configuring MOT_COUNT. The decrement rate can be set according to the following table:

MOT_COUNT | Counter Decrement
----------+------------------
0         | Reset
1         | 1
2         | 2
3         | 4

When MOT_COUNT is configured to 0 (reset), any non-qualifying sample will reset the counter to 0. For further information on Motion detection, please refer to Registers 29 to 32.

◆ getMotionDetectionDuration()

uint8_t MPU6050::getMotionDetectionDuration ( )
inline

Get motion detection event duration threshold. This register configures the duration counter threshold for Motion interrupt generation. The duration counter ticks at 1 kHz, therefore MOT_DUR has a unit of 1LSB = 1ms. The Motion detection duration counter increments when the absolute value of any of the accelerometer measurements exceeds the Motion detection threshold (Register 31). The Motion detection interrupt is triggered when the Motion detection counter reaches the time count specified in this register.

For more details on the Motion detection interrupt, see Section 8.3 of the MPU-6000/MPU-6050 Product Specification document.

Returns
Current motion detection duration threshold value (LSB = 1ms)
See also
MPU6050_RA_MOT_DUR

◆ getMotionDetectionThreshold()

uint8_t MPU6050::getMotionDetectionThreshold ( )
inline

Get motion detection event acceleration threshold. This register configures the detection threshold for Motion interrupt generation. The unit of MOT_THR is 1LSB = 2mg. Motion is detected when the absolute value of any of the accelerometer measurements exceeds this Motion detection threshold. This condition increments the Motion detection duration counter (Register 32). The Motion detection interrupt is triggered when the Motion Detection counter reaches the time count specified in MOT_DUR (Register 32).

The Motion interrupt will indicate the axis and polarity of detected motion in MOT_DETECT_STATUS (Register 97).

For more details on the Motion detection interrupt, see Section 8.3 of the MPU-6000/MPU-6050 Product Specification document as well as Registers 56 and 58 of this document.

Returns
Current motion detection acceleration threshold value (LSB = 2mg)
See also
MPU6050_RA_MOT_THR

◆ getMotionStatus()

uint8_t MPU6050::getMotionStatus ( )
inline

Get full motion detection status register content (all bits).

Returns
Motion detection status byte
See also
MPU6050_RA_MOT_DETECT_STATUS

◆ getMultiMasterEnabled()

bool MPU6050::getMultiMasterEnabled ( )
inline

Get multi-master enabled value. Multi-master capability allows multiple I2C masters to operate on the same bus. In circuits where multi-master capability is required, set MULT_MST_EN to 1. This will increase current drawn by approximately 30uA.

In circuits where multi-master capability is required, the state of the I2C bus must always be monitored by each separate I2C Master. Before an I2C Master can assume arbitration of the bus, it must first confirm that no other I2C Master has arbitration of the bus. When MULT_MST_EN is set to 1, the MPU-60X0's bus arbitration detection logic is turned on, enabling it to detect when the bus is available.

Returns
Current multi-master enabled value
See also
MPU6050_RA_I2C_MST_CTRL

◆ getOTPBankValid()

uint8_t MPU6050::getOTPBankValid ( )
inline

◆ getPassthroughStatus()

bool MPU6050::getPassthroughStatus ( )
inline

Get FSYNC interrupt status. This bit reflects the status of the FSYNC interrupt from an external device into the MPU-60X0. This is used as a way to pass an external interrupt through the MPU-60X0 to the host application processor. When set to 1, this bit will cause an interrupt if FSYNC_INT_EN is asserted in INT_PIN_CFG (Register 55).

Returns
FSYNC interrupt status
See also
MPU6050_RA_I2C_MST_STATUS

◆ getRate()

uint8_t MPU6050::getRate ( )
inline

Get gyroscope output rate divider. The sensor register output, FIFO output, DMP sampling, Motion detection, Zero Motion detection, and Free Fall detection are all based on the Sample Rate. The Sample Rate is generated by dividing the gyroscope output rate by SMPLRT_DIV:

Sample Rate = Gyroscope Output Rate / (1 + SMPLRT_DIV)

where Gyroscope Output Rate = 8kHz when the DLPF is disabled (DLPF_CFG = 0 or 7), and 1kHz when the DLPF is enabled (see Register 26).

Note: The accelerometer output rate is 1kHz. This means that for a Sample Rate greater than 1kHz, the same accelerometer sample may be output to the FIFO, DMP, and sensor registers more than once.

For a diagram of the gyroscope and accelerometer signal paths, see Section 8 of the MPU-6000/MPU-6050 Product Specification document.

Returns
Current sample rate
See also
MPU6050_RA_SMPLRT_DIV

◆ getSlate4InputByte()

uint8_t MPU6050::getSlate4InputByte ( )
inline

Get last available byte read from Slave 4. This register stores the data read from Slave 4. This field is populated after a read transaction.

Returns
Last available byte read from to Slave 4
See also
MPU6050_RA_I2C_SLV4_DI

◆ getSlave0FIFOEnabled()

bool MPU6050::getSlave0FIFOEnabled ( )
inline

Get Slave 0 FIFO enabled value. When set to 1, this bit enables EXT_SENS_DATA registers (Registers 73 to 96) associated with Slave 0 to be written into the FIFO buffer.

Returns
Current Slave 0 FIFO enabled value
See also
MPU6050_RA_FIFO_EN

◆ getSlave0Nack()

bool MPU6050::getSlave0Nack ( )
inline

Get Slave 0 NACK status. This bit automatically sets to 1 when the I2C Master receives a NACK in a transaction with Slave 0. This triggers an interrupt if the I2C_MST_INT_EN bit in the INT_ENABLE register (Register 56) is asserted.

Returns
Slave 0 NACK interrupt status
See also
MPU6050_RA_I2C_MST_STATUS

◆ getSlave1FIFOEnabled()

bool MPU6050::getSlave1FIFOEnabled ( )
inline

Get Slave 1 FIFO enabled value. When set to 1, this bit enables EXT_SENS_DATA registers (Registers 73 to 96) associated with Slave 1 to be written into the FIFO buffer.

Returns
Current Slave 1 FIFO enabled value
See also
MPU6050_RA_FIFO_EN

◆ getSlave1Nack()

bool MPU6050::getSlave1Nack ( )
inline

Get Slave 1 NACK status. This bit automatically sets to 1 when the I2C Master receives a NACK in a transaction with Slave 1. This triggers an interrupt if the I2C_MST_INT_EN bit in the INT_ENABLE register (Register 56) is asserted.

Returns
Slave 1 NACK interrupt status
See also
MPU6050_RA_I2C_MST_STATUS

◆ getSlave2FIFOEnabled()

bool MPU6050::getSlave2FIFOEnabled ( )
inline

Get Slave 2 FIFO enabled value. When set to 1, this bit enables EXT_SENS_DATA registers (Registers 73 to 96) associated with Slave 2 to be written into the FIFO buffer.

Returns
Current Slave 2 FIFO enabled value
See also
MPU6050_RA_FIFO_EN

◆ getSlave2Nack()

bool MPU6050::getSlave2Nack ( )
inline

Get Slave 2 NACK status. This bit automatically sets to 1 when the I2C Master receives a NACK in a transaction with Slave 2. This triggers an interrupt if the I2C_MST_INT_EN bit in the INT_ENABLE register (Register 56) is asserted.

Returns
Slave 2 NACK interrupt status
See also
MPU6050_RA_I2C_MST_STATUS

◆ getSlave3FIFOEnabled()

bool MPU6050::getSlave3FIFOEnabled ( )
inline

Get Slave 3 FIFO enabled value. When set to 1, this bit enables EXT_SENS_DATA registers (Registers 73 to 96) associated with Slave 3 to be written into the FIFO buffer.

Returns
Current Slave 3 FIFO enabled value
See also
MPU6050_RA_MST_CTRL

◆ getSlave3Nack()

bool MPU6050::getSlave3Nack ( )
inline

Get Slave 3 NACK status. This bit automatically sets to 1 when the I2C Master receives a NACK in a transaction with Slave 3. This triggers an interrupt if the I2C_MST_INT_EN bit in the INT_ENABLE register (Register 56) is asserted.

Returns
Slave 3 NACK interrupt status
See also
MPU6050_RA_I2C_MST_STATUS

◆ getSlave4Address()

uint8_t MPU6050::getSlave4Address ( )
inline

Get the I2C address of Slave 4. Note that Bit 7 (MSB) controls read/write mode. If Bit 7 is set, it's a read operation, and if it is cleared, then it's a write operation. The remaining bits (6-0) are the 7-bit device address of the slave device.

Returns
Current address for Slave 4
See also
getSlaveAddress()
MPU6050_RA_I2C_SLV4_ADDR

◆ getSlave4Enabled()

bool MPU6050::getSlave4Enabled ( )
inline

Get the enabled value for the Slave 4. When set to 1, this bit enables Slave 4 for data transfer operations. When cleared to 0, this bit disables Slave 4 from data transfer operations.

Returns
Current enabled value for Slave 4
See also
MPU6050_RA_I2C_SLV4_CTRL

◆ getSlave4InterruptEnabled()

bool MPU6050::getSlave4InterruptEnabled ( )
inline

Get the enabled value for Slave 4 transaction interrupts. When set to 1, this bit enables the generation of an interrupt signal upon completion of a Slave 4 transaction. When cleared to 0, this bit disables the generation of an interrupt signal upon completion of a Slave 4 transaction. The interrupt status can be observed in Register 54.

Returns
Current enabled value for Slave 4 transaction interrupts.
See also
MPU6050_RA_I2C_SLV4_CTRL

◆ getSlave4IsDone()

bool MPU6050::getSlave4IsDone ( )
inline

Get Slave 4 transaction done status. Automatically sets to 1 when a Slave 4 transaction has completed. This triggers an interrupt if the I2C_MST_INT_EN bit in the INT_ENABLE register (Register 56) is asserted and if the SLV_4_DONE_INT bit is asserted in the I2C_SLV4_CTRL register (Register 52).

Returns
Slave 4 transaction done status
See also
MPU6050_RA_I2C_MST_STATUS

◆ getSlave4MasterDelay()

uint8_t MPU6050::getSlave4MasterDelay ( )
inline

Get Slave 4 master delay value. This configures the reduced access rate of I2C slaves relative to the Sample Rate. When a slave's access rate is decreased relative to the Sample Rate, the slave is accessed every:

1 / (1 + I2C_MST_DLY) samples

This base Sample Rate in turn is determined by SMPLRT_DIV (register 25) and DLPF_CFG (register 26). Whether a slave's access rate is reduced relative to the Sample Rate is determined by I2C_MST_DELAY_CTRL (register 103). For further information regarding the Sample Rate, please refer to register 25.

Returns
Current Slave 4 master delay value
See also
MPU6050_RA_I2C_SLV4_CTRL

◆ getSlave4Nack()

bool MPU6050::getSlave4Nack ( )
inline

Get Slave 4 NACK status. This bit automatically sets to 1 when the I2C Master receives a NACK in a transaction with Slave 4. This triggers an interrupt if the I2C_MST_INT_EN bit in the INT_ENABLE register (Register 56) is asserted.

Returns
Slave 4 NACK interrupt status
See also
MPU6050_RA_I2C_MST_STATUS

◆ getSlave4Register()

uint8_t MPU6050::getSlave4Register ( )
inline

Get the active internal register for the Slave 4. Read/write operations for this slave will be done to whatever internal register address is stored in this MPU register.

Returns
Current active register for Slave 4
See also
MPU6050_RA_I2C_SLV4_REG

◆ getSlave4WriteMode()

bool MPU6050::getSlave4WriteMode ( )
inline

Get write mode for Slave 4. When set to 1, the transaction will read or write data only. When cleared to 0, the transaction will write a register address prior to reading or writing data. This should equal 0 when specifying the register address within the Slave device to/from which the ensuing data transaction will take place.

Returns
Current write mode for Slave 4 (0 = register address + data, 1 = data only)
See also
MPU6050_RA_I2C_SLV4_CTRL

◆ getSlaveAddress()

uint8_t MPU6050::getSlaveAddress ( SlaveId  slaveId)

Get the I2C address of the specified slave (0-3). Note that Bit 7 (MSB) controls read/write mode. If Bit 7 is set, it's a read operation, and if it is cleared, then it's a write operation. The remaining bits (6-0) are the 7-bit device address of the slave device.

In read mode, the result of the read is placed in the lowest available EXT_SENS_DATA register. For further information regarding the allocation of read results, please refer to the EXT_SENS_DATA register description (Registers 73 - 96).

The MPU-6050 supports a total of five slaves, but Slave 4 has unique characteristics, and so it has its own functions (getSlave4* and setSlave4*).

I2C data transactions are performed at the Sample Rate, as defined in Register 25. The user is responsible for ensuring that I2C data transactions to and from each enabled Slave can be completed within a single period of the Sample Rate.

The I2C slave access rate can be reduced relative to the Sample Rate. This reduced access rate is determined by I2C_MST_DLY (Register 52). Whether a slave's access rate is reduced relative to the Sample Rate is determined by I2C_MST_DELAY_CTRL (Register 103).

The processing order for the slaves is fixed. The sequence followed for processing the slaves is Slave 0, Slave 1, Slave 2, Slave 3 and Slave 4. If a particular Slave is disabled it will be skipped.

Each slave can either be accessed at the sample rate or at a reduced sample rate. In a case where some slaves are accessed at the Sample Rate and some slaves are accessed at the reduced rate, the sequence of accessing the slaves (Slave 0 to Slave 4) is still followed. However, the reduced rate slaves will be skipped if their access rate dictates that they should not be accessed during that particular cycle. For further information regarding the reduced access rate, please refer to Register 52. Whether a slave is accessed at the Sample Rate or at the reduced rate is determined by the Delay Enable bits in Register 103.

Parameters
slaveIdSlave ID (0-3)
Returns
Current address for specified slave
See also
MPU6050_RA_I2C_SLV0_ADDR

◆ getSlaveDataLength()

uint8_t MPU6050::getSlaveDataLength ( SlaveId  slaveId)

Get number of bytes to read for the specified slave (0-3). Specifies the number of bytes transferred to and from Slave 0. Clearing this bit to 0 is equivalent to disabling the register by writing 0 to I2C_SLV0_EN.

Parameters
slaveIdSlave ID (0-3)
Returns
Number of bytes to read for specified slave
See also
MPU6050_RA_I2C_SLV0_CTRL

◆ getSlaveDelayEnabled()

bool MPU6050::getSlaveDelayEnabled ( SlaveId  slaveId)

Get slave delay enabled status. When a particular slave delay is enabled, the rate of access for the that slave device is reduced. When a slave's access rate is decreased relative to the Sample Rate, the slave is accessed every:

1 / (1 + I2C_MST_DLY) Samples

This base Sample Rate in turn is determined by SMPLRT_DIV (register * 25) and DLPF_CFG (register 26).

For further information regarding I2C_MST_DLY, please refer to register 52. For further information regarding the Sample Rate, please refer to register 25.

Parameters
slaveIdSlave ID (0-4)
Returns
Current slave delay enabled status.
See also
MPU6050_RA_I2C_MST_DELAY_CTRL
MPU6050_DELAYCTRL_I2C_SLV0_DLY_EN_BIT

◆ getSlaveEnabled()

bool MPU6050::getSlaveEnabled ( SlaveId  slaveId)

Get the enabled value for the specified slave (0-3). When set to 1, this bit enables Slave 0 for data transfer operations. When cleared to 0, this bit disables Slave 0 from data transfer operations.

Parameters
slaveIdSlave ID (0-3)
Returns
Current enabled value for specified slave
See also
MPU6050_RA_I2C_SLV0_CTRL

◆ getSlaveReadWriteTransitionEnabled()

bool MPU6050::getSlaveReadWriteTransitionEnabled ( )
inline

Get slave read/write transition enabled value. The I2C_MST_P_NSR bit configures the I2C Master's transition from one slave read to the next slave read. If the bit equals 0, there will be a restart between reads. If the bit equals 1, there will be a stop followed by a start of the following read. When a write transaction follows a read transaction, the stop followed by a start of the successive write will be always used.

Returns
Current slave read/write transition enabled value
See also
MPU6050_RA_I2C_MST_CTRL

◆ getSlaveRegister()

uint8_t MPU6050::getSlaveRegister ( SlaveId  slaveId)

Get the active internal register for the specified slave (0-3). Read/write operations for this slave will be done to whatever internal register address is stored in this MPU register.

The MPU-6050 supports a total of five slaves, but Slave 4 has unique characteristics, and so it has its own functions.

Parameters
slaveIdSlave ID (0-3)
Returns
Current active register for specified slave
See also
MPU6050_RA_I2C_SLV0_REG

◆ getSlaveWordByteSwap()

bool MPU6050::getSlaveWordByteSwap ( SlaveId  slaveId)

Get word pair byte-swapping enabled for the specified slave (0-3). When set to 1, this bit enables byte swapping. When byte swapping is enabled, the high and low bytes of a word pair are swapped. Please refer to I2C_SLV0_GRP for the pairing convention of the word pairs. When cleared to 0, bytes transferred to and from Slave 0 will be written to EXT_SENS_DATA registers in the order they were transferred.

Parameters
slaveIdSlave ID (0-3)
Returns
Current word pair byte-swapping enabled value for specified slave
See also
MPU6050_RA_I2C_SLV0_CTRL

◆ getSlaveWordGroupOffset()

bool MPU6050::getSlaveWordGroupOffset ( SlaveId  slaveId)

Get word pair grouping order offset for the specified slave (0-3). This sets specifies the grouping order of word pairs received from registers. When cleared to 0, bytes from register addresses 0 and 1, 2 and 3, etc (even, then odd register addresses) are paired to form a word. When set to 1, bytes from register addresses are paired 1 and 2, 3 and 4, etc. (odd, then even register addresses) are paired to form a word.

Parameters
slaveIdSlave ID (0-3)
Returns
Current word pair grouping order offset for specified slave
See also
MPU6050_RA_I2C_SLV0_CTRL

◆ getSlaveWriteMode()

bool MPU6050::getSlaveWriteMode ( SlaveId  slaveId)

Get write mode for the specified slave (0-3). When set to 1, the transaction will read or write data only. When cleared to 0, the transaction will write a register address prior to reading or writing data. This should equal 0 when specifying the register address within the Slave device to/from which the ensuing data transaction will take place.

Parameters
slaveIdSlave ID (0-3)
Returns
Current write mode for specified slave (0 = register address + data, 1 = data only)
See also
MPU6050_RA_I2C_SLV0_CTRL

◆ getSleepEnabled()

bool MPU6050::getSleepEnabled ( )
inline

Get sleep mode status. Setting the SLEEP bit in the register puts the device into very low power sleep mode. In this mode, only the serial interface and internal registers remain active, allowing for a very low standby current. Clearing this bit puts the device back into normal mode. To save power, the individual standby selections for each of the gyros should be used if any gyro axis is not used by the application.

Returns
Current sleep mode enabled status
See also
MPU6050_RA_PWR_MGMT_1
MPU6050_PWR1_SLEEP_BIT

◆ getStandbyXAccelEnabled()

bool MPU6050::getStandbyXAccelEnabled ( )
inline

Get X-axis accelerometer standby enabled status. If enabled, the X-axis will not gather or report data (or use power).

Returns
Current X-axis standby enabled status
See also
MPU6050_RA_PWR_MGMT_2
MPU6050_PWR2_STBY_XA_BIT

◆ getStandbyXGyroEnabled()

bool MPU6050::getStandbyXGyroEnabled ( )
inline

Get X-axis gyroscope standby enabled status. If enabled, the X-axis will not gather or report data (or use power).

Returns
Current X-axis standby enabled status
See also
MPU6050_RA_PWR_MGMT_2
MPU6050_PWR2_STBY_XG_BIT

◆ getStandbyYAccelEnabled()

bool MPU6050::getStandbyYAccelEnabled ( )
inline

Get Y-axis accelerometer standby enabled status. If enabled, the Y-axis will not gather or report data (or use power).

Returns
Current Y-axis standby enabled status
See also
MPU6050_RA_PWR_MGMT_2
MPU6050_PWR2_STBY_YA_BIT

◆ getStandbyYGyroEnabled()

bool MPU6050::getStandbyYGyroEnabled ( )
inline

Get Y-axis gyroscope standby enabled status. If enabled, the Y-axis will not gather or report data (or use power).

Returns
Current Y-axis standby enabled status
See also
MPU6050_RA_PWR_MGMT_2
MPU6050_PWR2_STBY_YG_BIT

◆ getStandbyZAccelEnabled()

bool MPU6050::getStandbyZAccelEnabled ( )
inline

Get Z-axis accelerometer standby enabled status. If enabled, the Z-axis will not gather or report data (or use power).

Returns
Current Z-axis standby enabled status
See also
MPU6050_RA_PWR_MGMT_2
MPU6050_PWR2_STBY_ZA_BIT

◆ getStandbyZGyroEnabled()

bool MPU6050::getStandbyZGyroEnabled ( )
inline

Get Z-axis gyroscope standby enabled status. If enabled, the Z-axis will not gather or report data (or use power).

Returns
Current Z-axis standby enabled status
See also
MPU6050_RA_PWR_MGMT_2
MPU6050_PWR2_STBY_ZG_BIT

◆ getTemperature()

int16_t MPU6050::getTemperature ( )
inline

Get current internal temperature.

Returns
Temperature reading in 16-bit 2's complement format
See also
MPU6050_RA_TEMP_OUT_H

◆ getTempFIFOEnabled()

bool MPU6050::getTempFIFOEnabled ( )
inline

Get temperature FIFO enabled value. When set to 1, this bit enables TEMP_OUT_H and TEMP_OUT_L (Registers 65 and 66) to be written into the FIFO buffer.

Returns
Current temperature FIFO enabled value
See also
MPU6050_RA_FIFO_EN

◆ getTempSensorEnabled()

bool MPU6050::getTempSensorEnabled ( )
inline

Get temperature sensor enabled status. Control the usage of the internal temperature sensor.

Note: this register stores the disabled value, but for consistency with the rest of the code, the function is named and used with standard true/false values to indicate whether the sensor is enabled or disabled, respectively.

Returns
Current temperature sensor enabled status
See also
MPU6050_RA_PWR_MGMT_1
MPU6050_PWR1_TEMP_DIS_BIT

◆ getWaitForExternalSensorEnabled()

bool MPU6050::getWaitForExternalSensorEnabled ( )
inline

Get wait-for-external-sensor-data enabled value. When the WAIT_FOR_ES bit is set to 1, the Data Ready interrupt will be delayed until External Sensor data from the Slave Devices are loaded into the EXT_SENS_DATA registers. This is used to ensure that both the internal sensor data (i.e. from gyro and accel) and external sensor data have been loaded to their respective data registers (i.e. the data is synced) when the Data Ready interrupt is triggered.

Returns
Current wait-for-external-sensor-data enabled value
See also
MPU6050_RA_I2C_MST_CTRL

◆ getWakeCycleEnabled()

bool MPU6050::getWakeCycleEnabled ( )
inline

Get wake cycle enabled status. When this bit is set to 1 and SLEEP is disabled, the MPU-60X0 will cycle between sleep mode and waking up to take a single sample of data from active sensors at a rate determined by LP_WAKE_CTRL (register 108).

Returns
Current sleep mode enabled status
See also
MPU6050_RA_PWR_MGMT_1
MPU6050_PWR1_CYCLE_BIT

◆ getWakeFrequency()

uint8_t MPU6050::getWakeFrequency ( )
inline

Get wake frequency in Accel-Only Low Power Mode. The MPU-60X0 can be put into Accerlerometer Only Low Power Mode by setting PWRSEL to 1 in the Power Management 1 register (Register 107). In this mode, the device will power off all devices except for the primary I2C interface, waking only the accelerometer at fixed intervals to take a single measurement. The frequency of wake-ups can be configured with LP_WAKE_CTRL as shown below:

LP_WAKE_CTRL | Wake-up Frequency
-------------+------------------
0            | 1.25 Hz
1            | 2.5 Hz
2            | 5 Hz
3            | 10 Hz

For further information regarding the MPU-60X0's power modes, please refer to Register 107.

Returns
Current wake frequency
See also
MPU6050_RA_PWR_MGMT_2

◆ getXAccelOffset()

int16_t MPU6050::getXAccelOffset ( )

◆ getXFineGain()

int8_t MPU6050::getXFineGain ( )
inline

◆ getXGyroFIFOEnabled()

bool MPU6050::getXGyroFIFOEnabled ( )
inline

Get gyroscope X-axis FIFO enabled value. When set to 1, this bit enables GYRO_XOUT_H and GYRO_XOUT_L (Registers 67 and 68) to be written into the FIFO buffer.

Returns
Current gyroscope X-axis FIFO enabled value
See also
MPU6050_RA_FIFO_EN

◆ getXGyroOffset()

int16_t MPU6050::getXGyroOffset ( )
inline

◆ getXGyroOffsetTC()

int8_t MPU6050::getXGyroOffsetTC ( )
inline

◆ getXNegMotionDetected()

bool MPU6050::getXNegMotionDetected ( )
inline

Get X-axis negative motion detection interrupt status.

Returns
Motion detection status
See also
MPU6050_RA_MOT_DETECT_STATUS
MPU6050_MOTION_MOT_XNEG_BIT

◆ getXPosMotionDetected()

bool MPU6050::getXPosMotionDetected ( )
inline

Get X-axis positive motion detection interrupt status.

Returns
Motion detection status
See also
MPU6050_RA_MOT_DETECT_STATUS
MPU6050_MOTION_MOT_XPOS_BIT

◆ getYAccelOffset()

int16_t MPU6050::getYAccelOffset ( )

◆ getYFineGain()

int8_t MPU6050::getYFineGain ( )
inline

◆ getYGyroFIFOEnabled()

bool MPU6050::getYGyroFIFOEnabled ( )
inline

Get gyroscope Y-axis FIFO enabled value. When set to 1, this bit enables GYRO_YOUT_H and GYRO_YOUT_L (Registers 69 and 70) to be written into the FIFO buffer.

Returns
Current gyroscope Y-axis FIFO enabled value
See also
MPU6050_RA_FIFO_EN

◆ getYGyroOffset()

int16_t MPU6050::getYGyroOffset ( )
inline

◆ getYGyroOffsetTC()

int8_t MPU6050::getYGyroOffsetTC ( )
inline

◆ getYNegMotionDetected()

bool MPU6050::getYNegMotionDetected ( )
inline

Get Y-axis negative motion detection interrupt status.

Returns
Motion detection status
See also
MPU6050_RA_MOT_DETECT_STATUS
MPU6050_MOTION_MOT_YNEG_BIT

◆ getYPosMotionDetected()

bool MPU6050::getYPosMotionDetected ( )
inline

Get Y-axis positive motion detection interrupt status.

Returns
Motion detection status
See also
MPU6050_RA_MOT_DETECT_STATUS
MPU6050_MOTION_MOT_YPOS_BIT

◆ getZAccelOffset()

int16_t MPU6050::getZAccelOffset ( )

◆ getZeroMotionDetected()

bool MPU6050::getZeroMotionDetected ( )
inline

Get zero motion detection interrupt status.

Returns
Motion detection status
See also
MPU6050_RA_MOT_DETECT_STATUS
MPU6050_MOTION_MOT_ZRMOT_BIT

◆ getZeroMotionDetectionDuration()

uint8_t MPU6050::getZeroMotionDetectionDuration ( )
inline

Get zero motion detection event duration threshold. This register configures the duration counter threshold for Zero Motion interrupt generation. The duration counter ticks at 16 Hz, therefore ZRMOT_DUR has a unit of 1 LSB = 64 ms. The Zero Motion duration counter increments while the absolute value of the accelerometer measurements are each less than the detection threshold (Register 33). The Zero Motion interrupt is triggered when the Zero Motion duration counter reaches the time count specified in this register.

For more details on the Zero Motion detection interrupt, see Section 8.4 of the MPU-6000/MPU-6050 Product Specification document, as well as Registers 56 and 58 of this document.

Returns
Current zero motion detection duration threshold value (LSB = 64ms)
See also
MPU6050_RA_ZRMOT_DUR

◆ getZeroMotionDetectionThreshold()

uint8_t MPU6050::getZeroMotionDetectionThreshold ( )
inline

Get zero motion detection event acceleration threshold. This register configures the detection threshold for Zero Motion interrupt generation. The unit of ZRMOT_THR is 1LSB = 2mg. Zero Motion is detected when the absolute value of the accelerometer measurements for the 3 axes are each less than the detection threshold. This condition increments the Zero Motion duration counter (Register 34). The Zero Motion interrupt is triggered when the Zero Motion duration counter reaches the time count specified in ZRMOT_DUR (Register 34).

Unlike Free Fall or Motion detection, Zero Motion detection triggers an interrupt both when Zero Motion is first detected and when Zero Motion is no longer detected.

When a zero motion event is detected, a Zero Motion Status will be indicated in the MOT_DETECT_STATUS register (Register 97). When a motion-to-zero-motion condition is detected, the status bit is set to 1. When a zero-motion-to- motion condition is detected, the status bit is set to 0.

For more details on the Zero Motion detection interrupt, see Section 8.4 of the MPU-6000/MPU-6050 Product Specification document as well as Registers 56 and 58 of this document.

Returns
Current zero motion detection acceleration threshold value (LSB = 2mg)
See also
MPU6050_RA_ZRMOT_THR

◆ getZFineGain()

int8_t MPU6050::getZFineGain ( )
inline

◆ getZGyroFIFOEnabled()

bool MPU6050::getZGyroFIFOEnabled ( )
inline

Get gyroscope Z-axis FIFO enabled value. When set to 1, this bit enables GYRO_ZOUT_H and GYRO_ZOUT_L (Registers 71 and 72) to be written into the FIFO buffer.

Returns
Current gyroscope Z-axis FIFO enabled value
See also
MPU6050_RA_FIFO_EN

◆ getZGyroOffset()

int16_t MPU6050::getZGyroOffset ( )
inline

◆ getZGyroOffsetTC()

int8_t MPU6050::getZGyroOffsetTC ( )
inline

◆ getZNegMotionDetected()

bool MPU6050::getZNegMotionDetected ( )
inline

Get Z-axis negative motion detection interrupt status.

Returns
Motion detection status
See also
MPU6050_RA_MOT_DETECT_STATUS
MPU6050_MOTION_MOT_ZNEG_BIT

◆ getZPosMotionDetected()

bool MPU6050::getZPosMotionDetected ( )
inline

Get Z-axis positive motion detection interrupt status.

Returns
Motion detection status
See also
MPU6050_RA_MOT_DETECT_STATUS
MPU6050_MOTION_MOT_ZPOS_BIT

◆ initialize()

void MPU6050::initialize ( )

Power on and prepare for general usage. This will activate the device and take it out of sleep mode (which must be done after start-up). This function also sets both the accelerometer and the gyroscope to their most sensitive settings, namely +/- 2g and +/- 250 degrees/sec, and sets the clock source to use the X Gyro for reference, which is slightly better than the default internal clock source.

◆ readMemoryByte()

uint8_t MPU6050::readMemoryByte ( )
inline

◆ reset()

void MPU6050::reset ( )
inline

Trigger a full device reset. A small delay of ~50ms may be desirable after triggering a reset.

See also
MPU6050_RA_PWR_MGMT_1
MPU6050_PWR1_DEVICE_RESET_BIT

◆ resetAccelerometerPath()

void MPU6050::resetAccelerometerPath ( )
inline

Reset accelerometer signal path. The reset will revert the signal path analog to digital converters and filters to their power up configurations.

See also
MPU6050_RA_SIGNAL_PATH_RESET
MPU6050_PATHRESET_ACCEL_RESET_BIT

◆ resetDMP()

void MPU6050::resetDMP ( )
inline

◆ resetFIFO()

void MPU6050::resetFIFO ( )
inline

Reset the FIFO. This bit resets the FIFO buffer when set to 1 while FIFO_EN equals 0. This bit automatically clears to 0 after the reset has been triggered.

See also
MPU6050_RA_USER_CTRL
MPU6050_USERCTRL_FIFO_RESET_BIT

◆ resetGyroscopePath()

void MPU6050::resetGyroscopePath ( )
inline

Reset gyroscope signal path. The reset will revert the signal path analog to digital converters and filters to their power up configurations.

See also
MPU6050_RA_SIGNAL_PATH_RESET
MPU6050_PATHRESET_GYRO_RESET_BIT

◆ resetI2CMaster()

void MPU6050::resetI2CMaster ( )
inline

Reset the I2C Master. This bit resets the I2C Master when set to 1 while I2C_MST_EN equals 0. This bit automatically clears to 0 after the reset has been triggered.

See also
MPU6050_RA_USER_CTRL
MPU6050_USERCTRL_I2C_MST_RESET_BIT

◆ resetSensors()

void MPU6050::resetSensors ( )
inline

Reset all sensor registers and signal paths. When set to 1, this bit resets the signal paths for all sensors (gyroscopes, accelerometers, and temperature sensor). This operation will also clear the sensor registers. This bit automatically clears to 0 after the reset has been triggered.

When resetting only the signal path (and not the sensor registers), please use Register 104, SIGNAL_PATH_RESET.

See also
MPU6050_RA_USER_CTRL
MPU6050_USERCTRL_SIG_COND_RESET_BIT

◆ resetTemperaturePath()

void MPU6050::resetTemperaturePath ( )
inline

Reset temperature sensor signal path. The reset will revert the signal path analog to digital converters and filters to their power up configurations.

See also
MPU6050_RA_SIGNAL_PATH_RESET
MPU6050_PATHRESET_TEMP_RESET_BIT

◆ setAccelerometerPowerOnDelay()

void MPU6050::setAccelerometerPowerOnDelay ( uint8_t  delay)
inline

Set accelerometer power-on delay.

Parameters
delayNew accelerometer power-on delay (0-3)
See also
getAccelerometerPowerOnDelay()
MPU6050_RA_MOT_DETECT_CTRL
MPU6050_DETECT_ACCEL_ON_DELAY_BIT

◆ setAccelFIFOEnabled()

void MPU6050::setAccelFIFOEnabled ( bool  enabled)
inline

Set accelerometer FIFO enabled value.

Parameters
enabledNew accelerometer FIFO enabled value
See also
getAccelFIFOEnabled()
MPU6050_RA_FIFO_EN

◆ setAccelXSelfTest()

void MPU6050::setAccelXSelfTest ( bool  enabled)
inline

Get self-test enabled setting for accelerometer X axis.

Parameters
enabledSelf-test enabled value
See also
MPU6050_RA_ACCEL_CONFIG

◆ setAccelYSelfTest()

void MPU6050::setAccelYSelfTest ( bool  enabled)
inline

Get self-test enabled value for accelerometer Y axis.

Parameters
enabledSelf-test enabled value
See also
MPU6050_RA_ACCEL_CONFIG

◆ setAccelZSelfTest()

void MPU6050::setAccelZSelfTest ( bool  enabled)
inline

Set self-test enabled value for accelerometer Z axis.

Parameters
enabledSelf-test enabled value
See also
MPU6050_RA_ACCEL_CONFIG

◆ setAuxVDDIOLevel()

void MPU6050::setAuxVDDIOLevel ( uint8_t  level)
inline

Set the auxiliary I2C supply voltage level. When set to 1, the auxiliary I2C bus high logic level is VDD. When cleared to 0, the auxiliary I2C bus high logic level is VLOGIC. This does not apply to the MPU-6000, which does not have a VLOGIC pin.

Parameters
levelI2C supply voltage level (0=VLOGIC, 1=VDD)

◆ setClockOutputEnabled()

void MPU6050::setClockOutputEnabled ( bool  enabled)
inline

Set reference clock output enabled status. When this bit is equal to 1, a reference clock output is provided at the CLKOUT pin. When this bit is equal to 0, the clock output is disabled. For further information regarding CLKOUT, please refer to the MPU-60X0 Product Specification document.

Parameters
enabledNew reference clock output enabled status
See also
MPU6050_RA_INT_PIN_CFG
MPU6050_INTCFG_CLKOUT_EN_BIT

◆ setClockSource()

void MPU6050::setClockSource ( uint8_t  source)
inline

Set clock source setting. An internal 8MHz oscillator, gyroscope based clock, or external sources can be selected as the MPU-60X0 clock source. When the internal 8 MHz oscillator or an external source is chosen as the clock source, the MPU-60X0 can operate in low power modes with the gyroscopes disabled.

Upon power up, the MPU-60X0 clock source defaults to the internal oscillator. However, it is highly recommended that the device be configured to use one of the gyroscopes (or an external clock source) as the clock reference for improved stability. The clock source can be selected according to the following table:

CLK_SEL | Clock Source
--------+--------------------------------------
0       | Internal oscillator
1       | PLL with X Gyro reference
2       | PLL with Y Gyro reference
3       | PLL with Z Gyro reference
4       | PLL with external 32.768kHz reference
5       | PLL with external 19.2MHz reference
6       | Reserved
7       | Stops the clock and keeps the timing generator in reset
Parameters
sourceNew clock source setting
See also
getClockSource()
MPU6050_RA_PWR_MGMT_1
MPU6050_PWR1_CLKSEL_BIT
MPU6050_PWR1_CLKSEL_LENGTH

◆ setDeviceID()

void MPU6050::setDeviceID ( uint8_t  id)
inline

Set Device ID. Write a new ID into the WHO_AM_I register (no idea why this should ever be necessary though).

Parameters
idNew device ID to set.
See also
getDeviceID()
MPU6050_RA_WHO_AM_I
MPU6050_WHO_AM_I_BIT
MPU6050_WHO_AM_I_LENGTH

◆ setDHPFMode()

void MPU6050::setDHPFMode ( uint8_t  bandwidth)
inline

Set the high-pass filter configuration.

Parameters
bandwidthNew high-pass filter configuration
See also
setDHPFMode()
MPU6050_DHPF_RESET
MPU6050_RA_ACCEL_CONFIG

◆ setDLPFMode()

void MPU6050::setDLPFMode ( uint8_t  mode)
inline

Set digital low-pass filter configuration.

Parameters
modeNew DLFP configuration setting
See also
getDLPFBandwidth()
MPU6050_DLPF_BW_256
MPU6050_RA_CONFIG
MPU6050_CFG_DLPF_CFG_BIT
MPU6050_CFG_DLPF_CFG_LENGTH

◆ setDMPConfig1()

void MPU6050::setDMPConfig1 ( uint8_t  config)
inline

◆ setDMPConfig2()

void MPU6050::setDMPConfig2 ( uint8_t  config)
inline

◆ setDMPEnabled()

void MPU6050::setDMPEnabled ( bool  enabled)
inline

◆ setExternalFrameSync()

void MPU6050::setExternalFrameSync ( uint8_t  sync)
inline

Set external FSYNC configuration.

See also
getExternalFrameSync()
MPU6050_RA_CONFIG
Parameters
syncNew FSYNC configuration value

◆ setExternalShadowDelayEnabled()

void MPU6050::setExternalShadowDelayEnabled ( bool  enabled)
inline

Set external data shadow delay enabled status.

Parameters
enabledNew external data shadow delay enabled status.
See also
getExternalShadowDelayEnabled()
MPU6050_RA_I2C_MST_DELAY_CTRL
MPU6050_DELAYCTRL_DELAY_ES_SHADOW_BIT

◆ setFIFOByte()

void MPU6050::setFIFOByte ( uint8_t  data)
inline

Write byte to FIFO buffer.

See also
getFIFOByte()
MPU6050_RA_FIFO_R_W

◆ setFIFOEnabled()

void MPU6050::setFIFOEnabled ( bool  enabled)
inline

Set FIFO enabled status.

Parameters
enabledNew FIFO enabled status
See also
getFIFOEnabled()
MPU6050_RA_USER_CTRL
MPU6050_USERCTRL_FIFO_EN_BIT

◆ setFreefallDetectionCounterDecrement()

void MPU6050::setFreefallDetectionCounterDecrement ( uint8_t  decrement)
inline

Set Free Fall detection counter decrement configuration.

Parameters
decrementNew decrement configuration value
See also
getFreefallDetectionCounterDecrement()
MPU6050_RA_MOT_DETECT_CTRL
MPU6050_DETECT_FF_COUNT_BIT

◆ setFreefallDetectionDuration()

void MPU6050::setFreefallDetectionDuration ( uint8_t  duration)
inline

Get free-fall event duration threshold.

Parameters
durationNew free-fall duration threshold value (LSB = 1ms)
See also
getFreefallDetectionDuration()
MPU6050_RA_FF_DUR

◆ setFreefallDetectionThreshold()

void MPU6050::setFreefallDetectionThreshold ( uint8_t  threshold)
inline

Get free-fall event acceleration threshold.

Parameters
thresholdNew free-fall acceleration threshold value (LSB = 2mg)
See also
getFreefallDetectionThreshold()
MPU6050_RA_FF_THR

◆ setFSyncInterruptEnabled()

void MPU6050::setFSyncInterruptEnabled ( bool  enabled)
inline

Set FSYNC pin interrupt enabled setting.

Parameters
enabledNew FSYNC pin interrupt enabled setting
See also
getFSyncInterruptEnabled()
MPU6050_RA_INT_PIN_CFG
MPU6050_INTCFG_FSYNC_INT_EN_BIT

◆ setFSyncInterruptLevel()

void MPU6050::setFSyncInterruptLevel ( bool  level)
inline

Set FSYNC interrupt logic level mode.

Parameters
modeNew FSYNC interrupt mode (0=active-high, 1=active-low)
See also
getFSyncInterruptMode()
MPU6050_RA_INT_PIN_CFG
MPU6050_INTCFG_FSYNC_INT_LEVEL_BIT

◆ setFullScaleAccelRange()

void MPU6050::setFullScaleAccelRange ( uint8_t  range)
inline

Set full-scale accelerometer range.

Parameters
rangeNew full-scale accelerometer range setting
See also
getFullScaleAccelRange()

◆ setFullScaleGyroRange()

void MPU6050::setFullScaleGyroRange ( uint8_t  range)
inline

Set full-scale gyroscope range.

Parameters
rangeNew full-scale gyroscope range value
See also
getFullScaleRange()
MPU6050_GYRO_FS_250
MPU6050_RA_GYRO_CONFIG
MPU6050_GCONFIG_FS_SEL_BIT
MPU6050_GCONFIG_FS_SEL_LENGTH

◆ setI2CBypassEnabled()

void MPU6050::setI2CBypassEnabled ( bool  enabled)
inline

Set I2C bypass enabled status. When this bit is equal to 1 and I2C_MST_EN (Register 106 bit[5]) is equal to 0, the host application processor will be able to directly access the auxiliary I2C bus of the MPU-60X0. When this bit is equal to 0, the host application processor will not be able to directly access the auxiliary I2C bus of the MPU-60X0 regardless of the state of I2C_MST_EN (Register 106 bit[5]).

Parameters
enabledNew I2C bypass enabled status
See also
MPU6050_RA_INT_PIN_CFG
MPU6050_INTCFG_I2C_BYPASS_EN_BIT

◆ setI2CMasterModeEnabled()

void MPU6050::setI2CMasterModeEnabled ( bool  enabled)
inline

Set I2C Master Mode enabled status.

Parameters
enabledNew I2C Master Mode enabled status
See also
getI2CMasterModeEnabled()
MPU6050_RA_USER_CTRL
MPU6050_USERCTRL_I2C_MST_EN_BIT

◆ setIntDataReadyEnabled()

void MPU6050::setIntDataReadyEnabled ( bool  enabled)
inline

Set Data Ready interrupt enabled status.

Parameters
enabledNew interrupt enabled status
See also
getIntDataReadyEnabled()
MPU6050_RA_INT_CFG
MPU6050_INTERRUPT_DATA_RDY_BIT

◆ setIntDMPEnabled()

void MPU6050::setIntDMPEnabled ( bool  enabled)
inline

◆ setIntEnabled()

void MPU6050::setIntEnabled ( uint8_t  enabled)
inline

Set full interrupt enabled status. Full register byte for all interrupts, for quick reading. Each bit should be set 0 for disabled, 1 for enabled.

Parameters
enabledNew interrupt enabled status
See also
getIntFreefallEnabled()
MPU6050_RA_INT_ENABLE
MPU6050_INTERRUPT_FF_BIT

◆ setInterruptDrive()

void MPU6050::setInterruptDrive ( bool  drive)
inline

Set interrupt drive mode.

Parameters
driveNew interrupt drive mode (0=push-pull, 1=open-drain)
See also
getInterruptDrive()
MPU6050_RA_INT_PIN_CFG
MPU6050_INTCFG_INT_OPEN_BIT

◆ setInterruptLatch()

void MPU6050::setInterruptLatch ( bool  latch)
inline

Set interrupt latch mode.

Parameters
latchNew latch mode (0=50us-pulse, 1=latch-until-int-cleared)
See also
getInterruptLatch()
MPU6050_RA_INT_PIN_CFG
MPU6050_INTCFG_LATCH_INT_EN_BIT

◆ setInterruptLatchClear()

void MPU6050::setInterruptLatchClear ( bool  clear)
inline

Set interrupt latch clear mode.

Parameters
clearNew latch clear mode (0=status-read-only, 1=any-register-read)
See also
getInterruptLatchClear()
MPU6050_RA_INT_PIN_CFG
MPU6050_INTCFG_INT_RD_CLEAR_BIT

◆ setInterruptMode()

void MPU6050::setInterruptMode ( bool  mode)
inline

Set interrupt logic level mode.

Parameters
modeNew interrupt mode (0=active-high, 1=active-low)
See also
getInterruptMode()
MPU6050_RA_INT_PIN_CFG
MPU6050_INTCFG_INT_LEVEL_BIT

◆ setIntFIFOBufferOverflowEnabled()

void MPU6050::setIntFIFOBufferOverflowEnabled ( bool  enabled)
inline

Set FIFO Buffer Overflow interrupt enabled status.

Parameters
enabledNew interrupt enabled status
See also
getIntFIFOBufferOverflowEnabled()
MPU6050_RA_INT_ENABLE
MPU6050_INTERRUPT_FIFO_OFLOW_BIT

◆ setIntFreefallEnabled()

void MPU6050::setIntFreefallEnabled ( bool  enabled)
inline

Set Free Fall interrupt enabled status.

Parameters
enabledNew interrupt enabled status
See also
getIntFreefallEnabled()
MPU6050_RA_INT_ENABLE
MPU6050_INTERRUPT_FF_BIT

◆ setIntI2CMasterEnabled()

void MPU6050::setIntI2CMasterEnabled ( bool  enabled)
inline

Set I2C Master interrupt enabled status.

Parameters
enabledNew interrupt enabled status
See also
getIntI2CMasterEnabled()
MPU6050_RA_INT_ENABLE
MPU6050_INTERRUPT_I2C_MST_INT_BIT

◆ setIntMotionEnabled()

void MPU6050::setIntMotionEnabled ( bool  enabled)
inline

Set Motion Detection interrupt enabled status.

Parameters
enabledNew interrupt enabled status
See also
getIntMotionEnabled()
MPU6050_RA_INT_ENABLE
MPU6050_INTERRUPT_MOT_BIT

◆ setIntPLLReadyEnabled()

void MPU6050::setIntPLLReadyEnabled ( bool  enabled)
inline

◆ setIntZeroMotionEnabled()

void MPU6050::setIntZeroMotionEnabled ( bool  enabled)
inline

Set Zero Motion Detection interrupt enabled status.

Parameters
enabledNew interrupt enabled status
See also
getIntZeroMotionEnabled()
MPU6050_RA_INT_ENABLE
MPU6050_INTERRUPT_ZMOT_BIT

◆ setMasterClockSpeed()

void MPU6050::setMasterClockSpeed ( uint8_t  speed)
inline

Set I2C master clock speed. @reparam speed Current I2C master clock speed

See also
MPU6050_RA_I2C_MST_CTRL

◆ setMemoryBank()

void MPU6050::setMemoryBank ( uint8_t  bank,
bool  prefetchEnabled = false,
bool  userBank = false 
)

◆ setMemoryStartAddress()

void MPU6050::setMemoryStartAddress ( uint8_t  address)
inline

◆ setMotionDetectionCounterDecrement()

void MPU6050::setMotionDetectionCounterDecrement ( uint8_t  decrement)
inline

Set Motion detection counter decrement configuration.

Parameters
decrementNew decrement configuration value
See also
getMotionDetectionCounterDecrement()
MPU6050_RA_MOT_DETECT_CTRL
MPU6050_DETECT_MOT_COUNT_BIT

◆ setMotionDetectionDuration()

void MPU6050::setMotionDetectionDuration ( uint8_t  duration)
inline

Set motion detection event duration threshold.

Parameters
durationNew motion detection duration threshold value (LSB = 1ms)
See also
getMotionDetectionDuration()
MPU6050_RA_MOT_DUR

◆ setMotionDetectionThreshold()

void MPU6050::setMotionDetectionThreshold ( uint8_t  threshold)
inline

Set motion detection event acceleration threshold.

Parameters
thresholdNew motion detection acceleration threshold value (LSB = 2mg)
See also
getMotionDetectionThreshold()
MPU6050_RA_MOT_THR

◆ setMultiMasterEnabled()

void MPU6050::setMultiMasterEnabled ( bool  enabled)
inline

Set multi-master enabled value.

Parameters
enabledNew multi-master enabled value
See also
getMultiMasterEnabled()
MPU6050_RA_I2C_MST_CTRL

◆ setOTPBankValid()

void MPU6050::setOTPBankValid ( bool  enabled)
inline

◆ setRate()

void MPU6050::setRate ( uint8_t  rate)
inline

Set gyroscope sample rate divider.

Parameters
rateNew sample rate divider
See also
getRate()
MPU6050_RA_SMPLRT_DIV

◆ setSlave0FIFOEnabled()

void MPU6050::setSlave0FIFOEnabled ( bool  enabled)
inline

Set Slave 0 FIFO enabled value.

Parameters
enabledNew Slave 0 FIFO enabled value
See also
getSlave0FIFOEnabled()
MPU6050_RA_FIFO_EN

◆ setSlave1FIFOEnabled()

void MPU6050::setSlave1FIFOEnabled ( bool  enabled)
inline

Set Slave 1 FIFO enabled value.

Parameters
enabledNew Slave 1 FIFO enabled value
See also
getSlave1FIFOEnabled()
MPU6050_RA_FIFO_EN

◆ setSlave2FIFOEnabled()

void MPU6050::setSlave2FIFOEnabled ( bool  enabled)
inline

Set Slave 2 FIFO enabled value.

Parameters
enabledNew Slave 2 FIFO enabled value
See also
getSlave2FIFOEnabled()
MPU6050_RA_FIFO_EN

◆ setSlave3FIFOEnabled()

void MPU6050::setSlave3FIFOEnabled ( bool  enabled)
inline

Set Slave 3 FIFO enabled value.

Parameters
enabledNew Slave 3 FIFO enabled value
See also
getSlave3FIFOEnabled()
MPU6050_RA_MST_CTRL

◆ setSlave4Address()

void MPU6050::setSlave4Address ( uint8_t  address)
inline

Set the I2C address of Slave 4.

Parameters
addressNew address for Slave 4
See also
getSlave4Address()
MPU6050_RA_I2C_SLV4_ADDR

◆ setSlave4Enabled()

void MPU6050::setSlave4Enabled ( bool  enabled)
inline

Set the enabled value for Slave 4.

Parameters
enabledNew enabled value for Slave 4
See also
getSlave4Enabled()
MPU6050_RA_I2C_SLV4_CTRL

◆ setSlave4InterruptEnabled()

void MPU6050::setSlave4InterruptEnabled ( bool  enabled)
inline

Set the enabled value for Slave 4 transaction interrupts.

Parameters
enabledNew enabled value for Slave 4 transaction interrupts.
See also
getSlave4InterruptEnabled()
MPU6050_RA_I2C_SLV4_CTRL

◆ setSlave4MasterDelay()

void MPU6050::setSlave4MasterDelay ( uint8_t  delay)
inline

Set Slave 4 master delay value.

Parameters
delayNew Slave 4 master delay value
See also
getSlave4MasterDelay()
MPU6050_RA_I2C_SLV4_CTRL

◆ setSlave4OutputByte()

void MPU6050::setSlave4OutputByte ( uint8_t  data)
inline

Set new byte to write to Slave 4. This register stores the data to be written into the Slave 4. If I2C_SLV4_RW is set 1 (set to read), this register has no effect.

Parameters
dataNew byte to write to Slave 4
See also
MPU6050_RA_I2C_SLV4_DO

◆ setSlave4Register()

void MPU6050::setSlave4Register ( uint8_t  reg)
inline

Set the active internal register for Slave 4.

Parameters
regNew active register for Slave 4
See also
getSlave4Register()
MPU6050_RA_I2C_SLV4_REG

◆ setSlave4WriteMode()

void MPU6050::setSlave4WriteMode ( bool  mode)
inline

Set write mode for the Slave 4.

Parameters
modeNew write mode for Slave 4 (0 = register address + data, 1 = data only)
See also
getSlave4WriteMode()
MPU6050_RA_I2C_SLV4_CTRL

◆ setSlaveAddress()

void MPU6050::setSlaveAddress ( SlaveId  slaveId,
uint8_t  address 
)

Set the I2C address of the specified slave (0-3).

Parameters
slaveIdSlave ID (0-3)
addressNew address for specified slave
See also
getSlaveAddress()
MPU6050_RA_I2C_SLV0_ADDR

◆ setSlaveDataLength()

void MPU6050::setSlaveDataLength ( SlaveId  slaveId,
uint8_t  length 
)

Set number of bytes to read for the specified slave (0-3).

Parameters
slaveIdSlave ID (0-3)
lengthNumber of bytes to read for specified slave
See also
getSlaveDataLength()
MPU6050_RA_I2C_SLV0_CTRL

◆ setSlaveDelayEnabled()

void MPU6050::setSlaveDelayEnabled ( SlaveId  slaveId,
bool  enabled 
)
inline

Set slave delay enabled status.

Parameters
slaveIdSlave ID (0-4)
enabledNew slave delay enabled status.
See also
MPU6050_RA_I2C_MST_DELAY_CTRL
MPU6050_DELAYCTRL_I2C_SLV0_DLY_EN_BIT

◆ setSlaveEnabled()

void MPU6050::setSlaveEnabled ( SlaveId  slaveId,
bool  enabled 
)

Set the enabled value for the specified slave (0-3).

Parameters
slaveIdSlave ID (0-3)
enabledNew enabled value for specified slave
See also
getSlaveEnabled()
MPU6050_RA_I2C_SLV0_CTRL

◆ setSlaveOutputByte()

void MPU6050::setSlaveOutputByte ( SlaveId  slaveId,
uint8_t  data 
)

Write byte to Data Output container for specified slave. This register holds the output data written into Slave when Slave is set to write mode. For further information regarding Slave control, please refer to Registers 37 to 39 and immediately following.

Parameters
slaveIdSlave ID (0-3)
dataByte to write
See also
MPU6050_RA_I2C_SLV0_DO

◆ setSlaveReadWriteTransitionEnabled()

void MPU6050::setSlaveReadWriteTransitionEnabled ( bool  enabled)
inline

Set slave read/write transition enabled value.

Parameters
enabledNew slave read/write transition enabled value
See also
getSlaveReadWriteTransitionEnabled()
MPU6050_RA_I2C_MST_CTRL

◆ setSlaveRegister()

void MPU6050::setSlaveRegister ( SlaveId  slaveId,
uint8_t  reg 
)

Set the active internal register for the specified slave (0-3).

Parameters
slaveIdSlave ID (0-3)
regNew active register for specified slave
See also
getSlaveRegister()
MPU6050_RA_I2C_SLV0_REG

◆ setSlaveWordByteSwap()

void MPU6050::setSlaveWordByteSwap ( SlaveId  slaveId,
bool  enabled 
)

Set word pair byte-swapping enabled for the specified slave (0-3).

Parameters
slaveIdSlave ID (0-3)
enabledNew word pair byte-swapping enabled value for specified slave
See also
getSlaveWordByteSwap()
MPU6050_RA_I2C_SLV0_CTRL

◆ setSlaveWordGroupOffset()

void MPU6050::setSlaveWordGroupOffset ( SlaveId  slaveId,
bool  enabled 
)

Set word pair grouping order offset for the specified slave (0-3).

Parameters
slaveIdSlave ID (0-3)
enabledNew word pair grouping order offset for specified slave
See also
getSlaveWordGroupOffset()
MPU6050_RA_I2C_SLV0_CTRL

◆ setSlaveWriteMode()

void MPU6050::setSlaveWriteMode ( SlaveId  slaveId,
bool  mode 
)

Set write mode for the specified slave (0-3).

Parameters
slaveIdSlave ID (0-3)
modeNew write mode for specified slave (0 = register address + data, 1 = data only)
See also
getSlaveWriteMode()
MPU6050_RA_I2C_SLV0_CTRL

◆ setSleepEnabled()

void MPU6050::setSleepEnabled ( bool  enabled)
inline

Set sleep mode status.

Parameters
enabledNew sleep mode enabled status
See also
getSleepEnabled()
MPU6050_RA_PWR_MGMT_1
MPU6050_PWR1_SLEEP_BIT

◆ setStandbyXAccelEnabled()

void MPU6050::setStandbyXAccelEnabled ( bool  enabled)
inline

Set X-axis accelerometer standby enabled status.

Parameters
NewX-axis standby enabled status
See also
getStandbyXAccelEnabled()
MPU6050_RA_PWR_MGMT_2
MPU6050_PWR2_STBY_XA_BIT

◆ setStandbyXGyroEnabled()

void MPU6050::setStandbyXGyroEnabled ( bool  enabled)
inline

Set X-axis gyroscope standby enabled status.

Parameters
NewX-axis standby enabled status
See also
getStandbyXGyroEnabled()
MPU6050_RA_PWR_MGMT_2
MPU6050_PWR2_STBY_XG_BIT

◆ setStandbyYAccelEnabled()

void MPU6050::setStandbyYAccelEnabled ( bool  enabled)
inline

Set Y-axis accelerometer standby enabled status.

Parameters
NewY-axis standby enabled status
See also
getStandbyYAccelEnabled()
MPU6050_RA_PWR_MGMT_2
MPU6050_PWR2_STBY_YA_BIT

◆ setStandbyYGyroEnabled()

void MPU6050::setStandbyYGyroEnabled ( bool  enabled)
inline

Set Y-axis gyroscope standby enabled status.

Parameters
NewY-axis standby enabled status
See also
getStandbyYGyroEnabled()
MPU6050_RA_PWR_MGMT_2
MPU6050_PWR2_STBY_YG_BIT

◆ setStandbyZAccelEnabled()

void MPU6050::setStandbyZAccelEnabled ( bool  enabled)
inline

Set Z-axis accelerometer standby enabled status.

Parameters
NewZ-axis standby enabled status
See also
getStandbyZAccelEnabled()
MPU6050_RA_PWR_MGMT_2
MPU6050_PWR2_STBY_ZA_BIT

◆ setStandbyZGyroEnabled()

void MPU6050::setStandbyZGyroEnabled ( bool  enabled)
inline

Set Z-axis gyroscope standby enabled status.

Parameters
NewZ-axis standby enabled status
See also
getStandbyZGyroEnabled()
MPU6050_RA_PWR_MGMT_2
MPU6050_PWR2_STBY_ZG_BIT

◆ setTempFIFOEnabled()

void MPU6050::setTempFIFOEnabled ( bool  enabled)
inline

Set temperature FIFO enabled value.

Parameters
enabledNew temperature FIFO enabled value
See also
getTempFIFOEnabled()
MPU6050_RA_FIFO_EN

◆ setTempSensorEnabled()

void MPU6050::setTempSensorEnabled ( bool  enabled)
inline

Set temperature sensor enabled status. Note: this register stores the disabled value, but for consistency with the rest of the code, the function is named and used with standard true/false values to indicate whether the sensor is enabled or disabled, respectively.

Parameters
enabledNew temperature sensor enabled status
See also
getTempSensorEnabled()
MPU6050_RA_PWR_MGMT_1
MPU6050_PWR1_TEMP_DIS_BIT

◆ setWaitForExternalSensorEnabled()

void MPU6050::setWaitForExternalSensorEnabled ( bool  enabled)
inline

Set wait-for-external-sensor-data enabled value.

Parameters
enabledNew wait-for-external-sensor-data enabled value
See also
getWaitForExternalSensorEnabled()
MPU6050_RA_I2C_MST_CTRL

◆ setWakeCycleEnabled()

void MPU6050::setWakeCycleEnabled ( bool  enabled)
inline

Set wake cycle enabled status.

Parameters
enabledNew sleep mode enabled status
See also
getWakeCycleEnabled()
MPU6050_RA_PWR_MGMT_1
MPU6050_PWR1_CYCLE_BIT

◆ setWakeFrequency()

void MPU6050::setWakeFrequency ( uint8_t  frequency)
inline

Set wake frequency in Accel-Only Low Power Mode.

Parameters
frequencyNew wake frequency
See also
MPU6050_RA_PWR_MGMT_2

◆ setXAccelOffset()

void MPU6050::setXAccelOffset ( int16_t  offset)
inline

◆ setXFineGain()

void MPU6050::setXFineGain ( int8_t  gain)
inline

◆ setXGyroFIFOEnabled()

void MPU6050::setXGyroFIFOEnabled ( bool  enabled)
inline

Set gyroscope X-axis FIFO enabled value.

Parameters
enabledNew gyroscope X-axis FIFO enabled value
See also
getXGyroFIFOEnabled()
MPU6050_RA_FIFO_EN

◆ setXGyroOffset()

void MPU6050::setXGyroOffset ( int16_t  offset)
inline

◆ setXGyroOffsetTC()

void MPU6050::setXGyroOffsetTC ( int8_t  offset)
inline

◆ setYAccelOffset()

void MPU6050::setYAccelOffset ( int16_t  offset)
inline

◆ setYFineGain()

void MPU6050::setYFineGain ( int8_t  gain)
inline

◆ setYGyroFIFOEnabled()

void MPU6050::setYGyroFIFOEnabled ( bool  enabled)
inline

Set gyroscope Y-axis FIFO enabled value.

Parameters
enabledNew gyroscope Y-axis FIFO enabled value
See also
getYGyroFIFOEnabled()
MPU6050_RA_FIFO_EN

◆ setYGyroOffset()

void MPU6050::setYGyroOffset ( int16_t  offset)
inline

◆ setYGyroOffsetTC()

void MPU6050::setYGyroOffsetTC ( int8_t  offset)
inline

◆ setZAccelOffset()

void MPU6050::setZAccelOffset ( int16_t  offset)
inline

◆ setZeroMotionDetectionDuration()

void MPU6050::setZeroMotionDetectionDuration ( uint8_t  duration)
inline

Set zero motion detection event duration threshold.

Parameters
durationNew zero motion detection duration threshold value (LSB = 1ms)
See also
getZeroMotionDetectionDuration()
MPU6050_RA_ZRMOT_DUR

◆ setZeroMotionDetectionThreshold()

void MPU6050::setZeroMotionDetectionThreshold ( uint8_t  threshold)
inline

Set zero motion detection event acceleration threshold.

Parameters
thresholdNew zero motion detection acceleration threshold value (LSB = 2mg)
See also
getZeroMotionDetectionThreshold()
MPU6050_RA_ZRMOT_THR

◆ setZFineGain()

void MPU6050::setZFineGain ( int8_t  gain)
inline

◆ setZGyroFIFOEnabled()

void MPU6050::setZGyroFIFOEnabled ( bool  enabled)
inline

Set gyroscope Z-axis FIFO enabled value.

Parameters
enabledNew gyroscope Z-axis FIFO enabled value
See also
getZGyroFIFOEnabled()
MPU6050_RA_FIFO_EN

◆ setZGyroOffset()

void MPU6050::setZGyroOffset ( int16_t  offset)
inline

◆ setZGyroOffsetTC()

void MPU6050::setZGyroOffsetTC ( int8_t  offset)
inline

◆ switchSPIEnabled()

void MPU6050::switchSPIEnabled ( bool  enabled)
inline

Switch from I2C to SPI mode (MPU-6000 only) If this is set, the primary SPI interface will be enabled in place of the disabled primary I2C interface.

◆ testConnection()

bool MPU6050::testConnection ( )
inline

Verify the I2C connection. Make sure the device is connected and responds as expected.

Returns
True if connection is valid, false otherwise

◆ writeMemoryByte()

void MPU6050::writeMemoryByte ( uint8_t  data)
inline

The documentation for this class was generated from the following file: