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