Balancimg MPU6050 by LEDs on PWM

Dependencies:   mbed

It is possible to observe the MPU6050 data on serial. If serial termimal is not started then still LED application runs.

There are 4 LEDs on LPC1768. So the first 3 LEDs are assign to accelerometer X, Y and Z. The last LED can drive by user. Default it lights a bit. If you want to turn it off then change the value as "190" to "180" on this line: myled4 = cos(190*2.0*3.13/360) * 0.5 + 0.5; If you want to turn it on (full) then change the value as "190" to "0" on above code line.

Committer:
LORDTEK
Date:
Sun Oct 13 12:01:33 2013 +0000
Revision:
0:9a1aae56ed19
Balancing MPU6050 by LEDs

Who changed what in which revision?

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