MPU6050 gyro/accelerometer driver

nRF5 SDK v9.0.0

nRF51 SDK v9.0.0

MPU6050 gyro/accelerometer driver. More...

Functions

bool mpu6050_init (uint8_t device_address)
Function for initializing MPU6050 and verifies it's on the bus. More...
bool mpu6050_register_write (uint8_t register_address, const uint8_t value)
Function for writing a MPU6050 register contents over TWI. More...
bool mpu6050_register_read (uint8_t register_address, uint8_t *destination, uint8_t number_of_bytes)
Function for reading MPU6050 register contents over TWI. Reads one or more consecutive registers. More...
bool mpu6050_verify_product_id (void)
Function for reading and verifying MPU6050 product ID. More...

Detailed Description

MPU6050 gyro/accelerometer driver.

Function Documentation

bool mpu6050_init ( uint8_t device_address )

Function for initializing MPU6050 and verifies it's on the bus.

Parameters
device_address Device TWI address in bits [6:0].
Returns
Return values
true MPU6050 found on the bus and ready for operation.
false MPU6050 not found on the bus or communication failure.
bool mpu6050_register_read ( uint8_t register_address ,
uint8_t * destination ,
uint8_t number_of_bytes
)

Function for reading MPU6050 register contents over TWI. Reads one or more consecutive registers.

Parameters
[in] register_address Register address to start reading from
[in] number_of_bytes Number of bytes to read
[out] destination Pointer to a data buffer where read data will be stored
Return values
true Register read succeeded
false Register read failed
bool mpu6050_register_write ( uint8_t register_address ,
const uint8_t value
)

Function for writing a MPU6050 register contents over TWI.

Parameters
[in] register_address Register address to start writing to
[in] value Value to write to register
Return values
true Register write succeeded
false Register write failed
bool mpu6050_verify_product_id ( void )

Function for reading and verifying MPU6050 product ID.

Return values
true Product ID is what was expected
false Product ID was not what was expected

Please send us your feedback about the documentation! For technical questions, visit the Nordic Developer Zone .