COSA
An Object-Oriented Platform for Arduino Programming
|
#include <MPU6050.hh>
Classes | |
union | accel_config_t |
union | config_t |
union | fifo_en_t |
union | gyro_config_t |
union | int_enable_t |
union | int_pin_cfg_t |
union | int_status_t |
struct | motion_t |
union | pwr_mgmt_1_t |
union | pwr_mgmt_2_t |
struct | sample_t |
union | signal_path_reset_t |
union | user_ctrl_t |
Public Member Functions | |
MPU6050 (uint8_t subaddr=0) | |
bool | begin (uint8_t clksel=CLKSEL_PLL_GYRO_X_REF) |
bool | end () |
int16_t | read_temperature () |
void | read_motion (motion_t &m) |
void | read_accelerometer (sample_t &s) |
void | read_gyroscope (sample_t &s) |
Protected Member Functions | |
void | write (Register reg, uint8_t value) |
void | write (Register reg, void *buffer, size_t count) |
uint8_t | read (Register reg) |
void | read (Register reg, void *buffer, size_t count) |
Private Member Functions | |
bool | is_async () const |
void | sync_request () |
void | async_request () |
virtual void | on_completion (uint8_t type, int count) |
Private Attributes | |
uint8_t | m_addr |
bool | m_async |
Cosa TWI driver for InvenSense, MPU6050, Motion Processing Unit, 6-axis motion processor solution with gyroscope, accelerator and extended I2C slave bus.
The MPU6050 module ITG/MPU with pull-up resistors (4K7) for TWI signals and 3V3 internal voltage converter.
Definition at line 53 of file MPU6050.hh.
|
protected |
Full scale range of the gyroscope (pp. 14).
Enumerator | |
---|---|
FS_RANGE_250 | |
FS_RANGE_500 | |
FS_RANGE_1000 | |
FS_RANGE_2000 |
Definition at line 242 of file MPU6050.hh.
|
protected |
Full scale range of the accelerometer (pp. 15).
Enumerator | |
---|---|
AFS_RANGE_2G | |
AFS_RANGE_4G | |
AFS_RANGE_8G | |
AFS_RANGE_16G |
Definition at line 274 of file MPU6050.hh.
|
protected |
Clock Source (pp. 40).
Enumerator | |
---|---|
CLKSEL_INTERNAL_8MHZ | |
CLKSEL_PLL_GYRO_X_REF | |
CLKSEL_PLL_GYRO_Y_REF | |
CLKSEL_PLL_GYRO_Z_REF | |
CLKSEL_PLL_EXT_32KHZ_REF | |
CLKSEL_PLL_EXT_19MHZ_REF | |
CLKSEL_RESERVED | |
CLKSEL_STOP_CLOCKS |
Definition at line 447 of file MPU6050.hh.
|
protected |
Wake-up Frequency (pp. 42).
Enumerator | |
---|---|
LP_WAKE_CTRL_1_25HZ | |
LP_WAKE_CTRL_5HZ | |
LP_WAKE_CTRL_20HZ | |
LP_WAKE_CTRL_40HZ |
Definition at line 485 of file MPU6050.hh.
|
protected |
Register address map (See chap. 3 Register Map, pp. 6-7).
Enumerator | |
---|---|
SELF_TEST_X |
Self Test Registers. |
SELF_TEST_Y |
Self Test Registers. |
SELF_TEST_Z |
Self Test Registers. |
SELF_TEST_A |
Self Test Registers. |
SMPRT_DIV |
Sample Rate Divider. |
CONFIG |
Configuration. |
GYRO_CONFIG |
Gyroscope Configuration. |
ACCEL_CONFIG |
Accelerometer Configuration. |
FIFO_EN |
FIFO Enable. |
I2C_MST_CTRL |
I2C Master Control. |
I2C_SLV0_ADDR |
I2C Slave 0 Address. |
I2C_SLV0_REG |
I2C Slave 0 Register. |
I2C_SLV0_CTRL |
I2C Slave 0 Control. |
I2C_SLV1_ADDR |
I2C Slave 1 Address. |
I2C_SLV1_REG |
I2C Slave 1 Register. |
I2C_SLV1_CTRL |
I2C Slave 1 Control. |
I2C_SLV2_ADDR |
I2C Slave 2 Address. |
I2C_SLV2_REG |
I2C Slave 2 Register. |
I2C_SLV2_CTRL |
I2C Slave 2 Control. |
I2C_SLV3_ADDR |
I2C Slave 3 Address. |
I2C_SLV3_REG |
I2C Slave 3 Register. |
I2C_SLV3_CTRL |
I2C Slave 3 Control. |
I2C_SLV4_ADDR |
I2C Slave 4 Address. |
I2C_SLV4_REG |
I2C Slave 4 Register. |
I2C_SLV4_DO |
I2C Slave 4 Data Out. |
I2C_SLV4_CTRL |
I2C Slave 4 Control. |
I2C_SLV4_DI |
I2C Slave 4 Data In. |
I2C_MST_STATUS |
I2C Master Status. |
INT_PIN_CFG |
INT Pin/Bypass Enable Configuration. |
INT_ENABLE |
Interrupt Enable. |
INT_STATUS |
Interrupt Status. |
ACCEL_OUT |
Accelerometer Measurements. |
ACCEL_XOUT |
X. |
ACCEL_XOUT_H |
X MSB. |
ACCEL_XOUT_L |
X LSB. |
ACCEL_YOUT |
Y. |
ACCEL_YOUT_H |
Y MSB. |
ACCEL_YOUT_L |
Y LSB. |
ACCEL_ZOUT |
Z. |
ACCEL_ZOUT_H |
Z MSB. |
ACCEL_ZOUT_L |
Z LSB. |
TEMP_OUT |
Temperature Measurement. |
TEMP_OUT_H |
Temp MSB. |
TEMP_OUT_L |
Temp LSB. |
GYRO_OUT |
Gyroscope Measurement. |
GYRO_XOUT |
X. |
GYRO_XOUT_H |
X MSB. |
GYRO_XOUT_L |
X LSB. |
GYRO_YOUT |
Y. |
GYRO_YOUT_H |
Y MSB. |
GYRO_YOUT_L |
Y LSB. |
GYRO_ZOUT |
Z. |
GYRO_ZOUT_H |
Z MSB. |
GYRO_ZOUT_L |
Z LSB. |
EXT_SENS_DATA |
External Sensor Data. |
I2C_SLV0_DO |
I2C Slave 0 Data Out. |
I2C_SLV1_DO |
I2C Slave 1 Data Out. |
I2C_SLV2_DO |
I2C Slave 2 Data Out. |
I2C_SLV3_DO |
I2C Slave 3 Data Out. |
I2C_MST_DELAY_CTRL |
I2C Master Delay Control. |
SIGNAL_PATH_RESET |
Signal Path Reset. |
USER_CTRL |
User Control. |
PWR_MGMT_1 |
Power Management 1. |
PWR_MGMT_2 |
Power Management 2. |
FIFO_COUNT |
FIFO Count Registers. |
FIFO_COUNT_H |
FIFO Count Registers MSB. |
FIFO_COUNT_L |
FIFO Count Registers LSB. |
FIFO_R_W |
FIFO Read Write. |
WHO_AM_I |
Who Am I. |
Definition at line 125 of file MPU6050.hh.
|
inline |
Construct MPU6050 digital gyroscope driver with given sub-address. Default is zero(0).
[in] | subaddr | sub-address (0..1, default 0) |
Definition at line 60 of file MPU6050.hh.
bool MPU6050::begin | ( | uint8_t | clksel = CLKSEL_PLL_GYRO_X_REF | ) |
Start interaction with device. Turn on measurements.
[in] | clksel | clock source (default PLL with X axis gyroscope) |
Definition at line 60 of file MPU6050.cpp.
bool MPU6050::end | ( | ) |
Stop sequence of interaction with device. Turn off measurements and power down.
Definition at line 84 of file MPU6050.cpp.
|
protected |
Read contents of register.
[in] | reg | register address. |
Definition at line 40 of file MPU6050.cpp.
|
protected |
Read contents of registers, multiple values from give address.
[in] | reg | register address. |
[in] | buffer | storage. |
[in] | count | number of bytes. |
Definition at line 51 of file MPU6050.cpp.
void MPU6050::read_accelerometer | ( | sample_t & | s | ) |
Read accelerometer and return values in given sample data structure.
[in,out] | s | sample storage. |
Definition at line 106 of file MPU6050.cpp.
void MPU6050::read_gyroscope | ( | sample_t & | s | ) |
Read gyroscope and return values in given data structure
[in,out] | s | sample storage. |
Definition at line 113 of file MPU6050.cpp.
void MPU6050::read_motion | ( | motion_t & | m | ) |
Read accelerometer and return values in given sample data structure.
[in,out] | m | samples storage. |
Definition at line 98 of file MPU6050.cpp.
int16_t MPU6050::read_temperature | ( | ) |
Read temperature and return value in scale 0.1 Celcius.
Definition at line 90 of file MPU6050.cpp.
|
protected |
Write given value to register.
[in] | reg | register address. |
[in] | value | register value. |
Definition at line 24 of file MPU6050.cpp.
|
protected |
Write multiple registers with values from give address.
[in] | reg | register address. |
[in] | buffer | storage. |
[in] | count | number of bytes. |
Definition at line 32 of file MPU6050.cpp.