Projet interfaçage

Dependencies:   mbed BSP_DISCO_F746NG

Committer:
anthonyp08
Date:
Tue Jun 22 12:04:16 2021 +0000
Revision:
1:eb044e6a9033
Parent:
0:1c6757f4b61c
projet

Who changed what in which revision?

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