USSRII Mathieu DUCROCQ

Dependencies:   mbed BSP_DISCO_F746NG

Committer:
mducrocq
Date:
Tue Jun 15 10:10:18 2021 +0000
Revision:
0:11a51c9ebb09
USRRII Mathieu Ducrocq

Who changed what in which revision?

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