This one compatable with brobot V3. first commit to BroBot
Dependents: BroBot_ESE350_Skeleton
Fork of MPU6050 by
JJ_MPU6050.h@9:37a883451bf1, 2016-10-12 (annotated)
- Committer:
- csharer
- Date:
- Wed Oct 12 05:02:14 2016 +0000
- Revision:
- 9:37a883451bf1
first commit to BroBot
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
csharer | 9:37a883451bf1 | 1 | // I2Cdev library collection - MPU6050 I2C device class |
csharer | 9:37a883451bf1 | 2 | // Based on InvenSense MPU-6050 register map document rev. 2.0, 5/19/2011 (RM-MPU-6000A-00) |
csharer | 9:37a883451bf1 | 3 | // 10/3/2011 by Jeff Rowberg <jeff@rowberg.net> |
csharer | 9:37a883451bf1 | 4 | // Updates should (hopefully) always be available at https://github.com/jrowberg/i2cdevlib |
csharer | 9:37a883451bf1 | 5 | // |
csharer | 9:37a883451bf1 | 6 | // Changelog: |
csharer | 9:37a883451bf1 | 7 | // ... - ongoing debug release |
csharer | 9:37a883451bf1 | 8 | |
csharer | 9:37a883451bf1 | 9 | // NOTE: THIS IS ONLY A PARIAL RELEASE. THIS DEVICE CLASS IS CURRENTLY UNDERGOING ACTIVE |
csharer | 9:37a883451bf1 | 10 | // DEVELOPMENT AND IS STILL MISSING SOME IMPORTANT FEATURES. PLEASE KEEP THIS IN MIND IF |
csharer | 9:37a883451bf1 | 11 | // YOU DECIDE TO USE THIS PARTICULAR CODE FOR ANYTHING. |
csharer | 9:37a883451bf1 | 12 | |
csharer | 9:37a883451bf1 | 13 | /* ============================================ |
csharer | 9:37a883451bf1 | 14 | I2Cdev device library code is placed under the MIT license |
csharer | 9:37a883451bf1 | 15 | Copyright (c) 2012 Jeff Rowberg |
csharer | 9:37a883451bf1 | 16 | |
csharer | 9:37a883451bf1 | 17 | Permission is hereby granted, free of charge, to any person obtaining a copy |
csharer | 9:37a883451bf1 | 18 | of this software and associated documentation files (the "Software"), to deal |
csharer | 9:37a883451bf1 | 19 | in the Software without restriction, including without limitation the rights |
csharer | 9:37a883451bf1 | 20 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
csharer | 9:37a883451bf1 | 21 | copies of the Software, and to permit persons to whom the Software is |
csharer | 9:37a883451bf1 | 22 | furnished to do so, subject to the following conditions: |
csharer | 9:37a883451bf1 | 23 | |
csharer | 9:37a883451bf1 | 24 | The above copyright notice and this permission notice shall be included in |
csharer | 9:37a883451bf1 | 25 | all copies or substantial portions of the Software. |
csharer | 9:37a883451bf1 | 26 | |
csharer | 9:37a883451bf1 | 27 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
csharer | 9:37a883451bf1 | 28 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
csharer | 9:37a883451bf1 | 29 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
csharer | 9:37a883451bf1 | 30 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
csharer | 9:37a883451bf1 | 31 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
csharer | 9:37a883451bf1 | 32 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
csharer | 9:37a883451bf1 | 33 | THE SOFTWARE. |
csharer | 9:37a883451bf1 | 34 | =============================================== |
csharer | 9:37a883451bf1 | 35 | */ |
csharer | 9:37a883451bf1 | 36 | |
csharer | 9:37a883451bf1 | 37 | #ifndef _MPU6050_H_ |
csharer | 9:37a883451bf1 | 38 | #define _MPU6050_H_ |
csharer | 9:37a883451bf1 | 39 | |
csharer | 9:37a883451bf1 | 40 | #include "I2Cdev.h" |
csharer | 9:37a883451bf1 | 41 | |
csharer | 9:37a883451bf1 | 42 | // supporting link: http://forum.arduino.cc/index.php?&topic=143444.msg1079517#msg1079517 |
csharer | 9:37a883451bf1 | 43 | // also: http://forum.arduino.cc/index.php?&topic=141571.msg1062899#msg1062899s |
csharer | 9:37a883451bf1 | 44 | |
csharer | 9:37a883451bf1 | 45 | #ifdef __AVR__ |
csharer | 9:37a883451bf1 | 46 | #include <avr/pgmspace.h> |
csharer | 9:37a883451bf1 | 47 | #else |
csharer | 9:37a883451bf1 | 48 | //#define PROGMEM /* empty */ |
csharer | 9:37a883451bf1 | 49 | //#define pgm_read_byte(x) (*(x)) |
csharer | 9:37a883451bf1 | 50 | //#define pgm_read_word(x) (*(x)) |
csharer | 9:37a883451bf1 | 51 | //#define pgm_read_float(x) (*(x)) |
csharer | 9:37a883451bf1 | 52 | //#define PSTR(STR) STR |
csharer | 9:37a883451bf1 | 53 | #endif |
csharer | 9:37a883451bf1 | 54 | |
csharer | 9:37a883451bf1 | 55 | |
csharer | 9:37a883451bf1 | 56 | #define MPU6050_ADDRESS_AD0_LOW 0x68 // address pin low (GND), default for InvenSense evaluation board |
csharer | 9:37a883451bf1 | 57 | #define MPU6050_ADDRESS_AD0_HIGH 0x69 // address pin high (VCC) |
csharer | 9:37a883451bf1 | 58 | #define MPU6050_DEFAULT_ADDRESS MPU6050_ADDRESS_AD0_LOW |
csharer | 9:37a883451bf1 | 59 | |
csharer | 9:37a883451bf1 | 60 | #define MPU6050_RA_XG_OFFS_TC 0x00 //[7] PWR_MODE, [6:1] XG_OFFS_TC, [0] OTP_BNK_VLD |
csharer | 9:37a883451bf1 | 61 | #define MPU6050_RA_YG_OFFS_TC 0x01 //[7] PWR_MODE, [6:1] YG_OFFS_TC, [0] OTP_BNK_VLD |
csharer | 9:37a883451bf1 | 62 | #define MPU6050_RA_ZG_OFFS_TC 0x02 //[7] PWR_MODE, [6:1] ZG_OFFS_TC, [0] OTP_BNK_VLD |
csharer | 9:37a883451bf1 | 63 | #define MPU6050_RA_X_FINE_GAIN 0x03 //[7:0] X_FINE_GAIN |
csharer | 9:37a883451bf1 | 64 | #define MPU6050_RA_Y_FINE_GAIN 0x04 //[7:0] Y_FINE_GAIN |
csharer | 9:37a883451bf1 | 65 | #define MPU6050_RA_Z_FINE_GAIN 0x05 //[7:0] Z_FINE_GAIN |
csharer | 9:37a883451bf1 | 66 | #define MPU6050_RA_XA_OFFS_H 0x06 //[15:0] XA_OFFS |
csharer | 9:37a883451bf1 | 67 | #define MPU6050_RA_XA_OFFS_L_TC 0x07 |
csharer | 9:37a883451bf1 | 68 | #define MPU6050_RA_YA_OFFS_H 0x08 //[15:0] YA_OFFS |
csharer | 9:37a883451bf1 | 69 | #define MPU6050_RA_YA_OFFS_L_TC 0x09 |
csharer | 9:37a883451bf1 | 70 | #define MPU6050_RA_ZA_OFFS_H 0x0A //[15:0] ZA_OFFS |
csharer | 9:37a883451bf1 | 71 | #define MPU6050_RA_ZA_OFFS_L_TC 0x0B |
csharer | 9:37a883451bf1 | 72 | #define MPU6050_RA_SELF_TEST_X 0x0D //[7:5] XA_TEST[4-2], [4:0] XG_TEST[4-0] |
csharer | 9:37a883451bf1 | 73 | #define MPU6050_RA_SELF_TEST_Y 0x0E //[7:5] YA_TEST[4-2], [4:0] YG_TEST[4-0] |
csharer | 9:37a883451bf1 | 74 | #define MPU6050_RA_SELF_TEST_Z 0x0F //[7:5] ZA_TEST[4-2], [4:0] ZG_TEST[4-0] |
csharer | 9:37a883451bf1 | 75 | #define MPU6050_RA_SELF_TEST_A 0x10 //[5:4] XA_TEST[1-0], [3:2] YA_TEST[1-0], [1:0] ZA_TEST[1-0] |
csharer | 9:37a883451bf1 | 76 | #define MPU6050_RA_XG_OFFS_USRH 0x13 //[15:0] XG_OFFS_USR |
csharer | 9:37a883451bf1 | 77 | #define MPU6050_RA_XG_OFFS_USRL 0x14 |
csharer | 9:37a883451bf1 | 78 | #define MPU6050_RA_YG_OFFS_USRH 0x15 //[15:0] YG_OFFS_USR |
csharer | 9:37a883451bf1 | 79 | #define MPU6050_RA_YG_OFFS_USRL 0x16 |
csharer | 9:37a883451bf1 | 80 | #define MPU6050_RA_ZG_OFFS_USRH 0x17 //[15:0] ZG_OFFS_USR |
csharer | 9:37a883451bf1 | 81 | #define MPU6050_RA_ZG_OFFS_USRL 0x18 |
csharer | 9:37a883451bf1 | 82 | #define MPU6050_RA_SMPLRT_DIV 0x19 |
csharer | 9:37a883451bf1 | 83 | #define MPU6050_RA_CONFIG 0x1A |
csharer | 9:37a883451bf1 | 84 | #define MPU6050_RA_GYRO_CONFIG 0x1B |
csharer | 9:37a883451bf1 | 85 | #define MPU6050_RA_ACCEL_CONFIG 0x1C |
csharer | 9:37a883451bf1 | 86 | #define MPU6050_RA_FF_THR 0x1D |
csharer | 9:37a883451bf1 | 87 | #define MPU6050_RA_FF_DUR 0x1E |
csharer | 9:37a883451bf1 | 88 | #define MPU6050_RA_MOT_THR 0x1F |
csharer | 9:37a883451bf1 | 89 | #define MPU6050_RA_MOT_DUR 0x20 |
csharer | 9:37a883451bf1 | 90 | #define MPU6050_RA_ZRMOT_THR 0x21 |
csharer | 9:37a883451bf1 | 91 | #define MPU6050_RA_ZRMOT_DUR 0x22 |
csharer | 9:37a883451bf1 | 92 | #define MPU6050_RA_FIFO_EN 0x23 |
csharer | 9:37a883451bf1 | 93 | #define MPU6050_RA_I2C_MST_CTRL 0x24 |
csharer | 9:37a883451bf1 | 94 | #define MPU6050_RA_I2C_SLV0_ADDR 0x25 |
csharer | 9:37a883451bf1 | 95 | #define MPU6050_RA_I2C_SLV0_REG 0x26 |
csharer | 9:37a883451bf1 | 96 | #define MPU6050_RA_I2C_SLV0_CTRL 0x27 |
csharer | 9:37a883451bf1 | 97 | #define MPU6050_RA_I2C_SLV1_ADDR 0x28 |
csharer | 9:37a883451bf1 | 98 | #define MPU6050_RA_I2C_SLV1_REG 0x29 |
csharer | 9:37a883451bf1 | 99 | #define MPU6050_RA_I2C_SLV1_CTRL 0x2A |
csharer | 9:37a883451bf1 | 100 | #define MPU6050_RA_I2C_SLV2_ADDR 0x2B |
csharer | 9:37a883451bf1 | 101 | #define MPU6050_RA_I2C_SLV2_REG 0x2C |
csharer | 9:37a883451bf1 | 102 | #define MPU6050_RA_I2C_SLV2_CTRL 0x2D |
csharer | 9:37a883451bf1 | 103 | #define MPU6050_RA_I2C_SLV3_ADDR 0x2E |
csharer | 9:37a883451bf1 | 104 | #define MPU6050_RA_I2C_SLV3_REG 0x2F |
csharer | 9:37a883451bf1 | 105 | #define MPU6050_RA_I2C_SLV3_CTRL 0x30 |
csharer | 9:37a883451bf1 | 106 | #define MPU6050_RA_I2C_SLV4_ADDR 0x31 |
csharer | 9:37a883451bf1 | 107 | #define MPU6050_RA_I2C_SLV4_REG 0x32 |
csharer | 9:37a883451bf1 | 108 | #define MPU6050_RA_I2C_SLV4_DO 0x33 |
csharer | 9:37a883451bf1 | 109 | #define MPU6050_RA_I2C_SLV4_CTRL 0x34 |
csharer | 9:37a883451bf1 | 110 | #define MPU6050_RA_I2C_SLV4_DI 0x35 |
csharer | 9:37a883451bf1 | 111 | #define MPU6050_RA_I2C_MST_STATUS 0x36 |
csharer | 9:37a883451bf1 | 112 | #define MPU6050_RA_INT_PIN_CFG 0x37 |
csharer | 9:37a883451bf1 | 113 | #define MPU6050_RA_INT_ENABLE 0x38 |
csharer | 9:37a883451bf1 | 114 | #define MPU6050_RA_DMP_INT_STATUS 0x39 |
csharer | 9:37a883451bf1 | 115 | #define MPU6050_RA_INT_STATUS 0x3A |
csharer | 9:37a883451bf1 | 116 | #define MPU6050_RA_ACCEL_XOUT_H 0x3B |
csharer | 9:37a883451bf1 | 117 | #define MPU6050_RA_ACCEL_XOUT_L 0x3C |
csharer | 9:37a883451bf1 | 118 | #define MPU6050_RA_ACCEL_YOUT_H 0x3D |
csharer | 9:37a883451bf1 | 119 | #define MPU6050_RA_ACCEL_YOUT_L 0x3E |
csharer | 9:37a883451bf1 | 120 | #define MPU6050_RA_ACCEL_ZOUT_H 0x3F |
csharer | 9:37a883451bf1 | 121 | #define MPU6050_RA_ACCEL_ZOUT_L 0x40 |
csharer | 9:37a883451bf1 | 122 | #define MPU6050_RA_TEMP_OUT_H 0x41 |
csharer | 9:37a883451bf1 | 123 | #define MPU6050_RA_TEMP_OUT_L 0x42 |
csharer | 9:37a883451bf1 | 124 | #define MPU6050_RA_GYRO_XOUT_H 0x43 |
csharer | 9:37a883451bf1 | 125 | #define MPU6050_RA_GYRO_XOUT_L 0x44 |
csharer | 9:37a883451bf1 | 126 | #define MPU6050_RA_GYRO_YOUT_H 0x45 |
csharer | 9:37a883451bf1 | 127 | #define MPU6050_RA_GYRO_YOUT_L 0x46 |
csharer | 9:37a883451bf1 | 128 | #define MPU6050_RA_GYRO_ZOUT_H 0x47 |
csharer | 9:37a883451bf1 | 129 | #define MPU6050_RA_GYRO_ZOUT_L 0x48 |
csharer | 9:37a883451bf1 | 130 | #define MPU6050_RA_EXT_SENS_DATA_00 0x49 |
csharer | 9:37a883451bf1 | 131 | #define MPU6050_RA_EXT_SENS_DATA_01 0x4A |
csharer | 9:37a883451bf1 | 132 | #define MPU6050_RA_EXT_SENS_DATA_02 0x4B |
csharer | 9:37a883451bf1 | 133 | #define MPU6050_RA_EXT_SENS_DATA_03 0x4C |
csharer | 9:37a883451bf1 | 134 | #define MPU6050_RA_EXT_SENS_DATA_04 0x4D |
csharer | 9:37a883451bf1 | 135 | #define MPU6050_RA_EXT_SENS_DATA_05 0x4E |
csharer | 9:37a883451bf1 | 136 | #define MPU6050_RA_EXT_SENS_DATA_06 0x4F |
csharer | 9:37a883451bf1 | 137 | #define MPU6050_RA_EXT_SENS_DATA_07 0x50 |
csharer | 9:37a883451bf1 | 138 | #define MPU6050_RA_EXT_SENS_DATA_08 0x51 |
csharer | 9:37a883451bf1 | 139 | #define MPU6050_RA_EXT_SENS_DATA_09 0x52 |
csharer | 9:37a883451bf1 | 140 | #define MPU6050_RA_EXT_SENS_DATA_10 0x53 |
csharer | 9:37a883451bf1 | 141 | #define MPU6050_RA_EXT_SENS_DATA_11 0x54 |
csharer | 9:37a883451bf1 | 142 | #define MPU6050_RA_EXT_SENS_DATA_12 0x55 |
csharer | 9:37a883451bf1 | 143 | #define MPU6050_RA_EXT_SENS_DATA_13 0x56 |
csharer | 9:37a883451bf1 | 144 | #define MPU6050_RA_EXT_SENS_DATA_14 0x57 |
csharer | 9:37a883451bf1 | 145 | #define MPU6050_RA_EXT_SENS_DATA_15 0x58 |
csharer | 9:37a883451bf1 | 146 | #define MPU6050_RA_EXT_SENS_DATA_16 0x59 |
csharer | 9:37a883451bf1 | 147 | #define MPU6050_RA_EXT_SENS_DATA_17 0x5A |
csharer | 9:37a883451bf1 | 148 | #define MPU6050_RA_EXT_SENS_DATA_18 0x5B |
csharer | 9:37a883451bf1 | 149 | #define MPU6050_RA_EXT_SENS_DATA_19 0x5C |
csharer | 9:37a883451bf1 | 150 | #define MPU6050_RA_EXT_SENS_DATA_20 0x5D |
csharer | 9:37a883451bf1 | 151 | #define MPU6050_RA_EXT_SENS_DATA_21 0x5E |
csharer | 9:37a883451bf1 | 152 | #define MPU6050_RA_EXT_SENS_DATA_22 0x5F |
csharer | 9:37a883451bf1 | 153 | #define MPU6050_RA_EXT_SENS_DATA_23 0x60 |
csharer | 9:37a883451bf1 | 154 | #define MPU6050_RA_MOT_DETECT_STATUS 0x61 |
csharer | 9:37a883451bf1 | 155 | #define MPU6050_RA_I2C_SLV0_DO 0x63 |
csharer | 9:37a883451bf1 | 156 | #define MPU6050_RA_I2C_SLV1_DO 0x64 |
csharer | 9:37a883451bf1 | 157 | #define MPU6050_RA_I2C_SLV2_DO 0x65 |
csharer | 9:37a883451bf1 | 158 | #define MPU6050_RA_I2C_SLV3_DO 0x66 |
csharer | 9:37a883451bf1 | 159 | #define MPU6050_RA_I2C_MST_DELAY_CTRL 0x67 |
csharer | 9:37a883451bf1 | 160 | #define MPU6050_RA_SIGNAL_PATH_RESET 0x68 |
csharer | 9:37a883451bf1 | 161 | #define MPU6050_RA_MOT_DETECT_CTRL 0x69 |
csharer | 9:37a883451bf1 | 162 | #define MPU6050_RA_USER_CTRL 0x6A |
csharer | 9:37a883451bf1 | 163 | #define MPU6050_RA_PWR_MGMT_1 0x6B |
csharer | 9:37a883451bf1 | 164 | #define MPU6050_RA_PWR_MGMT_2 0x6C |
csharer | 9:37a883451bf1 | 165 | #define MPU6050_RA_BANK_SEL 0x6D |
csharer | 9:37a883451bf1 | 166 | #define MPU6050_RA_MEM_START_ADDR 0x6E |
csharer | 9:37a883451bf1 | 167 | #define MPU6050_RA_MEM_R_W 0x6F |
csharer | 9:37a883451bf1 | 168 | #define MPU6050_RA_DMP_CFG_1 0x70 |
csharer | 9:37a883451bf1 | 169 | #define MPU6050_RA_DMP_CFG_2 0x71 |
csharer | 9:37a883451bf1 | 170 | #define MPU6050_RA_FIFO_COUNTH 0x72 |
csharer | 9:37a883451bf1 | 171 | #define MPU6050_RA_FIFO_COUNTL 0x73 |
csharer | 9:37a883451bf1 | 172 | #define MPU6050_RA_FIFO_R_W 0x74 |
csharer | 9:37a883451bf1 | 173 | #define MPU6050_RA_WHO_AM_I 0x75 |
csharer | 9:37a883451bf1 | 174 | |
csharer | 9:37a883451bf1 | 175 | #define MPU6050_SELF_TEST_XA_1_BIT 0x07 |
csharer | 9:37a883451bf1 | 176 | #define MPU6050_SELF_TEST_XA_1_LENGTH 0x03 |
csharer | 9:37a883451bf1 | 177 | #define MPU6050_SELF_TEST_XA_2_BIT 0x05 |
csharer | 9:37a883451bf1 | 178 | #define MPU6050_SELF_TEST_XA_2_LENGTH 0x02 |
csharer | 9:37a883451bf1 | 179 | #define MPU6050_SELF_TEST_YA_1_BIT 0x07 |
csharer | 9:37a883451bf1 | 180 | #define MPU6050_SELF_TEST_YA_1_LENGTH 0x03 |
csharer | 9:37a883451bf1 | 181 | #define MPU6050_SELF_TEST_YA_2_BIT 0x03 |
csharer | 9:37a883451bf1 | 182 | #define MPU6050_SELF_TEST_YA_2_LENGTH 0x02 |
csharer | 9:37a883451bf1 | 183 | #define MPU6050_SELF_TEST_ZA_1_BIT 0x07 |
csharer | 9:37a883451bf1 | 184 | #define MPU6050_SELF_TEST_ZA_1_LENGTH 0x03 |
csharer | 9:37a883451bf1 | 185 | #define MPU6050_SELF_TEST_ZA_2_BIT 0x01 |
csharer | 9:37a883451bf1 | 186 | #define MPU6050_SELF_TEST_ZA_2_LENGTH 0x02 |
csharer | 9:37a883451bf1 | 187 | |
csharer | 9:37a883451bf1 | 188 | #define MPU6050_SELF_TEST_XG_1_BIT 0x04 |
csharer | 9:37a883451bf1 | 189 | #define MPU6050_SELF_TEST_XG_1_LENGTH 0x05 |
csharer | 9:37a883451bf1 | 190 | #define MPU6050_SELF_TEST_YG_1_BIT 0x04 |
csharer | 9:37a883451bf1 | 191 | #define MPU6050_SELF_TEST_YG_1_LENGTH 0x05 |
csharer | 9:37a883451bf1 | 192 | #define MPU6050_SELF_TEST_ZG_1_BIT 0x04 |
csharer | 9:37a883451bf1 | 193 | #define MPU6050_SELF_TEST_ZG_1_LENGTH 0x05 |
csharer | 9:37a883451bf1 | 194 | |
csharer | 9:37a883451bf1 | 195 | #define MPU6050_TC_PWR_MODE_BIT 7 |
csharer | 9:37a883451bf1 | 196 | #define MPU6050_TC_OFFSET_BIT 6 |
csharer | 9:37a883451bf1 | 197 | #define MPU6050_TC_OFFSET_LENGTH 6 |
csharer | 9:37a883451bf1 | 198 | #define MPU6050_TC_OTP_BNK_VLD_BIT 0 |
csharer | 9:37a883451bf1 | 199 | |
csharer | 9:37a883451bf1 | 200 | #define MPU6050_VDDIO_LEVEL_VLOGIC 0 |
csharer | 9:37a883451bf1 | 201 | #define MPU6050_VDDIO_LEVEL_VDD 1 |
csharer | 9:37a883451bf1 | 202 | |
csharer | 9:37a883451bf1 | 203 | #define MPU6050_CFG_EXT_SYNC_SET_BIT 5 |
csharer | 9:37a883451bf1 | 204 | #define MPU6050_CFG_EXT_SYNC_SET_LENGTH 3 |
csharer | 9:37a883451bf1 | 205 | #define MPU6050_CFG_DLPF_CFG_BIT 2 |
csharer | 9:37a883451bf1 | 206 | #define MPU6050_CFG_DLPF_CFG_LENGTH 3 |
csharer | 9:37a883451bf1 | 207 | |
csharer | 9:37a883451bf1 | 208 | #define MPU6050_EXT_SYNC_DISABLED 0x0 |
csharer | 9:37a883451bf1 | 209 | #define MPU6050_EXT_SYNC_TEMP_OUT_L 0x1 |
csharer | 9:37a883451bf1 | 210 | #define MPU6050_EXT_SYNC_GYRO_XOUT_L 0x2 |
csharer | 9:37a883451bf1 | 211 | #define MPU6050_EXT_SYNC_GYRO_YOUT_L 0x3 |
csharer | 9:37a883451bf1 | 212 | #define MPU6050_EXT_SYNC_GYRO_ZOUT_L 0x4 |
csharer | 9:37a883451bf1 | 213 | #define MPU6050_EXT_SYNC_ACCEL_XOUT_L 0x5 |
csharer | 9:37a883451bf1 | 214 | #define MPU6050_EXT_SYNC_ACCEL_YOUT_L 0x6 |
csharer | 9:37a883451bf1 | 215 | #define MPU6050_EXT_SYNC_ACCEL_ZOUT_L 0x7 |
csharer | 9:37a883451bf1 | 216 | |
csharer | 9:37a883451bf1 | 217 | #define MPU6050_DLPF_BW_256 0x00 |
csharer | 9:37a883451bf1 | 218 | #define MPU6050_DLPF_BW_188 0x01 |
csharer | 9:37a883451bf1 | 219 | #define MPU6050_DLPF_BW_98 0x02 |
csharer | 9:37a883451bf1 | 220 | #define MPU6050_DLPF_BW_42 0x03 |
csharer | 9:37a883451bf1 | 221 | #define MPU6050_DLPF_BW_20 0x04 |
csharer | 9:37a883451bf1 | 222 | #define MPU6050_DLPF_BW_10 0x05 |
csharer | 9:37a883451bf1 | 223 | #define MPU6050_DLPF_BW_5 0x06 |
csharer | 9:37a883451bf1 | 224 | |
csharer | 9:37a883451bf1 | 225 | #define MPU6050_GCONFIG_FS_SEL_BIT 4 |
csharer | 9:37a883451bf1 | 226 | #define MPU6050_GCONFIG_FS_SEL_LENGTH 2 |
csharer | 9:37a883451bf1 | 227 | |
csharer | 9:37a883451bf1 | 228 | #define MPU6050_GYRO_FS_250 0x00 |
csharer | 9:37a883451bf1 | 229 | #define MPU6050_GYRO_FS_500 0x01 |
csharer | 9:37a883451bf1 | 230 | #define MPU6050_GYRO_FS_1000 0x02 |
csharer | 9:37a883451bf1 | 231 | #define MPU6050_GYRO_FS_2000 0x03 |
csharer | 9:37a883451bf1 | 232 | |
csharer | 9:37a883451bf1 | 233 | #define MPU6050_ACONFIG_XA_ST_BIT 7 |
csharer | 9:37a883451bf1 | 234 | #define MPU6050_ACONFIG_YA_ST_BIT 6 |
csharer | 9:37a883451bf1 | 235 | #define MPU6050_ACONFIG_ZA_ST_BIT 5 |
csharer | 9:37a883451bf1 | 236 | #define MPU6050_ACONFIG_AFS_SEL_BIT 4 |
csharer | 9:37a883451bf1 | 237 | #define MPU6050_ACONFIG_AFS_SEL_LENGTH 2 |
csharer | 9:37a883451bf1 | 238 | #define MPU6050_ACONFIG_ACCEL_HPF_BIT 2 |
csharer | 9:37a883451bf1 | 239 | #define MPU6050_ACONFIG_ACCEL_HPF_LENGTH 3 |
csharer | 9:37a883451bf1 | 240 | |
csharer | 9:37a883451bf1 | 241 | #define MPU6050_ACCEL_FS_2 0x00 |
csharer | 9:37a883451bf1 | 242 | #define MPU6050_ACCEL_FS_4 0x01 |
csharer | 9:37a883451bf1 | 243 | #define MPU6050_ACCEL_FS_8 0x02 |
csharer | 9:37a883451bf1 | 244 | #define MPU6050_ACCEL_FS_16 0x03 |
csharer | 9:37a883451bf1 | 245 | |
csharer | 9:37a883451bf1 | 246 | #define MPU6050_DHPF_RESET 0x00 |
csharer | 9:37a883451bf1 | 247 | #define MPU6050_DHPF_5 0x01 |
csharer | 9:37a883451bf1 | 248 | #define MPU6050_DHPF_2P5 0x02 |
csharer | 9:37a883451bf1 | 249 | #define MPU6050_DHPF_1P25 0x03 |
csharer | 9:37a883451bf1 | 250 | #define MPU6050_DHPF_0P63 0x04 |
csharer | 9:37a883451bf1 | 251 | #define MPU6050_DHPF_HOLD 0x07 |
csharer | 9:37a883451bf1 | 252 | |
csharer | 9:37a883451bf1 | 253 | #define MPU6050_TEMP_FIFO_EN_BIT 7 |
csharer | 9:37a883451bf1 | 254 | #define MPU6050_XG_FIFO_EN_BIT 6 |
csharer | 9:37a883451bf1 | 255 | #define MPU6050_YG_FIFO_EN_BIT 5 |
csharer | 9:37a883451bf1 | 256 | #define MPU6050_ZG_FIFO_EN_BIT 4 |
csharer | 9:37a883451bf1 | 257 | #define MPU6050_ACCEL_FIFO_EN_BIT 3 |
csharer | 9:37a883451bf1 | 258 | #define MPU6050_SLV2_FIFO_EN_BIT 2 |
csharer | 9:37a883451bf1 | 259 | #define MPU6050_SLV1_FIFO_EN_BIT 1 |
csharer | 9:37a883451bf1 | 260 | #define MPU6050_SLV0_FIFO_EN_BIT 0 |
csharer | 9:37a883451bf1 | 261 | |
csharer | 9:37a883451bf1 | 262 | #define MPU6050_MULT_MST_EN_BIT 7 |
csharer | 9:37a883451bf1 | 263 | #define MPU6050_WAIT_FOR_ES_BIT 6 |
csharer | 9:37a883451bf1 | 264 | #define MPU6050_SLV_3_FIFO_EN_BIT 5 |
csharer | 9:37a883451bf1 | 265 | #define MPU6050_I2C_MST_P_NSR_BIT 4 |
csharer | 9:37a883451bf1 | 266 | #define MPU6050_I2C_MST_CLK_BIT 3 |
csharer | 9:37a883451bf1 | 267 | #define MPU6050_I2C_MST_CLK_LENGTH 4 |
csharer | 9:37a883451bf1 | 268 | |
csharer | 9:37a883451bf1 | 269 | #define MPU6050_CLOCK_DIV_348 0x0 |
csharer | 9:37a883451bf1 | 270 | #define MPU6050_CLOCK_DIV_333 0x1 |
csharer | 9:37a883451bf1 | 271 | #define MPU6050_CLOCK_DIV_320 0x2 |
csharer | 9:37a883451bf1 | 272 | #define MPU6050_CLOCK_DIV_308 0x3 |
csharer | 9:37a883451bf1 | 273 | #define MPU6050_CLOCK_DIV_296 0x4 |
csharer | 9:37a883451bf1 | 274 | #define MPU6050_CLOCK_DIV_286 0x5 |
csharer | 9:37a883451bf1 | 275 | #define MPU6050_CLOCK_DIV_276 0x6 |
csharer | 9:37a883451bf1 | 276 | #define MPU6050_CLOCK_DIV_267 0x7 |
csharer | 9:37a883451bf1 | 277 | #define MPU6050_CLOCK_DIV_258 0x8 |
csharer | 9:37a883451bf1 | 278 | #define MPU6050_CLOCK_DIV_500 0x9 |
csharer | 9:37a883451bf1 | 279 | #define MPU6050_CLOCK_DIV_471 0xA |
csharer | 9:37a883451bf1 | 280 | #define MPU6050_CLOCK_DIV_444 0xB |
csharer | 9:37a883451bf1 | 281 | #define MPU6050_CLOCK_DIV_421 0xC |
csharer | 9:37a883451bf1 | 282 | #define MPU6050_CLOCK_DIV_400 0xD |
csharer | 9:37a883451bf1 | 283 | #define MPU6050_CLOCK_DIV_381 0xE |
csharer | 9:37a883451bf1 | 284 | #define MPU6050_CLOCK_DIV_364 0xF |
csharer | 9:37a883451bf1 | 285 | |
csharer | 9:37a883451bf1 | 286 | #define MPU6050_I2C_SLV_RW_BIT 7 |
csharer | 9:37a883451bf1 | 287 | #define MPU6050_I2C_SLV_ADDR_BIT 6 |
csharer | 9:37a883451bf1 | 288 | #define MPU6050_I2C_SLV_ADDR_LENGTH 7 |
csharer | 9:37a883451bf1 | 289 | #define MPU6050_I2C_SLV_EN_BIT 7 |
csharer | 9:37a883451bf1 | 290 | #define MPU6050_I2C_SLV_BYTE_SW_BIT 6 |
csharer | 9:37a883451bf1 | 291 | #define MPU6050_I2C_SLV_REG_DIS_BIT 5 |
csharer | 9:37a883451bf1 | 292 | #define MPU6050_I2C_SLV_GRP_BIT 4 |
csharer | 9:37a883451bf1 | 293 | #define MPU6050_I2C_SLV_LEN_BIT 3 |
csharer | 9:37a883451bf1 | 294 | #define MPU6050_I2C_SLV_LEN_LENGTH 4 |
csharer | 9:37a883451bf1 | 295 | |
csharer | 9:37a883451bf1 | 296 | #define MPU6050_I2C_SLV4_RW_BIT 7 |
csharer | 9:37a883451bf1 | 297 | #define MPU6050_I2C_SLV4_ADDR_BIT 6 |
csharer | 9:37a883451bf1 | 298 | #define MPU6050_I2C_SLV4_ADDR_LENGTH 7 |
csharer | 9:37a883451bf1 | 299 | #define MPU6050_I2C_SLV4_EN_BIT 7 |
csharer | 9:37a883451bf1 | 300 | #define MPU6050_I2C_SLV4_INT_EN_BIT 6 |
csharer | 9:37a883451bf1 | 301 | #define MPU6050_I2C_SLV4_REG_DIS_BIT 5 |
csharer | 9:37a883451bf1 | 302 | #define MPU6050_I2C_SLV4_MST_DLY_BIT 4 |
csharer | 9:37a883451bf1 | 303 | #define MPU6050_I2C_SLV4_MST_DLY_LENGTH 5 |
csharer | 9:37a883451bf1 | 304 | |
csharer | 9:37a883451bf1 | 305 | #define MPU6050_MST_PASS_THROUGH_BIT 7 |
csharer | 9:37a883451bf1 | 306 | #define MPU6050_MST_I2C_SLV4_DONE_BIT 6 |
csharer | 9:37a883451bf1 | 307 | #define MPU6050_MST_I2C_LOST_ARB_BIT 5 |
csharer | 9:37a883451bf1 | 308 | #define MPU6050_MST_I2C_SLV4_NACK_BIT 4 |
csharer | 9:37a883451bf1 | 309 | #define MPU6050_MST_I2C_SLV3_NACK_BIT 3 |
csharer | 9:37a883451bf1 | 310 | #define MPU6050_MST_I2C_SLV2_NACK_BIT 2 |
csharer | 9:37a883451bf1 | 311 | #define MPU6050_MST_I2C_SLV1_NACK_BIT 1 |
csharer | 9:37a883451bf1 | 312 | #define MPU6050_MST_I2C_SLV0_NACK_BIT 0 |
csharer | 9:37a883451bf1 | 313 | |
csharer | 9:37a883451bf1 | 314 | #define MPU6050_INTCFG_INT_LEVEL_BIT 7 |
csharer | 9:37a883451bf1 | 315 | #define MPU6050_INTCFG_INT_OPEN_BIT 6 |
csharer | 9:37a883451bf1 | 316 | #define MPU6050_INTCFG_LATCH_INT_EN_BIT 5 |
csharer | 9:37a883451bf1 | 317 | #define MPU6050_INTCFG_INT_RD_CLEAR_BIT 4 |
csharer | 9:37a883451bf1 | 318 | #define MPU6050_INTCFG_FSYNC_INT_LEVEL_BIT 3 |
csharer | 9:37a883451bf1 | 319 | #define MPU6050_INTCFG_FSYNC_INT_EN_BIT 2 |
csharer | 9:37a883451bf1 | 320 | #define MPU6050_INTCFG_I2C_BYPASS_EN_BIT 1 |
csharer | 9:37a883451bf1 | 321 | #define MPU6050_INTCFG_CLKOUT_EN_BIT 0 |
csharer | 9:37a883451bf1 | 322 | |
csharer | 9:37a883451bf1 | 323 | #define MPU6050_INTMODE_ACTIVEHIGH 0x00 |
csharer | 9:37a883451bf1 | 324 | #define MPU6050_INTMODE_ACTIVELOW 0x01 |
csharer | 9:37a883451bf1 | 325 | |
csharer | 9:37a883451bf1 | 326 | #define MPU6050_INTDRV_PUSHPULL 0x00 |
csharer | 9:37a883451bf1 | 327 | #define MPU6050_INTDRV_OPENDRAIN 0x01 |
csharer | 9:37a883451bf1 | 328 | |
csharer | 9:37a883451bf1 | 329 | #define MPU6050_INTLATCH_50USPULSE 0x00 |
csharer | 9:37a883451bf1 | 330 | #define MPU6050_INTLATCH_WAITCLEAR 0x01 |
csharer | 9:37a883451bf1 | 331 | |
csharer | 9:37a883451bf1 | 332 | #define MPU6050_INTCLEAR_STATUSREAD 0x00 |
csharer | 9:37a883451bf1 | 333 | #define MPU6050_INTCLEAR_ANYREAD 0x01 |
csharer | 9:37a883451bf1 | 334 | |
csharer | 9:37a883451bf1 | 335 | #define MPU6050_INTERRUPT_FF_BIT 7 |
csharer | 9:37a883451bf1 | 336 | #define MPU6050_INTERRUPT_MOT_BIT 6 |
csharer | 9:37a883451bf1 | 337 | #define MPU6050_INTERRUPT_ZMOT_BIT 5 |
csharer | 9:37a883451bf1 | 338 | #define MPU6050_INTERRUPT_FIFO_OFLOW_BIT 4 |
csharer | 9:37a883451bf1 | 339 | #define MPU6050_INTERRUPT_I2C_MST_INT_BIT 3 |
csharer | 9:37a883451bf1 | 340 | #define MPU6050_INTERRUPT_PLL_RDY_INT_BIT 2 |
csharer | 9:37a883451bf1 | 341 | #define MPU6050_INTERRUPT_DMP_INT_BIT 1 |
csharer | 9:37a883451bf1 | 342 | #define MPU6050_INTERRUPT_DATA_RDY_BIT 0 |
csharer | 9:37a883451bf1 | 343 | |
csharer | 9:37a883451bf1 | 344 | // TODO: figure out what these actually do |
csharer | 9:37a883451bf1 | 345 | // UMPL source code is not very obivous |
csharer | 9:37a883451bf1 | 346 | #define MPU6050_DMPINT_5_BIT 5 |
csharer | 9:37a883451bf1 | 347 | #define MPU6050_DMPINT_4_BIT 4 |
csharer | 9:37a883451bf1 | 348 | #define MPU6050_DMPINT_3_BIT 3 |
csharer | 9:37a883451bf1 | 349 | #define MPU6050_DMPINT_2_BIT 2 |
csharer | 9:37a883451bf1 | 350 | #define MPU6050_DMPINT_1_BIT 1 |
csharer | 9:37a883451bf1 | 351 | #define MPU6050_DMPINT_0_BIT 0 |
csharer | 9:37a883451bf1 | 352 | |
csharer | 9:37a883451bf1 | 353 | #define MPU6050_MOTION_MOT_XNEG_BIT 7 |
csharer | 9:37a883451bf1 | 354 | #define MPU6050_MOTION_MOT_XPOS_BIT 6 |
csharer | 9:37a883451bf1 | 355 | #define MPU6050_MOTION_MOT_YNEG_BIT 5 |
csharer | 9:37a883451bf1 | 356 | #define MPU6050_MOTION_MOT_YPOS_BIT 4 |
csharer | 9:37a883451bf1 | 357 | #define MPU6050_MOTION_MOT_ZNEG_BIT 3 |
csharer | 9:37a883451bf1 | 358 | #define MPU6050_MOTION_MOT_ZPOS_BIT 2 |
csharer | 9:37a883451bf1 | 359 | #define MPU6050_MOTION_MOT_ZRMOT_BIT 0 |
csharer | 9:37a883451bf1 | 360 | |
csharer | 9:37a883451bf1 | 361 | #define MPU6050_DELAYCTRL_DELAY_ES_SHADOW_BIT 7 |
csharer | 9:37a883451bf1 | 362 | #define MPU6050_DELAYCTRL_I2C_SLV4_DLY_EN_BIT 4 |
csharer | 9:37a883451bf1 | 363 | #define MPU6050_DELAYCTRL_I2C_SLV3_DLY_EN_BIT 3 |
csharer | 9:37a883451bf1 | 364 | #define MPU6050_DELAYCTRL_I2C_SLV2_DLY_EN_BIT 2 |
csharer | 9:37a883451bf1 | 365 | #define MPU6050_DELAYCTRL_I2C_SLV1_DLY_EN_BIT 1 |
csharer | 9:37a883451bf1 | 366 | #define MPU6050_DELAYCTRL_I2C_SLV0_DLY_EN_BIT 0 |
csharer | 9:37a883451bf1 | 367 | |
csharer | 9:37a883451bf1 | 368 | #define MPU6050_PATHRESET_GYRO_RESET_BIT 2 |
csharer | 9:37a883451bf1 | 369 | #define MPU6050_PATHRESET_ACCEL_RESET_BIT 1 |
csharer | 9:37a883451bf1 | 370 | #define MPU6050_PATHRESET_TEMP_RESET_BIT 0 |
csharer | 9:37a883451bf1 | 371 | |
csharer | 9:37a883451bf1 | 372 | #define MPU6050_DETECT_ACCEL_ON_DELAY_BIT 5 |
csharer | 9:37a883451bf1 | 373 | #define MPU6050_DETECT_ACCEL_ON_DELAY_LENGTH 2 |
csharer | 9:37a883451bf1 | 374 | #define MPU6050_DETECT_FF_COUNT_BIT 3 |
csharer | 9:37a883451bf1 | 375 | #define MPU6050_DETECT_FF_COUNT_LENGTH 2 |
csharer | 9:37a883451bf1 | 376 | #define MPU6050_DETECT_MOT_COUNT_BIT 1 |
csharer | 9:37a883451bf1 | 377 | #define MPU6050_DETECT_MOT_COUNT_LENGTH 2 |
csharer | 9:37a883451bf1 | 378 | |
csharer | 9:37a883451bf1 | 379 | #define MPU6050_DETECT_DECREMENT_RESET 0x0 |
csharer | 9:37a883451bf1 | 380 | #define MPU6050_DETECT_DECREMENT_1 0x1 |
csharer | 9:37a883451bf1 | 381 | #define MPU6050_DETECT_DECREMENT_2 0x2 |
csharer | 9:37a883451bf1 | 382 | #define MPU6050_DETECT_DECREMENT_4 0x3 |
csharer | 9:37a883451bf1 | 383 | |
csharer | 9:37a883451bf1 | 384 | #define MPU6050_USERCTRL_DMP_EN_BIT 7 |
csharer | 9:37a883451bf1 | 385 | #define MPU6050_USERCTRL_FIFO_EN_BIT 6 |
csharer | 9:37a883451bf1 | 386 | #define MPU6050_USERCTRL_I2C_MST_EN_BIT 5 |
csharer | 9:37a883451bf1 | 387 | #define MPU6050_USERCTRL_I2C_IF_DIS_BIT 4 |
csharer | 9:37a883451bf1 | 388 | #define MPU6050_USERCTRL_DMP_RESET_BIT 3 |
csharer | 9:37a883451bf1 | 389 | #define MPU6050_USERCTRL_FIFO_RESET_BIT 2 |
csharer | 9:37a883451bf1 | 390 | #define MPU6050_USERCTRL_I2C_MST_RESET_BIT 1 |
csharer | 9:37a883451bf1 | 391 | #define MPU6050_USERCTRL_SIG_COND_RESET_BIT 0 |
csharer | 9:37a883451bf1 | 392 | |
csharer | 9:37a883451bf1 | 393 | #define MPU6050_PWR1_DEVICE_RESET_BIT 7 |
csharer | 9:37a883451bf1 | 394 | #define MPU6050_PWR1_SLEEP_BIT 6 |
csharer | 9:37a883451bf1 | 395 | #define MPU6050_PWR1_CYCLE_BIT 5 |
csharer | 9:37a883451bf1 | 396 | #define MPU6050_PWR1_TEMP_DIS_BIT 3 |
csharer | 9:37a883451bf1 | 397 | #define MPU6050_PWR1_CLKSEL_BIT 2 |
csharer | 9:37a883451bf1 | 398 | #define MPU6050_PWR1_CLKSEL_LENGTH 3 |
csharer | 9:37a883451bf1 | 399 | |
csharer | 9:37a883451bf1 | 400 | #define MPU6050_CLOCK_INTERNAL 0x00 |
csharer | 9:37a883451bf1 | 401 | #define MPU6050_CLOCK_PLL_XGYRO 0x01 |
csharer | 9:37a883451bf1 | 402 | #define MPU6050_CLOCK_PLL_YGYRO 0x02 |
csharer | 9:37a883451bf1 | 403 | #define MPU6050_CLOCK_PLL_ZGYRO 0x03 |
csharer | 9:37a883451bf1 | 404 | #define MPU6050_CLOCK_PLL_EXT32K 0x04 |
csharer | 9:37a883451bf1 | 405 | #define MPU6050_CLOCK_PLL_EXT19M 0x05 |
csharer | 9:37a883451bf1 | 406 | #define MPU6050_CLOCK_KEEP_RESET 0x07 |
csharer | 9:37a883451bf1 | 407 | |
csharer | 9:37a883451bf1 | 408 | #define MPU6050_PWR2_LP_WAKE_CTRL_BIT 7 |
csharer | 9:37a883451bf1 | 409 | #define MPU6050_PWR2_LP_WAKE_CTRL_LENGTH 2 |
csharer | 9:37a883451bf1 | 410 | #define MPU6050_PWR2_STBY_XA_BIT 5 |
csharer | 9:37a883451bf1 | 411 | #define MPU6050_PWR2_STBY_YA_BIT 4 |
csharer | 9:37a883451bf1 | 412 | #define MPU6050_PWR2_STBY_ZA_BIT 3 |
csharer | 9:37a883451bf1 | 413 | #define MPU6050_PWR2_STBY_XG_BIT 2 |
csharer | 9:37a883451bf1 | 414 | #define MPU6050_PWR2_STBY_YG_BIT 1 |
csharer | 9:37a883451bf1 | 415 | #define MPU6050_PWR2_STBY_ZG_BIT 0 |
csharer | 9:37a883451bf1 | 416 | |
csharer | 9:37a883451bf1 | 417 | #define MPU6050_WAKE_FREQ_1P25 0x0 |
csharer | 9:37a883451bf1 | 418 | #define MPU6050_WAKE_FREQ_2P5 0x1 |
csharer | 9:37a883451bf1 | 419 | #define MPU6050_WAKE_FREQ_5 0x2 |
csharer | 9:37a883451bf1 | 420 | #define MPU6050_WAKE_FREQ_10 0x3 |
csharer | 9:37a883451bf1 | 421 | |
csharer | 9:37a883451bf1 | 422 | #define MPU6050_BANKSEL_PRFTCH_EN_BIT 6 |
csharer | 9:37a883451bf1 | 423 | #define MPU6050_BANKSEL_CFG_USER_BANK_BIT 5 |
csharer | 9:37a883451bf1 | 424 | #define MPU6050_BANKSEL_MEM_SEL_BIT 4 |
csharer | 9:37a883451bf1 | 425 | #define MPU6050_BANKSEL_MEM_SEL_LENGTH 5 |
csharer | 9:37a883451bf1 | 426 | |
csharer | 9:37a883451bf1 | 427 | #define MPU6050_WHO_AM_I_BIT 6 |
csharer | 9:37a883451bf1 | 428 | #define MPU6050_WHO_AM_I_LENGTH 6 |
csharer | 9:37a883451bf1 | 429 | |
csharer | 9:37a883451bf1 | 430 | #define MPU6050_DMP_MEMORY_BANKS 8 |
csharer | 9:37a883451bf1 | 431 | #define MPU6050_DMP_MEMORY_BANK_SIZE 256 |
csharer | 9:37a883451bf1 | 432 | #define MPU6050_DMP_MEMORY_CHUNK_SIZE 16 |
csharer | 9:37a883451bf1 | 433 | |
csharer | 9:37a883451bf1 | 434 | // note: DMP code memory blocks defined at end of header file |
csharer | 9:37a883451bf1 | 435 | |
csharer | 9:37a883451bf1 | 436 | class MPU6050 { |
csharer | 9:37a883451bf1 | 437 | public: |
csharer | 9:37a883451bf1 | 438 | MPU6050(); |
csharer | 9:37a883451bf1 | 439 | MPU6050(uint8_t address); |
csharer | 9:37a883451bf1 | 440 | |
csharer | 9:37a883451bf1 | 441 | void initialize(); |
csharer | 9:37a883451bf1 | 442 | bool testConnection(); |
csharer | 9:37a883451bf1 | 443 | |
csharer | 9:37a883451bf1 | 444 | // AUX_VDDIO register |
csharer | 9:37a883451bf1 | 445 | uint8_t getAuxVDDIOLevel(); |
csharer | 9:37a883451bf1 | 446 | void setAuxVDDIOLevel(uint8_t level); |
csharer | 9:37a883451bf1 | 447 | |
csharer | 9:37a883451bf1 | 448 | // SMPLRT_DIV register |
csharer | 9:37a883451bf1 | 449 | uint8_t getRate(); |
csharer | 9:37a883451bf1 | 450 | void setRate(uint8_t rate); |
csharer | 9:37a883451bf1 | 451 | |
csharer | 9:37a883451bf1 | 452 | // CONFIG register |
csharer | 9:37a883451bf1 | 453 | uint8_t getExternalFrameSync(); |
csharer | 9:37a883451bf1 | 454 | void setExternalFrameSync(uint8_t sync); |
csharer | 9:37a883451bf1 | 455 | uint8_t getDLPFMode(); |
csharer | 9:37a883451bf1 | 456 | void setDLPFMode(uint8_t bandwidth); |
csharer | 9:37a883451bf1 | 457 | |
csharer | 9:37a883451bf1 | 458 | // GYRO_CONFIG register |
csharer | 9:37a883451bf1 | 459 | uint8_t getFullScaleGyroRange(); |
csharer | 9:37a883451bf1 | 460 | void setFullScaleGyroRange(uint8_t range); |
csharer | 9:37a883451bf1 | 461 | |
csharer | 9:37a883451bf1 | 462 | // SELF_TEST registers |
csharer | 9:37a883451bf1 | 463 | uint8_t getAccelXSelfTestFactoryTrim(); |
csharer | 9:37a883451bf1 | 464 | uint8_t getAccelYSelfTestFactoryTrim(); |
csharer | 9:37a883451bf1 | 465 | uint8_t getAccelZSelfTestFactoryTrim(); |
csharer | 9:37a883451bf1 | 466 | |
csharer | 9:37a883451bf1 | 467 | uint8_t getGyroXSelfTestFactoryTrim(); |
csharer | 9:37a883451bf1 | 468 | uint8_t getGyroYSelfTestFactoryTrim(); |
csharer | 9:37a883451bf1 | 469 | uint8_t getGyroZSelfTestFactoryTrim(); |
csharer | 9:37a883451bf1 | 470 | |
csharer | 9:37a883451bf1 | 471 | // ACCEL_CONFIG register |
csharer | 9:37a883451bf1 | 472 | bool getAccelXSelfTest(); |
csharer | 9:37a883451bf1 | 473 | void setAccelXSelfTest(bool enabled); |
csharer | 9:37a883451bf1 | 474 | bool getAccelYSelfTest(); |
csharer | 9:37a883451bf1 | 475 | void setAccelYSelfTest(bool enabled); |
csharer | 9:37a883451bf1 | 476 | bool getAccelZSelfTest(); |
csharer | 9:37a883451bf1 | 477 | void setAccelZSelfTest(bool enabled); |
csharer | 9:37a883451bf1 | 478 | uint8_t getFullScaleAccelRange(); |
csharer | 9:37a883451bf1 | 479 | void setFullScaleAccelRange(uint8_t range); |
csharer | 9:37a883451bf1 | 480 | uint8_t getDHPFMode(); |
csharer | 9:37a883451bf1 | 481 | void setDHPFMode(uint8_t mode); |
csharer | 9:37a883451bf1 | 482 | |
csharer | 9:37a883451bf1 | 483 | // FF_THR register |
csharer | 9:37a883451bf1 | 484 | uint8_t getFreefallDetectionThreshold(); |
csharer | 9:37a883451bf1 | 485 | void setFreefallDetectionThreshold(uint8_t threshold); |
csharer | 9:37a883451bf1 | 486 | |
csharer | 9:37a883451bf1 | 487 | // FF_DUR register |
csharer | 9:37a883451bf1 | 488 | uint8_t getFreefallDetectionDuration(); |
csharer | 9:37a883451bf1 | 489 | void setFreefallDetectionDuration(uint8_t duration); |
csharer | 9:37a883451bf1 | 490 | |
csharer | 9:37a883451bf1 | 491 | // MOT_THR register |
csharer | 9:37a883451bf1 | 492 | uint8_t getMotionDetectionThreshold(); |
csharer | 9:37a883451bf1 | 493 | void setMotionDetectionThreshold(uint8_t threshold); |
csharer | 9:37a883451bf1 | 494 | |
csharer | 9:37a883451bf1 | 495 | // MOT_DUR register |
csharer | 9:37a883451bf1 | 496 | uint8_t getMotionDetectionDuration(); |
csharer | 9:37a883451bf1 | 497 | void setMotionDetectionDuration(uint8_t duration); |
csharer | 9:37a883451bf1 | 498 | |
csharer | 9:37a883451bf1 | 499 | // ZRMOT_THR register |
csharer | 9:37a883451bf1 | 500 | uint8_t getZeroMotionDetectionThreshold(); |
csharer | 9:37a883451bf1 | 501 | void setZeroMotionDetectionThreshold(uint8_t threshold); |
csharer | 9:37a883451bf1 | 502 | |
csharer | 9:37a883451bf1 | 503 | // ZRMOT_DUR register |
csharer | 9:37a883451bf1 | 504 | uint8_t getZeroMotionDetectionDuration(); |
csharer | 9:37a883451bf1 | 505 | void setZeroMotionDetectionDuration(uint8_t duration); |
csharer | 9:37a883451bf1 | 506 | |
csharer | 9:37a883451bf1 | 507 | // FIFO_EN register |
csharer | 9:37a883451bf1 | 508 | bool getTempFIFOEnabled(); |
csharer | 9:37a883451bf1 | 509 | void setTempFIFOEnabled(bool enabled); |
csharer | 9:37a883451bf1 | 510 | bool getXGyroFIFOEnabled(); |
csharer | 9:37a883451bf1 | 511 | void setXGyroFIFOEnabled(bool enabled); |
csharer | 9:37a883451bf1 | 512 | bool getYGyroFIFOEnabled(); |
csharer | 9:37a883451bf1 | 513 | void setYGyroFIFOEnabled(bool enabled); |
csharer | 9:37a883451bf1 | 514 | bool getZGyroFIFOEnabled(); |
csharer | 9:37a883451bf1 | 515 | void setZGyroFIFOEnabled(bool enabled); |
csharer | 9:37a883451bf1 | 516 | bool getAccelFIFOEnabled(); |
csharer | 9:37a883451bf1 | 517 | void setAccelFIFOEnabled(bool enabled); |
csharer | 9:37a883451bf1 | 518 | bool getSlave2FIFOEnabled(); |
csharer | 9:37a883451bf1 | 519 | void setSlave2FIFOEnabled(bool enabled); |
csharer | 9:37a883451bf1 | 520 | bool getSlave1FIFOEnabled(); |
csharer | 9:37a883451bf1 | 521 | void setSlave1FIFOEnabled(bool enabled); |
csharer | 9:37a883451bf1 | 522 | bool getSlave0FIFOEnabled(); |
csharer | 9:37a883451bf1 | 523 | void setSlave0FIFOEnabled(bool enabled); |
csharer | 9:37a883451bf1 | 524 | |
csharer | 9:37a883451bf1 | 525 | // I2C_MST_CTRL register |
csharer | 9:37a883451bf1 | 526 | bool getMultiMasterEnabled(); |
csharer | 9:37a883451bf1 | 527 | void setMultiMasterEnabled(bool enabled); |
csharer | 9:37a883451bf1 | 528 | bool getWaitForExternalSensorEnabled(); |
csharer | 9:37a883451bf1 | 529 | void setWaitForExternalSensorEnabled(bool enabled); |
csharer | 9:37a883451bf1 | 530 | bool getSlave3FIFOEnabled(); |
csharer | 9:37a883451bf1 | 531 | void setSlave3FIFOEnabled(bool enabled); |
csharer | 9:37a883451bf1 | 532 | bool getSlaveReadWriteTransitionEnabled(); |
csharer | 9:37a883451bf1 | 533 | void setSlaveReadWriteTransitionEnabled(bool enabled); |
csharer | 9:37a883451bf1 | 534 | uint8_t getMasterClockSpeed(); |
csharer | 9:37a883451bf1 | 535 | void setMasterClockSpeed(uint8_t speed); |
csharer | 9:37a883451bf1 | 536 | |
csharer | 9:37a883451bf1 | 537 | // I2C_SLV* registers (Slave 0-3) |
csharer | 9:37a883451bf1 | 538 | uint8_t getSlaveAddress(uint8_t num); |
csharer | 9:37a883451bf1 | 539 | void setSlaveAddress(uint8_t num, uint8_t address); |
csharer | 9:37a883451bf1 | 540 | uint8_t getSlaveRegister(uint8_t num); |
csharer | 9:37a883451bf1 | 541 | void setSlaveRegister(uint8_t num, uint8_t reg); |
csharer | 9:37a883451bf1 | 542 | bool getSlaveEnabled(uint8_t num); |
csharer | 9:37a883451bf1 | 543 | void setSlaveEnabled(uint8_t num, bool enabled); |
csharer | 9:37a883451bf1 | 544 | bool getSlaveWordByteSwap(uint8_t num); |
csharer | 9:37a883451bf1 | 545 | void setSlaveWordByteSwap(uint8_t num, bool enabled); |
csharer | 9:37a883451bf1 | 546 | bool getSlaveWriteMode(uint8_t num); |
csharer | 9:37a883451bf1 | 547 | void setSlaveWriteMode(uint8_t num, bool mode); |
csharer | 9:37a883451bf1 | 548 | bool getSlaveWordGroupOffset(uint8_t num); |
csharer | 9:37a883451bf1 | 549 | void setSlaveWordGroupOffset(uint8_t num, bool enabled); |
csharer | 9:37a883451bf1 | 550 | uint8_t getSlaveDataLength(uint8_t num); |
csharer | 9:37a883451bf1 | 551 | void setSlaveDataLength(uint8_t num, uint8_t length); |
csharer | 9:37a883451bf1 | 552 | |
csharer | 9:37a883451bf1 | 553 | // I2C_SLV* registers (Slave 4) |
csharer | 9:37a883451bf1 | 554 | uint8_t getSlave4Address(); |
csharer | 9:37a883451bf1 | 555 | void setSlave4Address(uint8_t address); |
csharer | 9:37a883451bf1 | 556 | uint8_t getSlave4Register(); |
csharer | 9:37a883451bf1 | 557 | void setSlave4Register(uint8_t reg); |
csharer | 9:37a883451bf1 | 558 | void setSlave4OutputByte(uint8_t data); |
csharer | 9:37a883451bf1 | 559 | bool getSlave4Enabled(); |
csharer | 9:37a883451bf1 | 560 | void setSlave4Enabled(bool enabled); |
csharer | 9:37a883451bf1 | 561 | bool getSlave4InterruptEnabled(); |
csharer | 9:37a883451bf1 | 562 | void setSlave4InterruptEnabled(bool enabled); |
csharer | 9:37a883451bf1 | 563 | bool getSlave4WriteMode(); |
csharer | 9:37a883451bf1 | 564 | void setSlave4WriteMode(bool mode); |
csharer | 9:37a883451bf1 | 565 | uint8_t getSlave4MasterDelay(); |
csharer | 9:37a883451bf1 | 566 | void setSlave4MasterDelay(uint8_t delay); |
csharer | 9:37a883451bf1 | 567 | uint8_t getSlate4InputByte(); |
csharer | 9:37a883451bf1 | 568 | |
csharer | 9:37a883451bf1 | 569 | // I2C_MST_STATUS register |
csharer | 9:37a883451bf1 | 570 | bool getPassthroughStatus(); |
csharer | 9:37a883451bf1 | 571 | bool getSlave4IsDone(); |
csharer | 9:37a883451bf1 | 572 | bool getLostArbitration(); |
csharer | 9:37a883451bf1 | 573 | bool getSlave4Nack(); |
csharer | 9:37a883451bf1 | 574 | bool getSlave3Nack(); |
csharer | 9:37a883451bf1 | 575 | bool getSlave2Nack(); |
csharer | 9:37a883451bf1 | 576 | bool getSlave1Nack(); |
csharer | 9:37a883451bf1 | 577 | bool getSlave0Nack(); |
csharer | 9:37a883451bf1 | 578 | |
csharer | 9:37a883451bf1 | 579 | // INT_PIN_CFG register |
csharer | 9:37a883451bf1 | 580 | bool getInterruptMode(); |
csharer | 9:37a883451bf1 | 581 | void setInterruptMode(bool mode); |
csharer | 9:37a883451bf1 | 582 | bool getInterruptDrive(); |
csharer | 9:37a883451bf1 | 583 | void setInterruptDrive(bool drive); |
csharer | 9:37a883451bf1 | 584 | bool getInterruptLatch(); |
csharer | 9:37a883451bf1 | 585 | void setInterruptLatch(bool latch); |
csharer | 9:37a883451bf1 | 586 | bool getInterruptLatchClear(); |
csharer | 9:37a883451bf1 | 587 | void setInterruptLatchClear(bool clear); |
csharer | 9:37a883451bf1 | 588 | bool getFSyncInterruptLevel(); |
csharer | 9:37a883451bf1 | 589 | void setFSyncInterruptLevel(bool level); |
csharer | 9:37a883451bf1 | 590 | bool getFSyncInterruptEnabled(); |
csharer | 9:37a883451bf1 | 591 | void setFSyncInterruptEnabled(bool enabled); |
csharer | 9:37a883451bf1 | 592 | bool getI2CBypassEnabled(); |
csharer | 9:37a883451bf1 | 593 | void setI2CBypassEnabled(bool enabled); |
csharer | 9:37a883451bf1 | 594 | bool getClockOutputEnabled(); |
csharer | 9:37a883451bf1 | 595 | void setClockOutputEnabled(bool enabled); |
csharer | 9:37a883451bf1 | 596 | |
csharer | 9:37a883451bf1 | 597 | // INT_ENABLE register |
csharer | 9:37a883451bf1 | 598 | uint8_t getIntEnabled(); |
csharer | 9:37a883451bf1 | 599 | void setIntEnabled(uint8_t enabled); |
csharer | 9:37a883451bf1 | 600 | bool getIntFreefallEnabled(); |
csharer | 9:37a883451bf1 | 601 | void setIntFreefallEnabled(bool enabled); |
csharer | 9:37a883451bf1 | 602 | bool getIntMotionEnabled(); |
csharer | 9:37a883451bf1 | 603 | void setIntMotionEnabled(bool enabled); |
csharer | 9:37a883451bf1 | 604 | bool getIntZeroMotionEnabled(); |
csharer | 9:37a883451bf1 | 605 | void setIntZeroMotionEnabled(bool enabled); |
csharer | 9:37a883451bf1 | 606 | bool getIntFIFOBufferOverflowEnabled(); |
csharer | 9:37a883451bf1 | 607 | void setIntFIFOBufferOverflowEnabled(bool enabled); |
csharer | 9:37a883451bf1 | 608 | bool getIntI2CMasterEnabled(); |
csharer | 9:37a883451bf1 | 609 | void setIntI2CMasterEnabled(bool enabled); |
csharer | 9:37a883451bf1 | 610 | bool getIntDataReadyEnabled(); |
csharer | 9:37a883451bf1 | 611 | void setIntDataReadyEnabled(bool enabled); |
csharer | 9:37a883451bf1 | 612 | |
csharer | 9:37a883451bf1 | 613 | // INT_STATUS register |
csharer | 9:37a883451bf1 | 614 | uint8_t getIntStatus(); |
csharer | 9:37a883451bf1 | 615 | bool getIntFreefallStatus(); |
csharer | 9:37a883451bf1 | 616 | bool getIntMotionStatus(); |
csharer | 9:37a883451bf1 | 617 | bool getIntZeroMotionStatus(); |
csharer | 9:37a883451bf1 | 618 | bool getIntFIFOBufferOverflowStatus(); |
csharer | 9:37a883451bf1 | 619 | bool getIntI2CMasterStatus(); |
csharer | 9:37a883451bf1 | 620 | bool getIntDataReadyStatus(); |
csharer | 9:37a883451bf1 | 621 | |
csharer | 9:37a883451bf1 | 622 | // ACCEL_*OUT_* registers |
csharer | 9:37a883451bf1 | 623 | void getMotion9(int16_t* ax, int16_t* ay, int16_t* az, int16_t* gx, int16_t* gy, int16_t* gz, int16_t* mx, int16_t* my, int16_t* mz); |
csharer | 9:37a883451bf1 | 624 | void getMotion6(int16_t* ax, int16_t* ay, int16_t* az, int16_t* gx, int16_t* gy, int16_t* gz); |
csharer | 9:37a883451bf1 | 625 | void getAcceleration(int16_t* x, int16_t* y, int16_t* z); |
csharer | 9:37a883451bf1 | 626 | int16_t getAccelerationX(); |
csharer | 9:37a883451bf1 | 627 | int16_t getAccelerationY(); |
csharer | 9:37a883451bf1 | 628 | int16_t getAccelerationZ(); |
csharer | 9:37a883451bf1 | 629 | |
csharer | 9:37a883451bf1 | 630 | // TEMP_OUT_* registers |
csharer | 9:37a883451bf1 | 631 | int16_t getTemperature(); |
csharer | 9:37a883451bf1 | 632 | |
csharer | 9:37a883451bf1 | 633 | // GYRO_*OUT_* registers |
csharer | 9:37a883451bf1 | 634 | void getRotation(int16_t* x, int16_t* y, int16_t* z); |
csharer | 9:37a883451bf1 | 635 | int16_t getRotationX(); |
csharer | 9:37a883451bf1 | 636 | int16_t getRotationY(); |
csharer | 9:37a883451bf1 | 637 | int16_t getRotationZ(); |
csharer | 9:37a883451bf1 | 638 | |
csharer | 9:37a883451bf1 | 639 | // EXT_SENS_DATA_* registers |
csharer | 9:37a883451bf1 | 640 | uint8_t getExternalSensorByte(int position); |
csharer | 9:37a883451bf1 | 641 | uint16_t getExternalSensorWord(int position); |
csharer | 9:37a883451bf1 | 642 | uint32_t getExternalSensorDWord(int position); |
csharer | 9:37a883451bf1 | 643 | |
csharer | 9:37a883451bf1 | 644 | // MOT_DETECT_STATUS register |
csharer | 9:37a883451bf1 | 645 | uint8_t getMotionStatus(); |
csharer | 9:37a883451bf1 | 646 | bool getXNegMotionDetected(); |
csharer | 9:37a883451bf1 | 647 | bool getXPosMotionDetected(); |
csharer | 9:37a883451bf1 | 648 | bool getYNegMotionDetected(); |
csharer | 9:37a883451bf1 | 649 | bool getYPosMotionDetected(); |
csharer | 9:37a883451bf1 | 650 | bool getZNegMotionDetected(); |
csharer | 9:37a883451bf1 | 651 | bool getZPosMotionDetected(); |
csharer | 9:37a883451bf1 | 652 | bool getZeroMotionDetected(); |
csharer | 9:37a883451bf1 | 653 | |
csharer | 9:37a883451bf1 | 654 | // I2C_SLV*_DO register |
csharer | 9:37a883451bf1 | 655 | void setSlaveOutputByte(uint8_t num, uint8_t data); |
csharer | 9:37a883451bf1 | 656 | |
csharer | 9:37a883451bf1 | 657 | // I2C_MST_DELAY_CTRL register |
csharer | 9:37a883451bf1 | 658 | bool getExternalShadowDelayEnabled(); |
csharer | 9:37a883451bf1 | 659 | void setExternalShadowDelayEnabled(bool enabled); |
csharer | 9:37a883451bf1 | 660 | bool getSlaveDelayEnabled(uint8_t num); |
csharer | 9:37a883451bf1 | 661 | void setSlaveDelayEnabled(uint8_t num, bool enabled); |
csharer | 9:37a883451bf1 | 662 | |
csharer | 9:37a883451bf1 | 663 | // SIGNAL_PATH_RESET register |
csharer | 9:37a883451bf1 | 664 | void resetGyroscopePath(); |
csharer | 9:37a883451bf1 | 665 | void resetAccelerometerPath(); |
csharer | 9:37a883451bf1 | 666 | void resetTemperaturePath(); |
csharer | 9:37a883451bf1 | 667 | |
csharer | 9:37a883451bf1 | 668 | // MOT_DETECT_CTRL register |
csharer | 9:37a883451bf1 | 669 | uint8_t getAccelerometerPowerOnDelay(); |
csharer | 9:37a883451bf1 | 670 | void setAccelerometerPowerOnDelay(uint8_t delay); |
csharer | 9:37a883451bf1 | 671 | uint8_t getFreefallDetectionCounterDecrement(); |
csharer | 9:37a883451bf1 | 672 | void setFreefallDetectionCounterDecrement(uint8_t decrement); |
csharer | 9:37a883451bf1 | 673 | uint8_t getMotionDetectionCounterDecrement(); |
csharer | 9:37a883451bf1 | 674 | void setMotionDetectionCounterDecrement(uint8_t decrement); |
csharer | 9:37a883451bf1 | 675 | |
csharer | 9:37a883451bf1 | 676 | // USER_CTRL register |
csharer | 9:37a883451bf1 | 677 | bool getFIFOEnabled(); |
csharer | 9:37a883451bf1 | 678 | void setFIFOEnabled(bool enabled); |
csharer | 9:37a883451bf1 | 679 | bool getI2CMasterModeEnabled(); |
csharer | 9:37a883451bf1 | 680 | void setI2CMasterModeEnabled(bool enabled); |
csharer | 9:37a883451bf1 | 681 | void switchSPIEnabled(bool enabled); |
csharer | 9:37a883451bf1 | 682 | void resetFIFO(); |
csharer | 9:37a883451bf1 | 683 | void resetI2CMaster(); |
csharer | 9:37a883451bf1 | 684 | void resetSensors(); |
csharer | 9:37a883451bf1 | 685 | |
csharer | 9:37a883451bf1 | 686 | // PWR_MGMT_1 register |
csharer | 9:37a883451bf1 | 687 | void reset(); |
csharer | 9:37a883451bf1 | 688 | bool getSleepEnabled(); |
csharer | 9:37a883451bf1 | 689 | void setSleepEnabled(bool enabled); |
csharer | 9:37a883451bf1 | 690 | bool getWakeCycleEnabled(); |
csharer | 9:37a883451bf1 | 691 | void setWakeCycleEnabled(bool enabled); |
csharer | 9:37a883451bf1 | 692 | bool getTempSensorEnabled(); |
csharer | 9:37a883451bf1 | 693 | void setTempSensorEnabled(bool enabled); |
csharer | 9:37a883451bf1 | 694 | uint8_t getClockSource(); |
csharer | 9:37a883451bf1 | 695 | void setClockSource(uint8_t source); |
csharer | 9:37a883451bf1 | 696 | |
csharer | 9:37a883451bf1 | 697 | // PWR_MGMT_2 register |
csharer | 9:37a883451bf1 | 698 | uint8_t getWakeFrequency(); |
csharer | 9:37a883451bf1 | 699 | void setWakeFrequency(uint8_t frequency); |
csharer | 9:37a883451bf1 | 700 | bool getStandbyXAccelEnabled(); |
csharer | 9:37a883451bf1 | 701 | void setStandbyXAccelEnabled(bool enabled); |
csharer | 9:37a883451bf1 | 702 | bool getStandbyYAccelEnabled(); |
csharer | 9:37a883451bf1 | 703 | void setStandbyYAccelEnabled(bool enabled); |
csharer | 9:37a883451bf1 | 704 | bool getStandbyZAccelEnabled(); |
csharer | 9:37a883451bf1 | 705 | void setStandbyZAccelEnabled(bool enabled); |
csharer | 9:37a883451bf1 | 706 | bool getStandbyXGyroEnabled(); |
csharer | 9:37a883451bf1 | 707 | void setStandbyXGyroEnabled(bool enabled); |
csharer | 9:37a883451bf1 | 708 | bool getStandbyYGyroEnabled(); |
csharer | 9:37a883451bf1 | 709 | void setStandbyYGyroEnabled(bool enabled); |
csharer | 9:37a883451bf1 | 710 | bool getStandbyZGyroEnabled(); |
csharer | 9:37a883451bf1 | 711 | void setStandbyZGyroEnabled(bool enabled); |
csharer | 9:37a883451bf1 | 712 | |
csharer | 9:37a883451bf1 | 713 | // FIFO_COUNT_* registers |
csharer | 9:37a883451bf1 | 714 | uint16_t getFIFOCount(); |
csharer | 9:37a883451bf1 | 715 | |
csharer | 9:37a883451bf1 | 716 | // FIFO_R_W register |
csharer | 9:37a883451bf1 | 717 | uint8_t getFIFOByte(); |
csharer | 9:37a883451bf1 | 718 | void setFIFOByte(uint8_t data); |
csharer | 9:37a883451bf1 | 719 | void getFIFOBytes(uint8_t *data, uint8_t length); |
csharer | 9:37a883451bf1 | 720 | |
csharer | 9:37a883451bf1 | 721 | // WHO_AM_I register |
csharer | 9:37a883451bf1 | 722 | uint8_t getDeviceID(); |
csharer | 9:37a883451bf1 | 723 | void setDeviceID(uint8_t id); |
csharer | 9:37a883451bf1 | 724 | |
csharer | 9:37a883451bf1 | 725 | // ======== UNDOCUMENTED/DMP REGISTERS/METHODS ======== |
csharer | 9:37a883451bf1 | 726 | |
csharer | 9:37a883451bf1 | 727 | // XG_OFFS_TC register |
csharer | 9:37a883451bf1 | 728 | uint8_t getOTPBankValid(); |
csharer | 9:37a883451bf1 | 729 | void setOTPBankValid(bool enabled); |
csharer | 9:37a883451bf1 | 730 | int8_t getXGyroOffsetTC(); |
csharer | 9:37a883451bf1 | 731 | void setXGyroOffsetTC(int8_t offset); |
csharer | 9:37a883451bf1 | 732 | |
csharer | 9:37a883451bf1 | 733 | // YG_OFFS_TC register |
csharer | 9:37a883451bf1 | 734 | int8_t getYGyroOffsetTC(); |
csharer | 9:37a883451bf1 | 735 | void setYGyroOffsetTC(int8_t offset); |
csharer | 9:37a883451bf1 | 736 | |
csharer | 9:37a883451bf1 | 737 | // ZG_OFFS_TC register |
csharer | 9:37a883451bf1 | 738 | int8_t getZGyroOffsetTC(); |
csharer | 9:37a883451bf1 | 739 | void setZGyroOffsetTC(int8_t offset); |
csharer | 9:37a883451bf1 | 740 | |
csharer | 9:37a883451bf1 | 741 | // X_FINE_GAIN register |
csharer | 9:37a883451bf1 | 742 | int8_t getXFineGain(); |
csharer | 9:37a883451bf1 | 743 | void setXFineGain(int8_t gain); |
csharer | 9:37a883451bf1 | 744 | |
csharer | 9:37a883451bf1 | 745 | // Y_FINE_GAIN register |
csharer | 9:37a883451bf1 | 746 | int8_t getYFineGain(); |
csharer | 9:37a883451bf1 | 747 | void setYFineGain(int8_t gain); |
csharer | 9:37a883451bf1 | 748 | |
csharer | 9:37a883451bf1 | 749 | // Z_FINE_GAIN register |
csharer | 9:37a883451bf1 | 750 | int8_t getZFineGain(); |
csharer | 9:37a883451bf1 | 751 | void setZFineGain(int8_t gain); |
csharer | 9:37a883451bf1 | 752 | |
csharer | 9:37a883451bf1 | 753 | // XA_OFFS_* registers |
csharer | 9:37a883451bf1 | 754 | int16_t getXAccelOffset(); |
csharer | 9:37a883451bf1 | 755 | void setXAccelOffset(int16_t offset); |
csharer | 9:37a883451bf1 | 756 | |
csharer | 9:37a883451bf1 | 757 | // YA_OFFS_* register |
csharer | 9:37a883451bf1 | 758 | int16_t getYAccelOffset(); |
csharer | 9:37a883451bf1 | 759 | void setYAccelOffset(int16_t offset); |
csharer | 9:37a883451bf1 | 760 | |
csharer | 9:37a883451bf1 | 761 | // ZA_OFFS_* register |
csharer | 9:37a883451bf1 | 762 | int16_t getZAccelOffset(); |
csharer | 9:37a883451bf1 | 763 | void setZAccelOffset(int16_t offset); |
csharer | 9:37a883451bf1 | 764 | |
csharer | 9:37a883451bf1 | 765 | // XG_OFFS_USR* registers |
csharer | 9:37a883451bf1 | 766 | int16_t getXGyroOffset(); |
csharer | 9:37a883451bf1 | 767 | void setXGyroOffset(int16_t offset); |
csharer | 9:37a883451bf1 | 768 | |
csharer | 9:37a883451bf1 | 769 | // YG_OFFS_USR* register |
csharer | 9:37a883451bf1 | 770 | int16_t getYGyroOffset(); |
csharer | 9:37a883451bf1 | 771 | void setYGyroOffset(int16_t offset); |
csharer | 9:37a883451bf1 | 772 | |
csharer | 9:37a883451bf1 | 773 | // ZG_OFFS_USR* register |
csharer | 9:37a883451bf1 | 774 | int16_t getZGyroOffset(); |
csharer | 9:37a883451bf1 | 775 | void setZGyroOffset(int16_t offset); |
csharer | 9:37a883451bf1 | 776 | |
csharer | 9:37a883451bf1 | 777 | // INT_ENABLE register (DMP functions) |
csharer | 9:37a883451bf1 | 778 | bool getIntPLLReadyEnabled(); |
csharer | 9:37a883451bf1 | 779 | void setIntPLLReadyEnabled(bool enabled); |
csharer | 9:37a883451bf1 | 780 | bool getIntDMPEnabled(); |
csharer | 9:37a883451bf1 | 781 | void setIntDMPEnabled(bool enabled); |
csharer | 9:37a883451bf1 | 782 | |
csharer | 9:37a883451bf1 | 783 | // DMP_INT_STATUS |
csharer | 9:37a883451bf1 | 784 | bool getDMPInt5Status(); |
csharer | 9:37a883451bf1 | 785 | bool getDMPInt4Status(); |
csharer | 9:37a883451bf1 | 786 | bool getDMPInt3Status(); |
csharer | 9:37a883451bf1 | 787 | bool getDMPInt2Status(); |
csharer | 9:37a883451bf1 | 788 | bool getDMPInt1Status(); |
csharer | 9:37a883451bf1 | 789 | bool getDMPInt0Status(); |
csharer | 9:37a883451bf1 | 790 | |
csharer | 9:37a883451bf1 | 791 | // INT_STATUS register (DMP functions) |
csharer | 9:37a883451bf1 | 792 | bool getIntPLLReadyStatus(); |
csharer | 9:37a883451bf1 | 793 | bool getIntDMPStatus(); |
csharer | 9:37a883451bf1 | 794 | |
csharer | 9:37a883451bf1 | 795 | // USER_CTRL register (DMP functions) |
csharer | 9:37a883451bf1 | 796 | bool getDMPEnabled(); |
csharer | 9:37a883451bf1 | 797 | void setDMPEnabled(bool enabled); |
csharer | 9:37a883451bf1 | 798 | void resetDMP(); |
csharer | 9:37a883451bf1 | 799 | |
csharer | 9:37a883451bf1 | 800 | // BANK_SEL register |
csharer | 9:37a883451bf1 | 801 | void setMemoryBank(uint8_t bank, bool prefetchEnabled=false, bool userBank=false); |
csharer | 9:37a883451bf1 | 802 | |
csharer | 9:37a883451bf1 | 803 | // MEM_START_ADDR register |
csharer | 9:37a883451bf1 | 804 | void setMemoryStartAddress(uint8_t address); |
csharer | 9:37a883451bf1 | 805 | |
csharer | 9:37a883451bf1 | 806 | // MEM_R_W register |
csharer | 9:37a883451bf1 | 807 | uint8_t readMemoryByte(); |
csharer | 9:37a883451bf1 | 808 | void writeMemoryByte(uint8_t data); |
csharer | 9:37a883451bf1 | 809 | void readMemoryBlock(uint8_t *data, uint16_t dataSize, uint8_t bank=0, uint8_t address=0); |
csharer | 9:37a883451bf1 | 810 | bool writeMemoryBlock(const uint8_t *data, uint16_t dataSize, uint8_t bank=0, uint8_t address=0, bool verify=true, bool useProgMem=false); |
csharer | 9:37a883451bf1 | 811 | bool writeProgMemoryBlock(const uint8_t *data, uint16_t dataSize, uint8_t bank=0, uint8_t address=0, bool verify=true); |
csharer | 9:37a883451bf1 | 812 | |
csharer | 9:37a883451bf1 | 813 | bool writeDMPConfigurationSet(const uint8_t *data, uint16_t dataSize, bool useProgMem=false); |
csharer | 9:37a883451bf1 | 814 | bool writeProgDMPConfigurationSet(const uint8_t *data, uint16_t dataSize); |
csharer | 9:37a883451bf1 | 815 | |
csharer | 9:37a883451bf1 | 816 | // DMP_CFG_1 register |
csharer | 9:37a883451bf1 | 817 | uint8_t getDMPConfig1(); |
csharer | 9:37a883451bf1 | 818 | void setDMPConfig1(uint8_t config); |
csharer | 9:37a883451bf1 | 819 | |
csharer | 9:37a883451bf1 | 820 | // DMP_CFG_2 register |
csharer | 9:37a883451bf1 | 821 | uint8_t getDMPConfig2(); |
csharer | 9:37a883451bf1 | 822 | void setDMPConfig2(uint8_t config); |
csharer | 9:37a883451bf1 | 823 | |
csharer | 9:37a883451bf1 | 824 | // special methods for MotionApps 2.0 implementation |
csharer | 9:37a883451bf1 | 825 | #ifdef MPU6050_INCLUDE_DMP_MOTIONAPPS20 |
csharer | 9:37a883451bf1 | 826 | uint8_t *dmpPacketBuffer; |
csharer | 9:37a883451bf1 | 827 | uint16_t dmpPacketSize; |
csharer | 9:37a883451bf1 | 828 | |
csharer | 9:37a883451bf1 | 829 | uint8_t dmpInitialize(); |
csharer | 9:37a883451bf1 | 830 | bool dmpPacketAvailable(); |
csharer | 9:37a883451bf1 | 831 | |
csharer | 9:37a883451bf1 | 832 | uint8_t dmpSetFIFORate(uint8_t fifoRate); |
csharer | 9:37a883451bf1 | 833 | uint8_t dmpGetFIFORate(); |
csharer | 9:37a883451bf1 | 834 | uint8_t dmpGetSampleStepSizeMS(); |
csharer | 9:37a883451bf1 | 835 | uint8_t dmpGetSampleFrequency(); |
csharer | 9:37a883451bf1 | 836 | int32_t dmpDecodeTemperature(int8_t tempReg); |
csharer | 9:37a883451bf1 | 837 | |
csharer | 9:37a883451bf1 | 838 | // Register callbacks after a packet of FIFO data is processed |
csharer | 9:37a883451bf1 | 839 | //uint8_t dmpRegisterFIFORateProcess(inv_obj_func func, int16_t priority); |
csharer | 9:37a883451bf1 | 840 | //uint8_t dmpUnregisterFIFORateProcess(inv_obj_func func); |
csharer | 9:37a883451bf1 | 841 | uint8_t dmpRunFIFORateProcesses(); |
csharer | 9:37a883451bf1 | 842 | |
csharer | 9:37a883451bf1 | 843 | // Setup FIFO for various output |
csharer | 9:37a883451bf1 | 844 | uint8_t dmpSendQuaternion(uint_fast16_t accuracy); |
csharer | 9:37a883451bf1 | 845 | uint8_t dmpSendGyro(uint_fast16_t elements, uint_fast16_t accuracy); |
csharer | 9:37a883451bf1 | 846 | uint8_t dmpSendAccel(uint_fast16_t elements, uint_fast16_t accuracy); |
csharer | 9:37a883451bf1 | 847 | uint8_t dmpSendLinearAccel(uint_fast16_t elements, uint_fast16_t accuracy); |
csharer | 9:37a883451bf1 | 848 | uint8_t dmpSendLinearAccelInWorld(uint_fast16_t elements, uint_fast16_t accuracy); |
csharer | 9:37a883451bf1 | 849 | uint8_t dmpSendControlData(uint_fast16_t elements, uint_fast16_t accuracy); |
csharer | 9:37a883451bf1 | 850 | uint8_t dmpSendSensorData(uint_fast16_t elements, uint_fast16_t accuracy); |
csharer | 9:37a883451bf1 | 851 | uint8_t dmpSendExternalSensorData(uint_fast16_t elements, uint_fast16_t accuracy); |
csharer | 9:37a883451bf1 | 852 | uint8_t dmpSendGravity(uint_fast16_t elements, uint_fast16_t accuracy); |
csharer | 9:37a883451bf1 | 853 | uint8_t dmpSendPacketNumber(uint_fast16_t accuracy); |
csharer | 9:37a883451bf1 | 854 | uint8_t dmpSendQuantizedAccel(uint_fast16_t elements, uint_fast16_t accuracy); |
csharer | 9:37a883451bf1 | 855 | uint8_t dmpSendEIS(uint_fast16_t elements, uint_fast16_t accuracy); |
csharer | 9:37a883451bf1 | 856 | |
csharer | 9:37a883451bf1 | 857 | // Get Fixed Point data from FIFO |
csharer | 9:37a883451bf1 | 858 | uint8_t dmpGetAccel(int32_t *data, const uint8_t* packet=0); |
csharer | 9:37a883451bf1 | 859 | uint8_t dmpGetAccel(int16_t *data, const uint8_t* packet=0); |
csharer | 9:37a883451bf1 | 860 | uint8_t dmpGetAccel(VectorInt16 *v, const uint8_t* packet=0); |
csharer | 9:37a883451bf1 | 861 | uint8_t dmpGetQuaternion(int32_t *data, const uint8_t* packet=0); |
csharer | 9:37a883451bf1 | 862 | uint8_t dmpGetQuaternion(int16_t *data, const uint8_t* packet=0); |
csharer | 9:37a883451bf1 | 863 | uint8_t dmpGetQuaternion(Quaternion *q, const uint8_t* packet=0); |
csharer | 9:37a883451bf1 | 864 | uint8_t dmpGet6AxisQuaternion(int32_t *data, const uint8_t* packet=0); |
csharer | 9:37a883451bf1 | 865 | uint8_t dmpGet6AxisQuaternion(int16_t *data, const uint8_t* packet=0); |
csharer | 9:37a883451bf1 | 866 | uint8_t dmpGet6AxisQuaternion(Quaternion *q, const uint8_t* packet=0); |
csharer | 9:37a883451bf1 | 867 | uint8_t dmpGetRelativeQuaternion(int32_t *data, const uint8_t* packet=0); |
csharer | 9:37a883451bf1 | 868 | uint8_t dmpGetRelativeQuaternion(int16_t *data, const uint8_t* packet=0); |
csharer | 9:37a883451bf1 | 869 | uint8_t dmpGetRelativeQuaternion(Quaternion *data, const uint8_t* packet=0); |
csharer | 9:37a883451bf1 | 870 | uint8_t dmpGetGyro(int32_t *data, const uint8_t* packet=0); |
csharer | 9:37a883451bf1 | 871 | uint8_t dmpGetGyro(int16_t *data, const uint8_t* packet=0); |
csharer | 9:37a883451bf1 | 872 | uint8_t dmpGetGyro(VectorInt16 *v, const uint8_t* packet=0); |
csharer | 9:37a883451bf1 | 873 | uint8_t dmpSetLinearAccelFilterCoefficient(float coef); |
csharer | 9:37a883451bf1 | 874 | uint8_t dmpGetLinearAccel(int32_t *data, const uint8_t* packet=0); |
csharer | 9:37a883451bf1 | 875 | uint8_t dmpGetLinearAccel(int16_t *data, const uint8_t* packet=0); |
csharer | 9:37a883451bf1 | 876 | uint8_t dmpGetLinearAccel(VectorInt16 *v, const uint8_t* packet=0); |
csharer | 9:37a883451bf1 | 877 | uint8_t dmpGetLinearAccel(VectorInt16 *v, VectorInt16 *vRaw, VectorFloat *gravity); |
csharer | 9:37a883451bf1 | 878 | uint8_t dmpGetLinearAccelInWorld(int32_t *data, const uint8_t* packet=0); |
csharer | 9:37a883451bf1 | 879 | uint8_t dmpGetLinearAccelInWorld(int16_t *data, const uint8_t* packet=0); |
csharer | 9:37a883451bf1 | 880 | uint8_t dmpGetLinearAccelInWorld(VectorInt16 *v, const uint8_t* packet=0); |
csharer | 9:37a883451bf1 | 881 | uint8_t dmpGetLinearAccelInWorld(VectorInt16 *v, VectorInt16 *vReal, Quaternion *q); |
csharer | 9:37a883451bf1 | 882 | uint8_t dmpGetGyroAndAccelSensor(int32_t *data, const uint8_t* packet=0); |
csharer | 9:37a883451bf1 | 883 | uint8_t dmpGetGyroAndAccelSensor(int16_t *data, const uint8_t* packet=0); |
csharer | 9:37a883451bf1 | 884 | uint8_t dmpGetGyroAndAccelSensor(VectorInt16 *g, VectorInt16 *a, const uint8_t* packet=0); |
csharer | 9:37a883451bf1 | 885 | uint8_t dmpGetGyroSensor(int32_t *data, const uint8_t* packet=0); |
csharer | 9:37a883451bf1 | 886 | uint8_t dmpGetGyroSensor(int16_t *data, const uint8_t* packet=0); |
csharer | 9:37a883451bf1 | 887 | uint8_t dmpGetGyroSensor(VectorInt16 *v, const uint8_t* packet=0); |
csharer | 9:37a883451bf1 | 888 | uint8_t dmpGetControlData(int32_t *data, const uint8_t* packet=0); |
csharer | 9:37a883451bf1 | 889 | uint8_t dmpGetTemperature(int32_t *data, const uint8_t* packet=0); |
csharer | 9:37a883451bf1 | 890 | uint8_t dmpGetGravity(int32_t *data, const uint8_t* packet=0); |
csharer | 9:37a883451bf1 | 891 | uint8_t dmpGetGravity(int16_t *data, const uint8_t* packet=0); |
csharer | 9:37a883451bf1 | 892 | uint8_t dmpGetGravity(VectorInt16 *v, const uint8_t* packet=0); |
csharer | 9:37a883451bf1 | 893 | uint8_t dmpGetGravity(VectorFloat *v, Quaternion *q); |
csharer | 9:37a883451bf1 | 894 | uint8_t dmpGetUnquantizedAccel(int32_t *data, const uint8_t* packet=0); |
csharer | 9:37a883451bf1 | 895 | uint8_t dmpGetUnquantizedAccel(int16_t *data, const uint8_t* packet=0); |
csharer | 9:37a883451bf1 | 896 | uint8_t dmpGetUnquantizedAccel(VectorInt16 *v, const uint8_t* packet=0); |
csharer | 9:37a883451bf1 | 897 | uint8_t dmpGetQuantizedAccel(int32_t *data, const uint8_t* packet=0); |
csharer | 9:37a883451bf1 | 898 | uint8_t dmpGetQuantizedAccel(int16_t *data, const uint8_t* packet=0); |
csharer | 9:37a883451bf1 | 899 | uint8_t dmpGetQuantizedAccel(VectorInt16 *v, const uint8_t* packet=0); |
csharer | 9:37a883451bf1 | 900 | uint8_t dmpGetExternalSensorData(int32_t *data, uint16_t size, const uint8_t* packet=0); |
csharer | 9:37a883451bf1 | 901 | uint8_t dmpGetEIS(int32_t *data, const uint8_t* packet=0); |
csharer | 9:37a883451bf1 | 902 | |
csharer | 9:37a883451bf1 | 903 | uint8_t dmpGetEuler(float *data, Quaternion *q); |
csharer | 9:37a883451bf1 | 904 | uint8_t dmpGetYawPitchRoll(float *data, Quaternion *q, VectorFloat *gravity); |
csharer | 9:37a883451bf1 | 905 | |
csharer | 9:37a883451bf1 | 906 | // Get Floating Point data from FIFO |
csharer | 9:37a883451bf1 | 907 | uint8_t dmpGetAccelFloat(float *data, const uint8_t* packet=0); |
csharer | 9:37a883451bf1 | 908 | uint8_t dmpGetQuaternionFloat(float *data, const uint8_t* packet=0); |
csharer | 9:37a883451bf1 | 909 | |
csharer | 9:37a883451bf1 | 910 | uint8_t dmpProcessFIFOPacket(const unsigned char *dmpData); |
csharer | 9:37a883451bf1 | 911 | uint8_t dmpReadAndProcessFIFOPacket(uint8_t numPackets, uint8_t *processed=NULL); |
csharer | 9:37a883451bf1 | 912 | |
csharer | 9:37a883451bf1 | 913 | uint8_t dmpSetFIFOProcessedCallback(void (*func) (void)); |
csharer | 9:37a883451bf1 | 914 | |
csharer | 9:37a883451bf1 | 915 | uint8_t dmpInitFIFOParam(); |
csharer | 9:37a883451bf1 | 916 | uint8_t dmpCloseFIFO(); |
csharer | 9:37a883451bf1 | 917 | uint8_t dmpSetGyroDataSource(uint8_t source); |
csharer | 9:37a883451bf1 | 918 | uint8_t dmpDecodeQuantizedAccel(); |
csharer | 9:37a883451bf1 | 919 | uint32_t dmpGetGyroSumOfSquare(); |
csharer | 9:37a883451bf1 | 920 | uint32_t dmpGetAccelSumOfSquare(); |
csharer | 9:37a883451bf1 | 921 | void dmpOverrideQuaternion(long *q); |
csharer | 9:37a883451bf1 | 922 | uint16_t dmpGetFIFOPacketSize(); |
csharer | 9:37a883451bf1 | 923 | #endif |
csharer | 9:37a883451bf1 | 924 | |
csharer | 9:37a883451bf1 | 925 | // special methods for MotionApps 4.1 implementation |
csharer | 9:37a883451bf1 | 926 | #ifdef MPU6050_INCLUDE_DMP_MOTIONAPPS41 |
csharer | 9:37a883451bf1 | 927 | uint8_t *dmpPacketBuffer; |
csharer | 9:37a883451bf1 | 928 | uint16_t dmpPacketSize; |
csharer | 9:37a883451bf1 | 929 | |
csharer | 9:37a883451bf1 | 930 | uint8_t dmpInitialize(); |
csharer | 9:37a883451bf1 | 931 | bool dmpPacketAvailable(); |
csharer | 9:37a883451bf1 | 932 | |
csharer | 9:37a883451bf1 | 933 | uint8_t dmpSetFIFORate(uint8_t fifoRate); |
csharer | 9:37a883451bf1 | 934 | uint8_t dmpGetFIFORate(); |
csharer | 9:37a883451bf1 | 935 | uint8_t dmpGetSampleStepSizeMS(); |
csharer | 9:37a883451bf1 | 936 | uint8_t dmpGetSampleFrequency(); |
csharer | 9:37a883451bf1 | 937 | int32_t dmpDecodeTemperature(int8_t tempReg); |
csharer | 9:37a883451bf1 | 938 | |
csharer | 9:37a883451bf1 | 939 | // Register callbacks after a packet of FIFO data is processed |
csharer | 9:37a883451bf1 | 940 | //uint8_t dmpRegisterFIFORateProcess(inv_obj_func func, int16_t priority); |
csharer | 9:37a883451bf1 | 941 | //uint8_t dmpUnregisterFIFORateProcess(inv_obj_func func); |
csharer | 9:37a883451bf1 | 942 | uint8_t dmpRunFIFORateProcesses(); |
csharer | 9:37a883451bf1 | 943 | |
csharer | 9:37a883451bf1 | 944 | // Setup FIFO for various output |
csharer | 9:37a883451bf1 | 945 | uint8_t dmpSendQuaternion(uint_fast16_t accuracy); |
csharer | 9:37a883451bf1 | 946 | uint8_t dmpSendGyro(uint_fast16_t elements, uint_fast16_t accuracy); |
csharer | 9:37a883451bf1 | 947 | uint8_t dmpSendAccel(uint_fast16_t elements, uint_fast16_t accuracy); |
csharer | 9:37a883451bf1 | 948 | uint8_t dmpSendLinearAccel(uint_fast16_t elements, uint_fast16_t accuracy); |
csharer | 9:37a883451bf1 | 949 | uint8_t dmpSendLinearAccelInWorld(uint_fast16_t elements, uint_fast16_t accuracy); |
csharer | 9:37a883451bf1 | 950 | uint8_t dmpSendControlData(uint_fast16_t elements, uint_fast16_t accuracy); |
csharer | 9:37a883451bf1 | 951 | uint8_t dmpSendSensorData(uint_fast16_t elements, uint_fast16_t accuracy); |
csharer | 9:37a883451bf1 | 952 | uint8_t dmpSendExternalSensorData(uint_fast16_t elements, uint_fast16_t accuracy); |
csharer | 9:37a883451bf1 | 953 | uint8_t dmpSendGravity(uint_fast16_t elements, uint_fast16_t accuracy); |
csharer | 9:37a883451bf1 | 954 | uint8_t dmpSendPacketNumber(uint_fast16_t accuracy); |
csharer | 9:37a883451bf1 | 955 | uint8_t dmpSendQuantizedAccel(uint_fast16_t elements, uint_fast16_t accuracy); |
csharer | 9:37a883451bf1 | 956 | uint8_t dmpSendEIS(uint_fast16_t elements, uint_fast16_t accuracy); |
csharer | 9:37a883451bf1 | 957 | |
csharer | 9:37a883451bf1 | 958 | // Get Fixed Point data from FIFO |
csharer | 9:37a883451bf1 | 959 | uint8_t dmpGetAccel(int32_t *data, const uint8_t* packet=0); |
csharer | 9:37a883451bf1 | 960 | uint8_t dmpGetAccel(int16_t *data, const uint8_t* packet=0); |
csharer | 9:37a883451bf1 | 961 | uint8_t dmpGetAccel(VectorInt16 *v, const uint8_t* packet=0); |
csharer | 9:37a883451bf1 | 962 | uint8_t dmpGetQuaternion(int32_t *data, const uint8_t* packet=0); |
csharer | 9:37a883451bf1 | 963 | uint8_t dmpGetQuaternion(int16_t *data, const uint8_t* packet=0); |
csharer | 9:37a883451bf1 | 964 | uint8_t dmpGetQuaternion(Quaternion *q, const uint8_t* packet=0); |
csharer | 9:37a883451bf1 | 965 | uint8_t dmpGet6AxisQuaternion(int32_t *data, const uint8_t* packet=0); |
csharer | 9:37a883451bf1 | 966 | uint8_t dmpGet6AxisQuaternion(int16_t *data, const uint8_t* packet=0); |
csharer | 9:37a883451bf1 | 967 | uint8_t dmpGet6AxisQuaternion(Quaternion *q, const uint8_t* packet=0); |
csharer | 9:37a883451bf1 | 968 | uint8_t dmpGetRelativeQuaternion(int32_t *data, const uint8_t* packet=0); |
csharer | 9:37a883451bf1 | 969 | uint8_t dmpGetRelativeQuaternion(int16_t *data, const uint8_t* packet=0); |
csharer | 9:37a883451bf1 | 970 | uint8_t dmpGetRelativeQuaternion(Quaternion *data, const uint8_t* packet=0); |
csharer | 9:37a883451bf1 | 971 | uint8_t dmpGetGyro(int32_t *data, const uint8_t* packet=0); |
csharer | 9:37a883451bf1 | 972 | uint8_t dmpGetGyro(int16_t *data, const uint8_t* packet=0); |
csharer | 9:37a883451bf1 | 973 | uint8_t dmpGetGyro(VectorInt16 *v, const uint8_t* packet=0); |
csharer | 9:37a883451bf1 | 974 | uint8_t dmpGetMag(int16_t *data, const uint8_t* packet=0); |
csharer | 9:37a883451bf1 | 975 | uint8_t dmpSetLinearAccelFilterCoefficient(float coef); |
csharer | 9:37a883451bf1 | 976 | uint8_t dmpGetLinearAccel(int32_t *data, const uint8_t* packet=0); |
csharer | 9:37a883451bf1 | 977 | uint8_t dmpGetLinearAccel(int16_t *data, const uint8_t* packet=0); |
csharer | 9:37a883451bf1 | 978 | uint8_t dmpGetLinearAccel(VectorInt16 *v, const uint8_t* packet=0); |
csharer | 9:37a883451bf1 | 979 | uint8_t dmpGetLinearAccel(VectorInt16 *v, VectorInt16 *vRaw, VectorFloat *gravity); |
csharer | 9:37a883451bf1 | 980 | uint8_t dmpGetLinearAccelInWorld(int32_t *data, const uint8_t* packet=0); |
csharer | 9:37a883451bf1 | 981 | uint8_t dmpGetLinearAccelInWorld(int16_t *data, const uint8_t* packet=0); |
csharer | 9:37a883451bf1 | 982 | uint8_t dmpGetLinearAccelInWorld(VectorInt16 *v, const uint8_t* packet=0); |
csharer | 9:37a883451bf1 | 983 | uint8_t dmpGetLinearAccelInWorld(VectorInt16 *v, VectorInt16 *vReal, Quaternion *q); |
csharer | 9:37a883451bf1 | 984 | uint8_t dmpGetGyroAndAccelSensor(int32_t *data, const uint8_t* packet=0); |
csharer | 9:37a883451bf1 | 985 | uint8_t dmpGetGyroAndAccelSensor(int16_t *data, const uint8_t* packet=0); |
csharer | 9:37a883451bf1 | 986 | uint8_t dmpGetGyroAndAccelSensor(VectorInt16 *g, VectorInt16 *a, const uint8_t* packet=0); |
csharer | 9:37a883451bf1 | 987 | uint8_t dmpGetGyroSensor(int32_t *data, const uint8_t* packet=0); |
csharer | 9:37a883451bf1 | 988 | uint8_t dmpGetGyroSensor(int16_t *data, const uint8_t* packet=0); |
csharer | 9:37a883451bf1 | 989 | uint8_t dmpGetGyroSensor(VectorInt16 *v, const uint8_t* packet=0); |
csharer | 9:37a883451bf1 | 990 | uint8_t dmpGetControlData(int32_t *data, const uint8_t* packet=0); |
csharer | 9:37a883451bf1 | 991 | uint8_t dmpGetTemperature(int32_t *data, const uint8_t* packet=0); |
csharer | 9:37a883451bf1 | 992 | uint8_t dmpGetGravity(int32_t *data, const uint8_t* packet=0); |
csharer | 9:37a883451bf1 | 993 | uint8_t dmpGetGravity(int16_t *data, const uint8_t* packet=0); |
csharer | 9:37a883451bf1 | 994 | uint8_t dmpGetGravity(VectorInt16 *v, const uint8_t* packet=0); |
csharer | 9:37a883451bf1 | 995 | uint8_t dmpGetGravity(VectorFloat *v, Quaternion *q); |
csharer | 9:37a883451bf1 | 996 | uint8_t dmpGetUnquantizedAccel(int32_t *data, const uint8_t* packet=0); |
csharer | 9:37a883451bf1 | 997 | uint8_t dmpGetUnquantizedAccel(int16_t *data, const uint8_t* packet=0); |
csharer | 9:37a883451bf1 | 998 | uint8_t dmpGetUnquantizedAccel(VectorInt16 *v, const uint8_t* packet=0); |
csharer | 9:37a883451bf1 | 999 | uint8_t dmpGetQuantizedAccel(int32_t *data, const uint8_t* packet=0); |
csharer | 9:37a883451bf1 | 1000 | uint8_t dmpGetQuantizedAccel(int16_t *data, const uint8_t* packet=0); |
csharer | 9:37a883451bf1 | 1001 | uint8_t dmpGetQuantizedAccel(VectorInt16 *v, const uint8_t* packet=0); |
csharer | 9:37a883451bf1 | 1002 | uint8_t dmpGetExternalSensorData(int32_t *data, uint16_t size, const uint8_t* packet=0); |
csharer | 9:37a883451bf1 | 1003 | uint8_t dmpGetEIS(int32_t *data, const uint8_t* packet=0); |
csharer | 9:37a883451bf1 | 1004 | |
csharer | 9:37a883451bf1 | 1005 | uint8_t dmpGetEuler(float *data, Quaternion *q); |
csharer | 9:37a883451bf1 | 1006 | uint8_t dmpGetYawPitchRoll(float *data, Quaternion *q, VectorFloat *gravity); |
csharer | 9:37a883451bf1 | 1007 | |
csharer | 9:37a883451bf1 | 1008 | // Get Floating Point data from FIFO |
csharer | 9:37a883451bf1 | 1009 | uint8_t dmpGetAccelFloat(float *data, const uint8_t* packet=0); |
csharer | 9:37a883451bf1 | 1010 | uint8_t dmpGetQuaternionFloat(float *data, const uint8_t* packet=0); |
csharer | 9:37a883451bf1 | 1011 | |
csharer | 9:37a883451bf1 | 1012 | uint8_t dmpProcessFIFOPacket(const unsigned char *dmpData); |
csharer | 9:37a883451bf1 | 1013 | uint8_t dmpReadAndProcessFIFOPacket(uint8_t numPackets, uint8_t *processed=NULL); |
csharer | 9:37a883451bf1 | 1014 | |
csharer | 9:37a883451bf1 | 1015 | uint8_t dmpSetFIFOProcessedCallback(void (*func) (void)); |
csharer | 9:37a883451bf1 | 1016 | |
csharer | 9:37a883451bf1 | 1017 | uint8_t dmpInitFIFOParam(); |
csharer | 9:37a883451bf1 | 1018 | uint8_t dmpCloseFIFO(); |
csharer | 9:37a883451bf1 | 1019 | uint8_t dmpSetGyroDataSource(uint8_t source); |
csharer | 9:37a883451bf1 | 1020 | uint8_t dmpDecodeQuantizedAccel(); |
csharer | 9:37a883451bf1 | 1021 | uint32_t dmpGetGyroSumOfSquare(); |
csharer | 9:37a883451bf1 | 1022 | uint32_t dmpGetAccelSumOfSquare(); |
csharer | 9:37a883451bf1 | 1023 | void dmpOverrideQuaternion(long *q); |
csharer | 9:37a883451bf1 | 1024 | uint16_t dmpGetFIFOPacketSize(); |
csharer | 9:37a883451bf1 | 1025 | #endif |
csharer | 9:37a883451bf1 | 1026 | |
csharer | 9:37a883451bf1 | 1027 | private: |
csharer | 9:37a883451bf1 | 1028 | uint8_t devAddr; |
csharer | 9:37a883451bf1 | 1029 | uint8_t buffer[14]; |
csharer | 9:37a883451bf1 | 1030 | }; |
csharer | 9:37a883451bf1 | 1031 | |
csharer | 9:37a883451bf1 | 1032 | #endif /* _MPU6050_H_ */ |