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