Lib for MPU9150/9250 IMU sensors
Dependents: DISCO-F746NG_rtos_test
Fork of MPU9150 by
MPU9150.h@1:c38eb550c82e, 2018-02-11 (annotated)
- Committer:
- TuxLeon
- Date:
- Sun Feb 11 18:31:53 2018 +0000
- Revision:
- 1:c38eb550c82e
- Parent:
- 0:ab00d9bcd00d
First commit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
JojoS | 0:ab00d9bcd00d | 1 | // I2Cdev library collection - MPU9150 I2C device class |
JojoS | 0:ab00d9bcd00d | 2 | // Based on InvenSense MPU-9150 register map document rev. 2.0, 5/19/2011 (RM-MPU-6000A-00) |
JojoS | 0:ab00d9bcd00d | 3 | // 10/3/2011 by Jeff Rowberg <jeff@rowberg.net> |
JojoS | 0:ab00d9bcd00d | 4 | // Updates should (hopefully) always be available at https://github.com/jrowberg/i2cdevlib |
JojoS | 0:ab00d9bcd00d | 5 | // |
JojoS | 0:ab00d9bcd00d | 6 | // Changelog: |
JojoS | 0:ab00d9bcd00d | 7 | // ... - ongoing debug release |
JojoS | 0:ab00d9bcd00d | 8 | |
JojoS | 0:ab00d9bcd00d | 9 | // NOTE: THIS IS ONLY A PARIAL RELEASE. THIS DEVICE CLASS IS CURRENTLY UNDERGOING ACTIVE |
JojoS | 0:ab00d9bcd00d | 10 | // DEVELOPMENT AND IS STILL MISSING SOME IMPORTANT FEATURES. PLEASE KEEP THIS IN MIND IF |
JojoS | 0:ab00d9bcd00d | 11 | // YOU DECIDE TO USE THIS PARTICULAR CODE FOR ANYTHING. |
JojoS | 0:ab00d9bcd00d | 12 | |
JojoS | 0:ab00d9bcd00d | 13 | /* ============================================ |
JojoS | 0:ab00d9bcd00d | 14 | I2Cdev device library code is placed under the MIT license |
JojoS | 0:ab00d9bcd00d | 15 | Copyright (c) 2012 Jeff Rowberg |
JojoS | 0:ab00d9bcd00d | 16 | |
JojoS | 0:ab00d9bcd00d | 17 | Permission is hereby granted, free of charge, to any person obtaining a copy |
JojoS | 0:ab00d9bcd00d | 18 | of this software and associated documentation files (the "Software"), to deal |
JojoS | 0:ab00d9bcd00d | 19 | in the Software without restriction, including without limitation the rights |
JojoS | 0:ab00d9bcd00d | 20 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
JojoS | 0:ab00d9bcd00d | 21 | copies of the Software, and to permit persons to whom the Software is |
JojoS | 0:ab00d9bcd00d | 22 | furnished to do so, subject to the following conditions: |
JojoS | 0:ab00d9bcd00d | 23 | |
JojoS | 0:ab00d9bcd00d | 24 | The above copyright notice and this permission notice shall be included in |
JojoS | 0:ab00d9bcd00d | 25 | all copies or substantial portions of the Software. |
JojoS | 0:ab00d9bcd00d | 26 | |
JojoS | 0:ab00d9bcd00d | 27 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
JojoS | 0:ab00d9bcd00d | 28 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
JojoS | 0:ab00d9bcd00d | 29 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
JojoS | 0:ab00d9bcd00d | 30 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
JojoS | 0:ab00d9bcd00d | 31 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
JojoS | 0:ab00d9bcd00d | 32 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
JojoS | 0:ab00d9bcd00d | 33 | THE SOFTWARE. |
JojoS | 0:ab00d9bcd00d | 34 | =============================================== |
JojoS | 0:ab00d9bcd00d | 35 | */ |
JojoS | 0:ab00d9bcd00d | 36 | |
JojoS | 0:ab00d9bcd00d | 37 | #ifndef _MPU9150_H_ |
JojoS | 0:ab00d9bcd00d | 38 | #define _MPU9150_H_ |
JojoS | 0:ab00d9bcd00d | 39 | |
TuxLeon | 1:c38eb550c82e | 40 | #include "mbed.h" |
JojoS | 0:ab00d9bcd00d | 41 | #include "I2Cdev.h" |
JojoS | 0:ab00d9bcd00d | 42 | |
JojoS | 0:ab00d9bcd00d | 43 | // supporting link: http://forum.arduino.cc/index.php?&topic=143444.msg1079517#msg1079517 |
JojoS | 0:ab00d9bcd00d | 44 | // also: http://forum.arduino.cc/index.php?&topic=141571.msg1062899#msg1062899s |
JojoS | 0:ab00d9bcd00d | 45 | #ifndef __arm__ |
JojoS | 0:ab00d9bcd00d | 46 | #include <avr/pgmspace.h> |
JojoS | 0:ab00d9bcd00d | 47 | #else |
JojoS | 0:ab00d9bcd00d | 48 | #define PROGMEM /* empty */ |
JojoS | 0:ab00d9bcd00d | 49 | #define pgm_read_byte(x) (*(x)) |
JojoS | 0:ab00d9bcd00d | 50 | #define pgm_read_word(x) (*(x)) |
JojoS | 0:ab00d9bcd00d | 51 | #define pgm_read_float(x) (*(x)) |
JojoS | 0:ab00d9bcd00d | 52 | #define PSTR(STR) STR |
JojoS | 0:ab00d9bcd00d | 53 | #endif |
JojoS | 0:ab00d9bcd00d | 54 | |
JojoS | 0:ab00d9bcd00d | 55 | //Magnetometer Registers |
JojoS | 0:ab00d9bcd00d | 56 | #define MPU9150_RA_MAG_ADDRESS 0x0C |
JojoS | 0:ab00d9bcd00d | 57 | #define MPU9150_RA_MAG_XOUT_L 0x03 |
JojoS | 0:ab00d9bcd00d | 58 | #define MPU9150_RA_MAG_XOUT_H 0x04 |
JojoS | 0:ab00d9bcd00d | 59 | #define MPU9150_RA_MAG_YOUT_L 0x05 |
JojoS | 0:ab00d9bcd00d | 60 | #define MPU9150_RA_MAG_YOUT_H 0x06 |
JojoS | 0:ab00d9bcd00d | 61 | #define MPU9150_RA_MAG_ZOUT_L 0x07 |
JojoS | 0:ab00d9bcd00d | 62 | #define MPU9150_RA_MAG_ZOUT_H 0x08 |
JojoS | 0:ab00d9bcd00d | 63 | |
JojoS | 0:ab00d9bcd00d | 64 | #define MPU9150_ADDRESS_AD0_LOW 0x68 // address pin low (GND), default for InvenSense evaluation board |
JojoS | 0:ab00d9bcd00d | 65 | #define MPU9150_ADDRESS_AD0_HIGH 0x69 // address pin high (VCC) |
JojoS | 0:ab00d9bcd00d | 66 | #define MPU9150_DEFAULT_ADDRESS MPU9150_ADDRESS_AD0_LOW |
JojoS | 0:ab00d9bcd00d | 67 | |
JojoS | 0:ab00d9bcd00d | 68 | #define MPU9150_RA_XG_OFFS_TC 0x00 //[7] PWR_MODE, [6:1] XG_OFFS_TC, [0] OTP_BNK_VLD |
JojoS | 0:ab00d9bcd00d | 69 | #define MPU9150_RA_YG_OFFS_TC 0x01 //[7] PWR_MODE, [6:1] YG_OFFS_TC, [0] OTP_BNK_VLD |
JojoS | 0:ab00d9bcd00d | 70 | #define MPU9150_RA_ZG_OFFS_TC 0x02 //[7] PWR_MODE, [6:1] ZG_OFFS_TC, [0] OTP_BNK_VLD |
JojoS | 0:ab00d9bcd00d | 71 | #define MPU9150_RA_X_FINE_GAIN 0x03 //[7:0] X_FINE_GAIN |
JojoS | 0:ab00d9bcd00d | 72 | #define MPU9150_RA_Y_FINE_GAIN 0x04 //[7:0] Y_FINE_GAIN |
JojoS | 0:ab00d9bcd00d | 73 | #define MPU9150_RA_Z_FINE_GAIN 0x05 //[7:0] Z_FINE_GAIN |
JojoS | 0:ab00d9bcd00d | 74 | #define MPU9150_RA_XA_OFFS_H 0x06 //[15:0] XA_OFFS |
JojoS | 0:ab00d9bcd00d | 75 | #define MPU9150_RA_XA_OFFS_L_TC 0x07 |
JojoS | 0:ab00d9bcd00d | 76 | #define MPU9150_RA_YA_OFFS_H 0x08 //[15:0] YA_OFFS |
JojoS | 0:ab00d9bcd00d | 77 | #define MPU9150_RA_YA_OFFS_L_TC 0x09 |
JojoS | 0:ab00d9bcd00d | 78 | #define MPU9150_RA_ZA_OFFS_H 0x0A //[15:0] ZA_OFFS |
JojoS | 0:ab00d9bcd00d | 79 | #define MPU9150_RA_ZA_OFFS_L_TC 0x0B |
JojoS | 0:ab00d9bcd00d | 80 | #define MPU9150_RA_XG_OFFS_USRH 0x13 //[15:0] XG_OFFS_USR |
JojoS | 0:ab00d9bcd00d | 81 | #define MPU9150_RA_XG_OFFS_USRL 0x14 |
JojoS | 0:ab00d9bcd00d | 82 | #define MPU9150_RA_YG_OFFS_USRH 0x15 //[15:0] YG_OFFS_USR |
JojoS | 0:ab00d9bcd00d | 83 | #define MPU9150_RA_YG_OFFS_USRL 0x16 |
JojoS | 0:ab00d9bcd00d | 84 | #define MPU9150_RA_ZG_OFFS_USRH 0x17 //[15:0] ZG_OFFS_USR |
JojoS | 0:ab00d9bcd00d | 85 | #define MPU9150_RA_ZG_OFFS_USRL 0x18 |
JojoS | 0:ab00d9bcd00d | 86 | #define MPU9150_RA_SMPLRT_DIV 0x19 |
JojoS | 0:ab00d9bcd00d | 87 | #define MPU9150_RA_CONFIG 0x1A |
JojoS | 0:ab00d9bcd00d | 88 | #define MPU9150_RA_GYRO_CONFIG 0x1B |
JojoS | 0:ab00d9bcd00d | 89 | #define MPU9150_RA_ACCEL_CONFIG 0x1C |
JojoS | 0:ab00d9bcd00d | 90 | #define MPU9150_RA_FF_THR 0x1D |
JojoS | 0:ab00d9bcd00d | 91 | #define MPU9150_RA_FF_DUR 0x1E |
JojoS | 0:ab00d9bcd00d | 92 | #define MPU9150_RA_MOT_THR 0x1F |
JojoS | 0:ab00d9bcd00d | 93 | #define MPU9150_RA_MOT_DUR 0x20 |
JojoS | 0:ab00d9bcd00d | 94 | #define MPU9150_RA_ZRMOT_THR 0x21 |
JojoS | 0:ab00d9bcd00d | 95 | #define MPU9150_RA_ZRMOT_DUR 0x22 |
JojoS | 0:ab00d9bcd00d | 96 | #define MPU9150_RA_FIFO_EN 0x23 |
JojoS | 0:ab00d9bcd00d | 97 | #define MPU9150_RA_I2C_MST_CTRL 0x24 |
JojoS | 0:ab00d9bcd00d | 98 | #define MPU9150_RA_I2C_SLV0_ADDR 0x25 |
JojoS | 0:ab00d9bcd00d | 99 | #define MPU9150_RA_I2C_SLV0_REG 0x26 |
JojoS | 0:ab00d9bcd00d | 100 | #define MPU9150_RA_I2C_SLV0_CTRL 0x27 |
JojoS | 0:ab00d9bcd00d | 101 | #define MPU9150_RA_I2C_SLV1_ADDR 0x28 |
JojoS | 0:ab00d9bcd00d | 102 | #define MPU9150_RA_I2C_SLV1_REG 0x29 |
JojoS | 0:ab00d9bcd00d | 103 | #define MPU9150_RA_I2C_SLV1_CTRL 0x2A |
JojoS | 0:ab00d9bcd00d | 104 | #define MPU9150_RA_I2C_SLV2_ADDR 0x2B |
JojoS | 0:ab00d9bcd00d | 105 | #define MPU9150_RA_I2C_SLV2_REG 0x2C |
JojoS | 0:ab00d9bcd00d | 106 | #define MPU9150_RA_I2C_SLV2_CTRL 0x2D |
JojoS | 0:ab00d9bcd00d | 107 | #define MPU9150_RA_I2C_SLV3_ADDR 0x2E |
JojoS | 0:ab00d9bcd00d | 108 | #define MPU9150_RA_I2C_SLV3_REG 0x2F |
JojoS | 0:ab00d9bcd00d | 109 | #define MPU9150_RA_I2C_SLV3_CTRL 0x30 |
JojoS | 0:ab00d9bcd00d | 110 | #define MPU9150_RA_I2C_SLV4_ADDR 0x31 |
JojoS | 0:ab00d9bcd00d | 111 | #define MPU9150_RA_I2C_SLV4_REG 0x32 |
JojoS | 0:ab00d9bcd00d | 112 | #define MPU9150_RA_I2C_SLV4_DO 0x33 |
JojoS | 0:ab00d9bcd00d | 113 | #define MPU9150_RA_I2C_SLV4_CTRL 0x34 |
JojoS | 0:ab00d9bcd00d | 114 | #define MPU9150_RA_I2C_SLV4_DI 0x35 |
JojoS | 0:ab00d9bcd00d | 115 | #define MPU9150_RA_I2C_MST_STATUS 0x36 |
JojoS | 0:ab00d9bcd00d | 116 | #define MPU9150_RA_INT_PIN_CFG 0x37 |
JojoS | 0:ab00d9bcd00d | 117 | #define MPU9150_RA_INT_ENABLE 0x38 |
JojoS | 0:ab00d9bcd00d | 118 | #define MPU9150_RA_DMP_INT_STATUS 0x39 |
JojoS | 0:ab00d9bcd00d | 119 | #define MPU9150_RA_INT_STATUS 0x3A |
JojoS | 0:ab00d9bcd00d | 120 | #define MPU9150_RA_ACCEL_XOUT_H 0x3B |
JojoS | 0:ab00d9bcd00d | 121 | #define MPU9150_RA_ACCEL_XOUT_L 0x3C |
JojoS | 0:ab00d9bcd00d | 122 | #define MPU9150_RA_ACCEL_YOUT_H 0x3D |
JojoS | 0:ab00d9bcd00d | 123 | #define MPU9150_RA_ACCEL_YOUT_L 0x3E |
JojoS | 0:ab00d9bcd00d | 124 | #define MPU9150_RA_ACCEL_ZOUT_H 0x3F |
JojoS | 0:ab00d9bcd00d | 125 | #define MPU9150_RA_ACCEL_ZOUT_L 0x40 |
JojoS | 0:ab00d9bcd00d | 126 | #define MPU9150_RA_TEMP_OUT_H 0x41 |
JojoS | 0:ab00d9bcd00d | 127 | #define MPU9150_RA_TEMP_OUT_L 0x42 |
JojoS | 0:ab00d9bcd00d | 128 | #define MPU9150_RA_GYRO_XOUT_H 0x43 |
JojoS | 0:ab00d9bcd00d | 129 | #define MPU9150_RA_GYRO_XOUT_L 0x44 |
JojoS | 0:ab00d9bcd00d | 130 | #define MPU9150_RA_GYRO_YOUT_H 0x45 |
JojoS | 0:ab00d9bcd00d | 131 | #define MPU9150_RA_GYRO_YOUT_L 0x46 |
JojoS | 0:ab00d9bcd00d | 132 | #define MPU9150_RA_GYRO_ZOUT_H 0x47 |
JojoS | 0:ab00d9bcd00d | 133 | #define MPU9150_RA_GYRO_ZOUT_L 0x48 |
JojoS | 0:ab00d9bcd00d | 134 | #define MPU9150_RA_EXT_SENS_DATA_00 0x49 |
JojoS | 0:ab00d9bcd00d | 135 | #define MPU9150_RA_EXT_SENS_DATA_01 0x4A |
JojoS | 0:ab00d9bcd00d | 136 | #define MPU9150_RA_EXT_SENS_DATA_02 0x4B |
JojoS | 0:ab00d9bcd00d | 137 | #define MPU9150_RA_EXT_SENS_DATA_03 0x4C |
JojoS | 0:ab00d9bcd00d | 138 | #define MPU9150_RA_EXT_SENS_DATA_04 0x4D |
JojoS | 0:ab00d9bcd00d | 139 | #define MPU9150_RA_EXT_SENS_DATA_05 0x4E |
JojoS | 0:ab00d9bcd00d | 140 | #define MPU9150_RA_EXT_SENS_DATA_06 0x4F |
JojoS | 0:ab00d9bcd00d | 141 | #define MPU9150_RA_EXT_SENS_DATA_07 0x50 |
JojoS | 0:ab00d9bcd00d | 142 | #define MPU9150_RA_EXT_SENS_DATA_08 0x51 |
JojoS | 0:ab00d9bcd00d | 143 | #define MPU9150_RA_EXT_SENS_DATA_09 0x52 |
JojoS | 0:ab00d9bcd00d | 144 | #define MPU9150_RA_EXT_SENS_DATA_10 0x53 |
JojoS | 0:ab00d9bcd00d | 145 | #define MPU9150_RA_EXT_SENS_DATA_11 0x54 |
JojoS | 0:ab00d9bcd00d | 146 | #define MPU9150_RA_EXT_SENS_DATA_12 0x55 |
JojoS | 0:ab00d9bcd00d | 147 | #define MPU9150_RA_EXT_SENS_DATA_13 0x56 |
JojoS | 0:ab00d9bcd00d | 148 | #define MPU9150_RA_EXT_SENS_DATA_14 0x57 |
JojoS | 0:ab00d9bcd00d | 149 | #define MPU9150_RA_EXT_SENS_DATA_15 0x58 |
JojoS | 0:ab00d9bcd00d | 150 | #define MPU9150_RA_EXT_SENS_DATA_16 0x59 |
JojoS | 0:ab00d9bcd00d | 151 | #define MPU9150_RA_EXT_SENS_DATA_17 0x5A |
JojoS | 0:ab00d9bcd00d | 152 | #define MPU9150_RA_EXT_SENS_DATA_18 0x5B |
JojoS | 0:ab00d9bcd00d | 153 | #define MPU9150_RA_EXT_SENS_DATA_19 0x5C |
JojoS | 0:ab00d9bcd00d | 154 | #define MPU9150_RA_EXT_SENS_DATA_20 0x5D |
JojoS | 0:ab00d9bcd00d | 155 | #define MPU9150_RA_EXT_SENS_DATA_21 0x5E |
JojoS | 0:ab00d9bcd00d | 156 | #define MPU9150_RA_EXT_SENS_DATA_22 0x5F |
JojoS | 0:ab00d9bcd00d | 157 | #define MPU9150_RA_EXT_SENS_DATA_23 0x60 |
JojoS | 0:ab00d9bcd00d | 158 | #define MPU9150_RA_MOT_DETECT_STATUS 0x61 |
JojoS | 0:ab00d9bcd00d | 159 | #define MPU9150_RA_I2C_SLV0_DO 0x63 |
JojoS | 0:ab00d9bcd00d | 160 | #define MPU9150_RA_I2C_SLV1_DO 0x64 |
JojoS | 0:ab00d9bcd00d | 161 | #define MPU9150_RA_I2C_SLV2_DO 0x65 |
JojoS | 0:ab00d9bcd00d | 162 | #define MPU9150_RA_I2C_SLV3_DO 0x66 |
JojoS | 0:ab00d9bcd00d | 163 | #define MPU9150_RA_I2C_MST_DELAY_CTRL 0x67 |
JojoS | 0:ab00d9bcd00d | 164 | #define MPU9150_RA_SIGNAL_PATH_RESET 0x68 |
JojoS | 0:ab00d9bcd00d | 165 | #define MPU9150_RA_MOT_DETECT_CTRL 0x69 |
JojoS | 0:ab00d9bcd00d | 166 | #define MPU9150_RA_USER_CTRL 0x6A |
JojoS | 0:ab00d9bcd00d | 167 | #define MPU9150_RA_PWR_MGMT_1 0x6B |
JojoS | 0:ab00d9bcd00d | 168 | #define MPU9150_RA_PWR_MGMT_2 0x6C |
JojoS | 0:ab00d9bcd00d | 169 | #define MPU9150_RA_BANK_SEL 0x6D |
JojoS | 0:ab00d9bcd00d | 170 | #define MPU9150_RA_MEM_START_ADDR 0x6E |
JojoS | 0:ab00d9bcd00d | 171 | #define MPU9150_RA_MEM_R_W 0x6F |
JojoS | 0:ab00d9bcd00d | 172 | #define MPU9150_RA_DMP_CFG_1 0x70 |
JojoS | 0:ab00d9bcd00d | 173 | #define MPU9150_RA_DMP_CFG_2 0x71 |
JojoS | 0:ab00d9bcd00d | 174 | #define MPU9150_RA_FIFO_COUNTH 0x72 |
JojoS | 0:ab00d9bcd00d | 175 | #define MPU9150_RA_FIFO_COUNTL 0x73 |
JojoS | 0:ab00d9bcd00d | 176 | #define MPU9150_RA_FIFO_R_W 0x74 |
JojoS | 0:ab00d9bcd00d | 177 | #define MPU9150_RA_WHO_AM_I 0x75 |
JojoS | 0:ab00d9bcd00d | 178 | |
JojoS | 0:ab00d9bcd00d | 179 | #define MPU9150_TC_PWR_MODE_BIT 7 |
JojoS | 0:ab00d9bcd00d | 180 | #define MPU9150_TC_OFFSET_BIT 6 |
JojoS | 0:ab00d9bcd00d | 181 | #define MPU9150_TC_OFFSET_LENGTH 6 |
JojoS | 0:ab00d9bcd00d | 182 | #define MPU9150_TC_OTP_BNK_VLD_BIT 0 |
JojoS | 0:ab00d9bcd00d | 183 | |
JojoS | 0:ab00d9bcd00d | 184 | #define MPU9150_VDDIO_LEVEL_VLOGIC 0 |
JojoS | 0:ab00d9bcd00d | 185 | #define MPU9150_VDDIO_LEVEL_VDD 1 |
JojoS | 0:ab00d9bcd00d | 186 | |
JojoS | 0:ab00d9bcd00d | 187 | #define MPU9150_CFG_EXT_SYNC_SET_BIT 5 |
JojoS | 0:ab00d9bcd00d | 188 | #define MPU9150_CFG_EXT_SYNC_SET_LENGTH 3 |
JojoS | 0:ab00d9bcd00d | 189 | #define MPU9150_CFG_DLPF_CFG_BIT 2 |
JojoS | 0:ab00d9bcd00d | 190 | #define MPU9150_CFG_DLPF_CFG_LENGTH 3 |
JojoS | 0:ab00d9bcd00d | 191 | |
JojoS | 0:ab00d9bcd00d | 192 | #define MPU9150_EXT_SYNC_DISABLED 0x0 |
JojoS | 0:ab00d9bcd00d | 193 | #define MPU9150_EXT_SYNC_TEMP_OUT_L 0x1 |
JojoS | 0:ab00d9bcd00d | 194 | #define MPU9150_EXT_SYNC_GYRO_XOUT_L 0x2 |
JojoS | 0:ab00d9bcd00d | 195 | #define MPU9150_EXT_SYNC_GYRO_YOUT_L 0x3 |
JojoS | 0:ab00d9bcd00d | 196 | #define MPU9150_EXT_SYNC_GYRO_ZOUT_L 0x4 |
JojoS | 0:ab00d9bcd00d | 197 | #define MPU9150_EXT_SYNC_ACCEL_XOUT_L 0x5 |
JojoS | 0:ab00d9bcd00d | 198 | #define MPU9150_EXT_SYNC_ACCEL_YOUT_L 0x6 |
JojoS | 0:ab00d9bcd00d | 199 | #define MPU9150_EXT_SYNC_ACCEL_ZOUT_L 0x7 |
JojoS | 0:ab00d9bcd00d | 200 | |
JojoS | 0:ab00d9bcd00d | 201 | #define MPU9150_DLPF_BW_256 0x00 |
JojoS | 0:ab00d9bcd00d | 202 | #define MPU9150_DLPF_BW_188 0x01 |
JojoS | 0:ab00d9bcd00d | 203 | #define MPU9150_DLPF_BW_98 0x02 |
JojoS | 0:ab00d9bcd00d | 204 | #define MPU9150_DLPF_BW_42 0x03 |
JojoS | 0:ab00d9bcd00d | 205 | #define MPU9150_DLPF_BW_20 0x04 |
JojoS | 0:ab00d9bcd00d | 206 | #define MPU9150_DLPF_BW_10 0x05 |
JojoS | 0:ab00d9bcd00d | 207 | #define MPU9150_DLPF_BW_5 0x06 |
JojoS | 0:ab00d9bcd00d | 208 | |
JojoS | 0:ab00d9bcd00d | 209 | #define MPU9150_GCONFIG_FS_SEL_BIT 4 |
JojoS | 0:ab00d9bcd00d | 210 | #define MPU9150_GCONFIG_FS_SEL_LENGTH 2 |
JojoS | 0:ab00d9bcd00d | 211 | |
JojoS | 0:ab00d9bcd00d | 212 | #define MPU9150_GYRO_FS_250 0x00 |
JojoS | 0:ab00d9bcd00d | 213 | #define MPU9150_GYRO_FS_500 0x01 |
JojoS | 0:ab00d9bcd00d | 214 | #define MPU9150_GYRO_FS_1000 0x02 |
JojoS | 0:ab00d9bcd00d | 215 | #define MPU9150_GYRO_FS_2000 0x03 |
JojoS | 0:ab00d9bcd00d | 216 | |
JojoS | 0:ab00d9bcd00d | 217 | #define MPU9150_ACONFIG_XA_ST_BIT 7 |
JojoS | 0:ab00d9bcd00d | 218 | #define MPU9150_ACONFIG_YA_ST_BIT 6 |
JojoS | 0:ab00d9bcd00d | 219 | #define MPU9150_ACONFIG_ZA_ST_BIT 5 |
JojoS | 0:ab00d9bcd00d | 220 | #define MPU9150_ACONFIG_AFS_SEL_BIT 4 |
JojoS | 0:ab00d9bcd00d | 221 | #define MPU9150_ACONFIG_AFS_SEL_LENGTH 2 |
JojoS | 0:ab00d9bcd00d | 222 | #define MPU9150_ACONFIG_ACCEL_HPF_BIT 2 |
JojoS | 0:ab00d9bcd00d | 223 | #define MPU9150_ACONFIG_ACCEL_HPF_LENGTH 3 |
JojoS | 0:ab00d9bcd00d | 224 | |
JojoS | 0:ab00d9bcd00d | 225 | #define MPU9150_ACCEL_FS_2 0x00 |
JojoS | 0:ab00d9bcd00d | 226 | #define MPU9150_ACCEL_FS_4 0x01 |
JojoS | 0:ab00d9bcd00d | 227 | #define MPU9150_ACCEL_FS_8 0x02 |
JojoS | 0:ab00d9bcd00d | 228 | #define MPU9150_ACCEL_FS_16 0x03 |
JojoS | 0:ab00d9bcd00d | 229 | |
JojoS | 0:ab00d9bcd00d | 230 | #define MPU9150_DHPF_RESET 0x00 |
JojoS | 0:ab00d9bcd00d | 231 | #define MPU9150_DHPF_5 0x01 |
JojoS | 0:ab00d9bcd00d | 232 | #define MPU9150_DHPF_2P5 0x02 |
JojoS | 0:ab00d9bcd00d | 233 | #define MPU9150_DHPF_1P25 0x03 |
JojoS | 0:ab00d9bcd00d | 234 | #define MPU9150_DHPF_0P63 0x04 |
JojoS | 0:ab00d9bcd00d | 235 | #define MPU9150_DHPF_HOLD 0x07 |
JojoS | 0:ab00d9bcd00d | 236 | |
JojoS | 0:ab00d9bcd00d | 237 | #define MPU9150_TEMP_FIFO_EN_BIT 7 |
JojoS | 0:ab00d9bcd00d | 238 | #define MPU9150_XG_FIFO_EN_BIT 6 |
JojoS | 0:ab00d9bcd00d | 239 | #define MPU9150_YG_FIFO_EN_BIT 5 |
JojoS | 0:ab00d9bcd00d | 240 | #define MPU9150_ZG_FIFO_EN_BIT 4 |
JojoS | 0:ab00d9bcd00d | 241 | #define MPU9150_ACCEL_FIFO_EN_BIT 3 |
JojoS | 0:ab00d9bcd00d | 242 | #define MPU9150_SLV2_FIFO_EN_BIT 2 |
JojoS | 0:ab00d9bcd00d | 243 | #define MPU9150_SLV1_FIFO_EN_BIT 1 |
JojoS | 0:ab00d9bcd00d | 244 | #define MPU9150_SLV0_FIFO_EN_BIT 0 |
JojoS | 0:ab00d9bcd00d | 245 | |
JojoS | 0:ab00d9bcd00d | 246 | #define MPU9150_MULT_MST_EN_BIT 7 |
JojoS | 0:ab00d9bcd00d | 247 | #define MPU9150_WAIT_FOR_ES_BIT 6 |
JojoS | 0:ab00d9bcd00d | 248 | #define MPU9150_SLV_3_FIFO_EN_BIT 5 |
JojoS | 0:ab00d9bcd00d | 249 | #define MPU9150_I2C_MST_P_NSR_BIT 4 |
JojoS | 0:ab00d9bcd00d | 250 | #define MPU9150_I2C_MST_CLK_BIT 3 |
JojoS | 0:ab00d9bcd00d | 251 | #define MPU9150_I2C_MST_CLK_LENGTH 4 |
JojoS | 0:ab00d9bcd00d | 252 | |
JojoS | 0:ab00d9bcd00d | 253 | #define MPU9150_CLOCK_DIV_348 0x0 |
JojoS | 0:ab00d9bcd00d | 254 | #define MPU9150_CLOCK_DIV_333 0x1 |
JojoS | 0:ab00d9bcd00d | 255 | #define MPU9150_CLOCK_DIV_320 0x2 |
JojoS | 0:ab00d9bcd00d | 256 | #define MPU9150_CLOCK_DIV_308 0x3 |
JojoS | 0:ab00d9bcd00d | 257 | #define MPU9150_CLOCK_DIV_296 0x4 |
JojoS | 0:ab00d9bcd00d | 258 | #define MPU9150_CLOCK_DIV_286 0x5 |
JojoS | 0:ab00d9bcd00d | 259 | #define MPU9150_CLOCK_DIV_276 0x6 |
JojoS | 0:ab00d9bcd00d | 260 | #define MPU9150_CLOCK_DIV_267 0x7 |
JojoS | 0:ab00d9bcd00d | 261 | #define MPU9150_CLOCK_DIV_258 0x8 |
JojoS | 0:ab00d9bcd00d | 262 | #define MPU9150_CLOCK_DIV_500 0x9 |
JojoS | 0:ab00d9bcd00d | 263 | #define MPU9150_CLOCK_DIV_471 0xA |
JojoS | 0:ab00d9bcd00d | 264 | #define MPU9150_CLOCK_DIV_444 0xB |
JojoS | 0:ab00d9bcd00d | 265 | #define MPU9150_CLOCK_DIV_421 0xC |
JojoS | 0:ab00d9bcd00d | 266 | #define MPU9150_CLOCK_DIV_400 0xD |
JojoS | 0:ab00d9bcd00d | 267 | #define MPU9150_CLOCK_DIV_381 0xE |
JojoS | 0:ab00d9bcd00d | 268 | #define MPU9150_CLOCK_DIV_364 0xF |
JojoS | 0:ab00d9bcd00d | 269 | |
JojoS | 0:ab00d9bcd00d | 270 | #define MPU9150_I2C_SLV_RW_BIT 7 |
JojoS | 0:ab00d9bcd00d | 271 | #define MPU9150_I2C_SLV_ADDR_BIT 6 |
JojoS | 0:ab00d9bcd00d | 272 | #define MPU9150_I2C_SLV_ADDR_LENGTH 7 |
JojoS | 0:ab00d9bcd00d | 273 | #define MPU9150_I2C_SLV_EN_BIT 7 |
JojoS | 0:ab00d9bcd00d | 274 | #define MPU9150_I2C_SLV_BYTE_SW_BIT 6 |
JojoS | 0:ab00d9bcd00d | 275 | #define MPU9150_I2C_SLV_REG_DIS_BIT 5 |
JojoS | 0:ab00d9bcd00d | 276 | #define MPU9150_I2C_SLV_GRP_BIT 4 |
JojoS | 0:ab00d9bcd00d | 277 | #define MPU9150_I2C_SLV_LEN_BIT 3 |
JojoS | 0:ab00d9bcd00d | 278 | #define MPU9150_I2C_SLV_LEN_LENGTH 4 |
JojoS | 0:ab00d9bcd00d | 279 | |
JojoS | 0:ab00d9bcd00d | 280 | #define MPU9150_I2C_SLV4_RW_BIT 7 |
JojoS | 0:ab00d9bcd00d | 281 | #define MPU9150_I2C_SLV4_ADDR_BIT 6 |
JojoS | 0:ab00d9bcd00d | 282 | #define MPU9150_I2C_SLV4_ADDR_LENGTH 7 |
JojoS | 0:ab00d9bcd00d | 283 | #define MPU9150_I2C_SLV4_EN_BIT 7 |
JojoS | 0:ab00d9bcd00d | 284 | #define MPU9150_I2C_SLV4_INT_EN_BIT 6 |
JojoS | 0:ab00d9bcd00d | 285 | #define MPU9150_I2C_SLV4_REG_DIS_BIT 5 |
JojoS | 0:ab00d9bcd00d | 286 | #define MPU9150_I2C_SLV4_MST_DLY_BIT 4 |
JojoS | 0:ab00d9bcd00d | 287 | #define MPU9150_I2C_SLV4_MST_DLY_LENGTH 5 |
JojoS | 0:ab00d9bcd00d | 288 | |
JojoS | 0:ab00d9bcd00d | 289 | #define MPU9150_MST_PASS_THROUGH_BIT 7 |
JojoS | 0:ab00d9bcd00d | 290 | #define MPU9150_MST_I2C_SLV4_DONE_BIT 6 |
JojoS | 0:ab00d9bcd00d | 291 | #define MPU9150_MST_I2C_LOST_ARB_BIT 5 |
JojoS | 0:ab00d9bcd00d | 292 | #define MPU9150_MST_I2C_SLV4_NACK_BIT 4 |
JojoS | 0:ab00d9bcd00d | 293 | #define MPU9150_MST_I2C_SLV3_NACK_BIT 3 |
JojoS | 0:ab00d9bcd00d | 294 | #define MPU9150_MST_I2C_SLV2_NACK_BIT 2 |
JojoS | 0:ab00d9bcd00d | 295 | #define MPU9150_MST_I2C_SLV1_NACK_BIT 1 |
JojoS | 0:ab00d9bcd00d | 296 | #define MPU9150_MST_I2C_SLV0_NACK_BIT 0 |
JojoS | 0:ab00d9bcd00d | 297 | |
JojoS | 0:ab00d9bcd00d | 298 | #define MPU9150_INTCFG_INT_LEVEL_BIT 7 |
JojoS | 0:ab00d9bcd00d | 299 | #define MPU9150_INTCFG_INT_OPEN_BIT 6 |
JojoS | 0:ab00d9bcd00d | 300 | #define MPU9150_INTCFG_LATCH_INT_EN_BIT 5 |
JojoS | 0:ab00d9bcd00d | 301 | #define MPU9150_INTCFG_INT_RD_CLEAR_BIT 4 |
JojoS | 0:ab00d9bcd00d | 302 | #define MPU9150_INTCFG_FSYNC_INT_LEVEL_BIT 3 |
JojoS | 0:ab00d9bcd00d | 303 | #define MPU9150_INTCFG_FSYNC_INT_EN_BIT 2 |
JojoS | 0:ab00d9bcd00d | 304 | #define MPU9150_INTCFG_I2C_BYPASS_EN_BIT 1 |
JojoS | 0:ab00d9bcd00d | 305 | #define MPU9150_INTCFG_CLKOUT_EN_BIT 0 |
JojoS | 0:ab00d9bcd00d | 306 | |
JojoS | 0:ab00d9bcd00d | 307 | #define MPU9150_INTMODE_ACTIVEHIGH 0x00 |
JojoS | 0:ab00d9bcd00d | 308 | #define MPU9150_INTMODE_ACTIVELOW 0x01 |
JojoS | 0:ab00d9bcd00d | 309 | |
JojoS | 0:ab00d9bcd00d | 310 | #define MPU9150_INTDRV_PUSHPULL 0x00 |
JojoS | 0:ab00d9bcd00d | 311 | #define MPU9150_INTDRV_OPENDRAIN 0x01 |
JojoS | 0:ab00d9bcd00d | 312 | |
JojoS | 0:ab00d9bcd00d | 313 | #define MPU9150_INTLATCH_50USPULSE 0x00 |
JojoS | 0:ab00d9bcd00d | 314 | #define MPU9150_INTLATCH_WAITCLEAR 0x01 |
JojoS | 0:ab00d9bcd00d | 315 | |
JojoS | 0:ab00d9bcd00d | 316 | #define MPU9150_INTCLEAR_STATUSREAD 0x00 |
JojoS | 0:ab00d9bcd00d | 317 | #define MPU9150_INTCLEAR_ANYREAD 0x01 |
JojoS | 0:ab00d9bcd00d | 318 | |
JojoS | 0:ab00d9bcd00d | 319 | #define MPU9150_INTERRUPT_FF_BIT 7 |
JojoS | 0:ab00d9bcd00d | 320 | #define MPU9150_INTERRUPT_MOT_BIT 6 |
JojoS | 0:ab00d9bcd00d | 321 | #define MPU9150_INTERRUPT_ZMOT_BIT 5 |
JojoS | 0:ab00d9bcd00d | 322 | #define MPU9150_INTERRUPT_FIFO_OFLOW_BIT 4 |
JojoS | 0:ab00d9bcd00d | 323 | #define MPU9150_INTERRUPT_I2C_MST_INT_BIT 3 |
JojoS | 0:ab00d9bcd00d | 324 | #define MPU9150_INTERRUPT_PLL_RDY_INT_BIT 2 |
JojoS | 0:ab00d9bcd00d | 325 | #define MPU9150_INTERRUPT_DMP_INT_BIT 1 |
JojoS | 0:ab00d9bcd00d | 326 | #define MPU9150_INTERRUPT_DATA_RDY_BIT 0 |
JojoS | 0:ab00d9bcd00d | 327 | |
JojoS | 0:ab00d9bcd00d | 328 | // TODO: figure out what these actually do |
JojoS | 0:ab00d9bcd00d | 329 | // UMPL source code is not very obivous |
JojoS | 0:ab00d9bcd00d | 330 | #define MPU9150_DMPINT_5_BIT 5 |
JojoS | 0:ab00d9bcd00d | 331 | #define MPU9150_DMPINT_4_BIT 4 |
JojoS | 0:ab00d9bcd00d | 332 | #define MPU9150_DMPINT_3_BIT 3 |
JojoS | 0:ab00d9bcd00d | 333 | #define MPU9150_DMPINT_2_BIT 2 |
JojoS | 0:ab00d9bcd00d | 334 | #define MPU9150_DMPINT_1_BIT 1 |
JojoS | 0:ab00d9bcd00d | 335 | #define MPU9150_DMPINT_0_BIT 0 |
JojoS | 0:ab00d9bcd00d | 336 | |
JojoS | 0:ab00d9bcd00d | 337 | #define MPU9150_MOTION_MOT_XNEG_BIT 7 |
JojoS | 0:ab00d9bcd00d | 338 | #define MPU9150_MOTION_MOT_XPOS_BIT 6 |
JojoS | 0:ab00d9bcd00d | 339 | #define MPU9150_MOTION_MOT_YNEG_BIT 5 |
JojoS | 0:ab00d9bcd00d | 340 | #define MPU9150_MOTION_MOT_YPOS_BIT 4 |
JojoS | 0:ab00d9bcd00d | 341 | #define MPU9150_MOTION_MOT_ZNEG_BIT 3 |
JojoS | 0:ab00d9bcd00d | 342 | #define MPU9150_MOTION_MOT_ZPOS_BIT 2 |
JojoS | 0:ab00d9bcd00d | 343 | #define MPU9150_MOTION_MOT_ZRMOT_BIT 0 |
JojoS | 0:ab00d9bcd00d | 344 | |
JojoS | 0:ab00d9bcd00d | 345 | #define MPU9150_DELAYCTRL_DELAY_ES_SHADOW_BIT 7 |
JojoS | 0:ab00d9bcd00d | 346 | #define MPU9150_DELAYCTRL_I2C_SLV4_DLY_EN_BIT 4 |
JojoS | 0:ab00d9bcd00d | 347 | #define MPU9150_DELAYCTRL_I2C_SLV3_DLY_EN_BIT 3 |
JojoS | 0:ab00d9bcd00d | 348 | #define MPU9150_DELAYCTRL_I2C_SLV2_DLY_EN_BIT 2 |
JojoS | 0:ab00d9bcd00d | 349 | #define MPU9150_DELAYCTRL_I2C_SLV1_DLY_EN_BIT 1 |
JojoS | 0:ab00d9bcd00d | 350 | #define MPU9150_DELAYCTRL_I2C_SLV0_DLY_EN_BIT 0 |
JojoS | 0:ab00d9bcd00d | 351 | |
JojoS | 0:ab00d9bcd00d | 352 | #define MPU9150_PATHRESET_GYRO_RESET_BIT 2 |
JojoS | 0:ab00d9bcd00d | 353 | #define MPU9150_PATHRESET_ACCEL_RESET_BIT 1 |
JojoS | 0:ab00d9bcd00d | 354 | #define MPU9150_PATHRESET_TEMP_RESET_BIT 0 |
JojoS | 0:ab00d9bcd00d | 355 | |
JojoS | 0:ab00d9bcd00d | 356 | #define MPU9150_DETECT_ACCEL_ON_DELAY_BIT 5 |
JojoS | 0:ab00d9bcd00d | 357 | #define MPU9150_DETECT_ACCEL_ON_DELAY_LENGTH 2 |
JojoS | 0:ab00d9bcd00d | 358 | #define MPU9150_DETECT_FF_COUNT_BIT 3 |
JojoS | 0:ab00d9bcd00d | 359 | #define MPU9150_DETECT_FF_COUNT_LENGTH 2 |
JojoS | 0:ab00d9bcd00d | 360 | #define MPU9150_DETECT_MOT_COUNT_BIT 1 |
JojoS | 0:ab00d9bcd00d | 361 | #define MPU9150_DETECT_MOT_COUNT_LENGTH 2 |
JojoS | 0:ab00d9bcd00d | 362 | |
JojoS | 0:ab00d9bcd00d | 363 | #define MPU9150_DETECT_DECREMENT_RESET 0x0 |
JojoS | 0:ab00d9bcd00d | 364 | #define MPU9150_DETECT_DECREMENT_1 0x1 |
JojoS | 0:ab00d9bcd00d | 365 | #define MPU9150_DETECT_DECREMENT_2 0x2 |
JojoS | 0:ab00d9bcd00d | 366 | #define MPU9150_DETECT_DECREMENT_4 0x3 |
JojoS | 0:ab00d9bcd00d | 367 | |
JojoS | 0:ab00d9bcd00d | 368 | #define MPU9150_USERCTRL_DMP_EN_BIT 7 |
JojoS | 0:ab00d9bcd00d | 369 | #define MPU9150_USERCTRL_FIFO_EN_BIT 6 |
JojoS | 0:ab00d9bcd00d | 370 | #define MPU9150_USERCTRL_I2C_MST_EN_BIT 5 |
JojoS | 0:ab00d9bcd00d | 371 | #define MPU9150_USERCTRL_I2C_IF_DIS_BIT 4 |
JojoS | 0:ab00d9bcd00d | 372 | #define MPU9150_USERCTRL_DMP_RESET_BIT 3 |
JojoS | 0:ab00d9bcd00d | 373 | #define MPU9150_USERCTRL_FIFO_RESET_BIT 2 |
JojoS | 0:ab00d9bcd00d | 374 | #define MPU9150_USERCTRL_I2C_MST_RESET_BIT 1 |
JojoS | 0:ab00d9bcd00d | 375 | #define MPU9150_USERCTRL_SIG_COND_RESET_BIT 0 |
JojoS | 0:ab00d9bcd00d | 376 | |
JojoS | 0:ab00d9bcd00d | 377 | #define MPU9150_PWR1_DEVICE_RESET_BIT 7 |
JojoS | 0:ab00d9bcd00d | 378 | #define MPU9150_PWR1_SLEEP_BIT 6 |
JojoS | 0:ab00d9bcd00d | 379 | #define MPU9150_PWR1_CYCLE_BIT 5 |
JojoS | 0:ab00d9bcd00d | 380 | #define MPU9150_PWR1_TEMP_DIS_BIT 3 |
JojoS | 0:ab00d9bcd00d | 381 | #define MPU9150_PWR1_CLKSEL_BIT 2 |
JojoS | 0:ab00d9bcd00d | 382 | #define MPU9150_PWR1_CLKSEL_LENGTH 3 |
JojoS | 0:ab00d9bcd00d | 383 | |
JojoS | 0:ab00d9bcd00d | 384 | #define MPU9150_CLOCK_INTERNAL 0x00 |
JojoS | 0:ab00d9bcd00d | 385 | #define MPU9150_CLOCK_PLL_XGYRO 0x01 |
JojoS | 0:ab00d9bcd00d | 386 | #define MPU9150_CLOCK_PLL_YGYRO 0x02 |
JojoS | 0:ab00d9bcd00d | 387 | #define MPU9150_CLOCK_PLL_ZGYRO 0x03 |
JojoS | 0:ab00d9bcd00d | 388 | #define MPU9150_CLOCK_PLL_EXT32K 0x04 |
JojoS | 0:ab00d9bcd00d | 389 | #define MPU9150_CLOCK_PLL_EXT19M 0x05 |
JojoS | 0:ab00d9bcd00d | 390 | #define MPU9150_CLOCK_KEEP_RESET 0x07 |
JojoS | 0:ab00d9bcd00d | 391 | |
JojoS | 0:ab00d9bcd00d | 392 | #define MPU9150_PWR2_LP_WAKE_CTRL_BIT 7 |
JojoS | 0:ab00d9bcd00d | 393 | #define MPU9150_PWR2_LP_WAKE_CTRL_LENGTH 2 |
JojoS | 0:ab00d9bcd00d | 394 | #define MPU9150_PWR2_STBY_XA_BIT 5 |
JojoS | 0:ab00d9bcd00d | 395 | #define MPU9150_PWR2_STBY_YA_BIT 4 |
JojoS | 0:ab00d9bcd00d | 396 | #define MPU9150_PWR2_STBY_ZA_BIT 3 |
JojoS | 0:ab00d9bcd00d | 397 | #define MPU9150_PWR2_STBY_XG_BIT 2 |
JojoS | 0:ab00d9bcd00d | 398 | #define MPU9150_PWR2_STBY_YG_BIT 1 |
JojoS | 0:ab00d9bcd00d | 399 | #define MPU9150_PWR2_STBY_ZG_BIT 0 |
JojoS | 0:ab00d9bcd00d | 400 | |
JojoS | 0:ab00d9bcd00d | 401 | #define MPU9150_WAKE_FREQ_1P25 0x0 |
JojoS | 0:ab00d9bcd00d | 402 | #define MPU9150_WAKE_FREQ_2P5 0x1 |
JojoS | 0:ab00d9bcd00d | 403 | #define MPU9150_WAKE_FREQ_5 0x2 |
JojoS | 0:ab00d9bcd00d | 404 | #define MPU9150_WAKE_FREQ_10 0x3 |
JojoS | 0:ab00d9bcd00d | 405 | |
JojoS | 0:ab00d9bcd00d | 406 | #define MPU9150_BANKSEL_PRFTCH_EN_BIT 6 |
JojoS | 0:ab00d9bcd00d | 407 | #define MPU9150_BANKSEL_CFG_USER_BANK_BIT 5 |
JojoS | 0:ab00d9bcd00d | 408 | #define MPU9150_BANKSEL_MEM_SEL_BIT 4 |
JojoS | 0:ab00d9bcd00d | 409 | #define MPU9150_BANKSEL_MEM_SEL_LENGTH 5 |
JojoS | 0:ab00d9bcd00d | 410 | |
JojoS | 0:ab00d9bcd00d | 411 | #define MPU9150_WHO_AM_I_BIT 6 |
JojoS | 0:ab00d9bcd00d | 412 | #define MPU9150_WHO_AM_I_LENGTH 6 |
JojoS | 0:ab00d9bcd00d | 413 | |
JojoS | 0:ab00d9bcd00d | 414 | #define MPU9150_DMP_MEMORY_BANKS 8 |
JojoS | 0:ab00d9bcd00d | 415 | #define MPU9150_DMP_MEMORY_BANK_SIZE 256 |
JojoS | 0:ab00d9bcd00d | 416 | #define MPU9150_DMP_MEMORY_CHUNK_SIZE 16 |
JojoS | 0:ab00d9bcd00d | 417 | |
JojoS | 0:ab00d9bcd00d | 418 | // note: DMP code memory blocks defined at end of header file |
JojoS | 0:ab00d9bcd00d | 419 | |
TuxLeon | 1:c38eb550c82e | 420 | |
JojoS | 0:ab00d9bcd00d | 421 | class MPU9150 { |
JojoS | 0:ab00d9bcd00d | 422 | private: |
TuxLeon | 1:c38eb550c82e | 423 | I2Cdev i2Cdev; |
JojoS | 0:ab00d9bcd00d | 424 | //Serial debugSerial; |
JojoS | 0:ab00d9bcd00d | 425 | |
JojoS | 0:ab00d9bcd00d | 426 | public: |
JojoS | 0:ab00d9bcd00d | 427 | MPU9150(I2Cdev &dev); |
JojoS | 0:ab00d9bcd00d | 428 | MPU9150(I2Cdev &dev, uint8_t address); |
JojoS | 0:ab00d9bcd00d | 429 | |
JojoS | 0:ab00d9bcd00d | 430 | void initialize(); |
JojoS | 0:ab00d9bcd00d | 431 | bool testConnection(); |
JojoS | 0:ab00d9bcd00d | 432 | |
JojoS | 0:ab00d9bcd00d | 433 | // AUX_VDDIO register |
JojoS | 0:ab00d9bcd00d | 434 | uint8_t getAuxVDDIOLevel(); |
JojoS | 0:ab00d9bcd00d | 435 | void setAuxVDDIOLevel(uint8_t level); |
JojoS | 0:ab00d9bcd00d | 436 | |
JojoS | 0:ab00d9bcd00d | 437 | // SMPLRT_DIV register |
JojoS | 0:ab00d9bcd00d | 438 | uint8_t getRate(); |
JojoS | 0:ab00d9bcd00d | 439 | void setRate(uint8_t rate); |
JojoS | 0:ab00d9bcd00d | 440 | |
JojoS | 0:ab00d9bcd00d | 441 | // CONFIG register |
JojoS | 0:ab00d9bcd00d | 442 | uint8_t getExternalFrameSync(); |
JojoS | 0:ab00d9bcd00d | 443 | void setExternalFrameSync(uint8_t sync); |
JojoS | 0:ab00d9bcd00d | 444 | uint8_t getDLPFMode(); |
JojoS | 0:ab00d9bcd00d | 445 | void setDLPFMode(uint8_t bandwidth); |
JojoS | 0:ab00d9bcd00d | 446 | |
JojoS | 0:ab00d9bcd00d | 447 | // GYRO_CONFIG register |
JojoS | 0:ab00d9bcd00d | 448 | uint8_t getFullScaleGyroRange(); |
JojoS | 0:ab00d9bcd00d | 449 | void setFullScaleGyroRange(uint8_t range); |
JojoS | 0:ab00d9bcd00d | 450 | |
JojoS | 0:ab00d9bcd00d | 451 | // ACCEL_CONFIG register |
JojoS | 0:ab00d9bcd00d | 452 | bool getAccelXSelfTest(); |
JojoS | 0:ab00d9bcd00d | 453 | void setAccelXSelfTest(bool enabled); |
JojoS | 0:ab00d9bcd00d | 454 | bool getAccelYSelfTest(); |
JojoS | 0:ab00d9bcd00d | 455 | void setAccelYSelfTest(bool enabled); |
JojoS | 0:ab00d9bcd00d | 456 | bool getAccelZSelfTest(); |
JojoS | 0:ab00d9bcd00d | 457 | void setAccelZSelfTest(bool enabled); |
JojoS | 0:ab00d9bcd00d | 458 | uint8_t getFullScaleAccelRange(); |
JojoS | 0:ab00d9bcd00d | 459 | void setFullScaleAccelRange(uint8_t range); |
JojoS | 0:ab00d9bcd00d | 460 | uint8_t getDHPFMode(); |
JojoS | 0:ab00d9bcd00d | 461 | void setDHPFMode(uint8_t mode); |
JojoS | 0:ab00d9bcd00d | 462 | |
JojoS | 0:ab00d9bcd00d | 463 | // FF_THR register |
JojoS | 0:ab00d9bcd00d | 464 | uint8_t getFreefallDetectionThreshold(); |
JojoS | 0:ab00d9bcd00d | 465 | void setFreefallDetectionThreshold(uint8_t threshold); |
JojoS | 0:ab00d9bcd00d | 466 | |
JojoS | 0:ab00d9bcd00d | 467 | // FF_DUR register |
JojoS | 0:ab00d9bcd00d | 468 | uint8_t getFreefallDetectionDuration(); |
JojoS | 0:ab00d9bcd00d | 469 | void setFreefallDetectionDuration(uint8_t duration); |
JojoS | 0:ab00d9bcd00d | 470 | |
JojoS | 0:ab00d9bcd00d | 471 | // MOT_THR register |
JojoS | 0:ab00d9bcd00d | 472 | uint8_t getMotionDetectionThreshold(); |
JojoS | 0:ab00d9bcd00d | 473 | void setMotionDetectionThreshold(uint8_t threshold); |
JojoS | 0:ab00d9bcd00d | 474 | |
JojoS | 0:ab00d9bcd00d | 475 | // MOT_DUR register |
JojoS | 0:ab00d9bcd00d | 476 | uint8_t getMotionDetectionDuration(); |
JojoS | 0:ab00d9bcd00d | 477 | void setMotionDetectionDuration(uint8_t duration); |
JojoS | 0:ab00d9bcd00d | 478 | |
JojoS | 0:ab00d9bcd00d | 479 | // ZRMOT_THR register |
JojoS | 0:ab00d9bcd00d | 480 | uint8_t getZeroMotionDetectionThreshold(); |
JojoS | 0:ab00d9bcd00d | 481 | void setZeroMotionDetectionThreshold(uint8_t threshold); |
JojoS | 0:ab00d9bcd00d | 482 | |
JojoS | 0:ab00d9bcd00d | 483 | // ZRMOT_DUR register |
JojoS | 0:ab00d9bcd00d | 484 | uint8_t getZeroMotionDetectionDuration(); |
JojoS | 0:ab00d9bcd00d | 485 | void setZeroMotionDetectionDuration(uint8_t duration); |
JojoS | 0:ab00d9bcd00d | 486 | |
JojoS | 0:ab00d9bcd00d | 487 | // FIFO_EN register |
JojoS | 0:ab00d9bcd00d | 488 | bool getTempFIFOEnabled(); |
JojoS | 0:ab00d9bcd00d | 489 | void setTempFIFOEnabled(bool enabled); |
JojoS | 0:ab00d9bcd00d | 490 | bool getXGyroFIFOEnabled(); |
JojoS | 0:ab00d9bcd00d | 491 | void setXGyroFIFOEnabled(bool enabled); |
JojoS | 0:ab00d9bcd00d | 492 | bool getYGyroFIFOEnabled(); |
JojoS | 0:ab00d9bcd00d | 493 | void setYGyroFIFOEnabled(bool enabled); |
JojoS | 0:ab00d9bcd00d | 494 | bool getZGyroFIFOEnabled(); |
JojoS | 0:ab00d9bcd00d | 495 | void setZGyroFIFOEnabled(bool enabled); |
JojoS | 0:ab00d9bcd00d | 496 | bool getAccelFIFOEnabled(); |
JojoS | 0:ab00d9bcd00d | 497 | void setAccelFIFOEnabled(bool enabled); |
JojoS | 0:ab00d9bcd00d | 498 | bool getSlave2FIFOEnabled(); |
JojoS | 0:ab00d9bcd00d | 499 | void setSlave2FIFOEnabled(bool enabled); |
JojoS | 0:ab00d9bcd00d | 500 | bool getSlave1FIFOEnabled(); |
JojoS | 0:ab00d9bcd00d | 501 | void setSlave1FIFOEnabled(bool enabled); |
JojoS | 0:ab00d9bcd00d | 502 | bool getSlave0FIFOEnabled(); |
JojoS | 0:ab00d9bcd00d | 503 | void setSlave0FIFOEnabled(bool enabled); |
JojoS | 0:ab00d9bcd00d | 504 | |
JojoS | 0:ab00d9bcd00d | 505 | // I2C_MST_CTRL register |
JojoS | 0:ab00d9bcd00d | 506 | bool getMultiMasterEnabled(); |
JojoS | 0:ab00d9bcd00d | 507 | void setMultiMasterEnabled(bool enabled); |
JojoS | 0:ab00d9bcd00d | 508 | bool getWaitForExternalSensorEnabled(); |
JojoS | 0:ab00d9bcd00d | 509 | void setWaitForExternalSensorEnabled(bool enabled); |
JojoS | 0:ab00d9bcd00d | 510 | bool getSlave3FIFOEnabled(); |
JojoS | 0:ab00d9bcd00d | 511 | void setSlave3FIFOEnabled(bool enabled); |
JojoS | 0:ab00d9bcd00d | 512 | bool getSlaveReadWriteTransitionEnabled(); |
JojoS | 0:ab00d9bcd00d | 513 | void setSlaveReadWriteTransitionEnabled(bool enabled); |
JojoS | 0:ab00d9bcd00d | 514 | uint8_t getMasterClockSpeed(); |
JojoS | 0:ab00d9bcd00d | 515 | void setMasterClockSpeed(uint8_t speed); |
JojoS | 0:ab00d9bcd00d | 516 | |
JojoS | 0:ab00d9bcd00d | 517 | // I2C_SLV* registers (Slave 0-3) |
JojoS | 0:ab00d9bcd00d | 518 | uint8_t getSlaveAddress(uint8_t num); |
JojoS | 0:ab00d9bcd00d | 519 | void setSlaveAddress(uint8_t num, uint8_t address); |
JojoS | 0:ab00d9bcd00d | 520 | uint8_t getSlaveRegister(uint8_t num); |
JojoS | 0:ab00d9bcd00d | 521 | void setSlaveRegister(uint8_t num, uint8_t reg); |
JojoS | 0:ab00d9bcd00d | 522 | bool getSlaveEnabled(uint8_t num); |
JojoS | 0:ab00d9bcd00d | 523 | void setSlaveEnabled(uint8_t num, bool enabled); |
JojoS | 0:ab00d9bcd00d | 524 | bool getSlaveWordByteSwap(uint8_t num); |
JojoS | 0:ab00d9bcd00d | 525 | void setSlaveWordByteSwap(uint8_t num, bool enabled); |
JojoS | 0:ab00d9bcd00d | 526 | bool getSlaveWriteMode(uint8_t num); |
JojoS | 0:ab00d9bcd00d | 527 | void setSlaveWriteMode(uint8_t num, bool mode); |
JojoS | 0:ab00d9bcd00d | 528 | bool getSlaveWordGroupOffset(uint8_t num); |
JojoS | 0:ab00d9bcd00d | 529 | void setSlaveWordGroupOffset(uint8_t num, bool enabled); |
JojoS | 0:ab00d9bcd00d | 530 | uint8_t getSlaveDataLength(uint8_t num); |
JojoS | 0:ab00d9bcd00d | 531 | void setSlaveDataLength(uint8_t num, uint8_t length); |
JojoS | 0:ab00d9bcd00d | 532 | |
JojoS | 0:ab00d9bcd00d | 533 | // I2C_SLV* registers (Slave 4) |
JojoS | 0:ab00d9bcd00d | 534 | uint8_t getSlave4Address(); |
JojoS | 0:ab00d9bcd00d | 535 | void setSlave4Address(uint8_t address); |
JojoS | 0:ab00d9bcd00d | 536 | uint8_t getSlave4Register(); |
JojoS | 0:ab00d9bcd00d | 537 | void setSlave4Register(uint8_t reg); |
JojoS | 0:ab00d9bcd00d | 538 | void setSlave4OutputByte(uint8_t data); |
JojoS | 0:ab00d9bcd00d | 539 | bool getSlave4Enabled(); |
JojoS | 0:ab00d9bcd00d | 540 | void setSlave4Enabled(bool enabled); |
JojoS | 0:ab00d9bcd00d | 541 | bool getSlave4InterruptEnabled(); |
JojoS | 0:ab00d9bcd00d | 542 | void setSlave4InterruptEnabled(bool enabled); |
JojoS | 0:ab00d9bcd00d | 543 | bool getSlave4WriteMode(); |
JojoS | 0:ab00d9bcd00d | 544 | void setSlave4WriteMode(bool mode); |
JojoS | 0:ab00d9bcd00d | 545 | uint8_t getSlave4MasterDelay(); |
JojoS | 0:ab00d9bcd00d | 546 | void setSlave4MasterDelay(uint8_t delay); |
JojoS | 0:ab00d9bcd00d | 547 | uint8_t getSlate4InputByte(); |
JojoS | 0:ab00d9bcd00d | 548 | |
JojoS | 0:ab00d9bcd00d | 549 | // I2C_MST_STATUS register |
JojoS | 0:ab00d9bcd00d | 550 | bool getPassthroughStatus(); |
JojoS | 0:ab00d9bcd00d | 551 | bool getSlave4IsDone(); |
JojoS | 0:ab00d9bcd00d | 552 | bool getLostArbitration(); |
JojoS | 0:ab00d9bcd00d | 553 | bool getSlave4Nack(); |
JojoS | 0:ab00d9bcd00d | 554 | bool getSlave3Nack(); |
JojoS | 0:ab00d9bcd00d | 555 | bool getSlave2Nack(); |
JojoS | 0:ab00d9bcd00d | 556 | bool getSlave1Nack(); |
JojoS | 0:ab00d9bcd00d | 557 | bool getSlave0Nack(); |
JojoS | 0:ab00d9bcd00d | 558 | |
JojoS | 0:ab00d9bcd00d | 559 | // INT_PIN_CFG register |
JojoS | 0:ab00d9bcd00d | 560 | bool getInterruptMode(); |
JojoS | 0:ab00d9bcd00d | 561 | void setInterruptMode(bool mode); |
JojoS | 0:ab00d9bcd00d | 562 | bool getInterruptDrive(); |
JojoS | 0:ab00d9bcd00d | 563 | void setInterruptDrive(bool drive); |
JojoS | 0:ab00d9bcd00d | 564 | bool getInterruptLatch(); |
JojoS | 0:ab00d9bcd00d | 565 | void setInterruptLatch(bool latch); |
JojoS | 0:ab00d9bcd00d | 566 | bool getInterruptLatchClear(); |
JojoS | 0:ab00d9bcd00d | 567 | void setInterruptLatchClear(bool clear); |
JojoS | 0:ab00d9bcd00d | 568 | bool getFSyncInterruptLevel(); |
JojoS | 0:ab00d9bcd00d | 569 | void setFSyncInterruptLevel(bool level); |
JojoS | 0:ab00d9bcd00d | 570 | bool getFSyncInterruptEnabled(); |
JojoS | 0:ab00d9bcd00d | 571 | void setFSyncInterruptEnabled(bool enabled); |
JojoS | 0:ab00d9bcd00d | 572 | bool getI2CBypassEnabled(); |
JojoS | 0:ab00d9bcd00d | 573 | void setI2CBypassEnabled(bool enabled); |
JojoS | 0:ab00d9bcd00d | 574 | bool getClockOutputEnabled(); |
JojoS | 0:ab00d9bcd00d | 575 | void setClockOutputEnabled(bool enabled); |
JojoS | 0:ab00d9bcd00d | 576 | |
JojoS | 0:ab00d9bcd00d | 577 | // INT_ENABLE register |
JojoS | 0:ab00d9bcd00d | 578 | uint8_t getIntEnabled(); |
JojoS | 0:ab00d9bcd00d | 579 | void setIntEnabled(uint8_t enabled); |
JojoS | 0:ab00d9bcd00d | 580 | bool getIntFreefallEnabled(); |
JojoS | 0:ab00d9bcd00d | 581 | void setIntFreefallEnabled(bool enabled); |
JojoS | 0:ab00d9bcd00d | 582 | bool getIntMotionEnabled(); |
JojoS | 0:ab00d9bcd00d | 583 | void setIntMotionEnabled(bool enabled); |
JojoS | 0:ab00d9bcd00d | 584 | bool getIntZeroMotionEnabled(); |
JojoS | 0:ab00d9bcd00d | 585 | void setIntZeroMotionEnabled(bool enabled); |
JojoS | 0:ab00d9bcd00d | 586 | bool getIntFIFOBufferOverflowEnabled(); |
JojoS | 0:ab00d9bcd00d | 587 | void setIntFIFOBufferOverflowEnabled(bool enabled); |
JojoS | 0:ab00d9bcd00d | 588 | bool getIntI2CMasterEnabled(); |
JojoS | 0:ab00d9bcd00d | 589 | void setIntI2CMasterEnabled(bool enabled); |
JojoS | 0:ab00d9bcd00d | 590 | bool getIntDataReadyEnabled(); |
JojoS | 0:ab00d9bcd00d | 591 | void setIntDataReadyEnabled(bool enabled); |
JojoS | 0:ab00d9bcd00d | 592 | |
JojoS | 0:ab00d9bcd00d | 593 | // INT_STATUS register |
JojoS | 0:ab00d9bcd00d | 594 | uint8_t getIntStatus(); |
JojoS | 0:ab00d9bcd00d | 595 | bool getIntFreefallStatus(); |
JojoS | 0:ab00d9bcd00d | 596 | bool getIntMotionStatus(); |
JojoS | 0:ab00d9bcd00d | 597 | bool getIntZeroMotionStatus(); |
JojoS | 0:ab00d9bcd00d | 598 | bool getIntFIFOBufferOverflowStatus(); |
JojoS | 0:ab00d9bcd00d | 599 | bool getIntI2CMasterStatus(); |
JojoS | 0:ab00d9bcd00d | 600 | bool getIntDataReadyStatus(); |
JojoS | 0:ab00d9bcd00d | 601 | |
JojoS | 0:ab00d9bcd00d | 602 | // ACCEL_*OUT_* registers |
JojoS | 0:ab00d9bcd00d | 603 | 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); |
JojoS | 0:ab00d9bcd00d | 604 | void getMotion6(int16_t* ax, int16_t* ay, int16_t* az, int16_t* gx, int16_t* gy, int16_t* gz); |
JojoS | 0:ab00d9bcd00d | 605 | void getAcceleration(int16_t* x, int16_t* y, int16_t* z); |
JojoS | 0:ab00d9bcd00d | 606 | int16_t getAccelerationX(); |
JojoS | 0:ab00d9bcd00d | 607 | int16_t getAccelerationY(); |
JojoS | 0:ab00d9bcd00d | 608 | int16_t getAccelerationZ(); |
JojoS | 0:ab00d9bcd00d | 609 | |
JojoS | 0:ab00d9bcd00d | 610 | // TEMP_OUT_* registers |
JojoS | 0:ab00d9bcd00d | 611 | int16_t getTemperature(); |
JojoS | 0:ab00d9bcd00d | 612 | |
JojoS | 0:ab00d9bcd00d | 613 | // GYRO_*OUT_* registers |
JojoS | 0:ab00d9bcd00d | 614 | void getRotation(int16_t* x, int16_t* y, int16_t* z); |
JojoS | 0:ab00d9bcd00d | 615 | int16_t getRotationX(); |
JojoS | 0:ab00d9bcd00d | 616 | int16_t getRotationY(); |
JojoS | 0:ab00d9bcd00d | 617 | int16_t getRotationZ(); |
JojoS | 0:ab00d9bcd00d | 618 | |
JojoS | 0:ab00d9bcd00d | 619 | // EXT_SENS_DATA_* registers |
JojoS | 0:ab00d9bcd00d | 620 | uint8_t getExternalSensorByte(int position); |
JojoS | 0:ab00d9bcd00d | 621 | uint16_t getExternalSensorWord(int position); |
JojoS | 0:ab00d9bcd00d | 622 | uint32_t getExternalSensorDWord(int position); |
JojoS | 0:ab00d9bcd00d | 623 | |
JojoS | 0:ab00d9bcd00d | 624 | // MOT_DETECT_STATUS register |
JojoS | 0:ab00d9bcd00d | 625 | bool getXNegMotionDetected(); |
JojoS | 0:ab00d9bcd00d | 626 | bool getXPosMotionDetected(); |
JojoS | 0:ab00d9bcd00d | 627 | bool getYNegMotionDetected(); |
JojoS | 0:ab00d9bcd00d | 628 | bool getYPosMotionDetected(); |
JojoS | 0:ab00d9bcd00d | 629 | bool getZNegMotionDetected(); |
JojoS | 0:ab00d9bcd00d | 630 | bool getZPosMotionDetected(); |
JojoS | 0:ab00d9bcd00d | 631 | bool getZeroMotionDetected(); |
JojoS | 0:ab00d9bcd00d | 632 | |
JojoS | 0:ab00d9bcd00d | 633 | // I2C_SLV*_DO register |
JojoS | 0:ab00d9bcd00d | 634 | void setSlaveOutputByte(uint8_t num, uint8_t data); |
JojoS | 0:ab00d9bcd00d | 635 | |
JojoS | 0:ab00d9bcd00d | 636 | // I2C_MST_DELAY_CTRL register |
JojoS | 0:ab00d9bcd00d | 637 | bool getExternalShadowDelayEnabled(); |
JojoS | 0:ab00d9bcd00d | 638 | void setExternalShadowDelayEnabled(bool enabled); |
JojoS | 0:ab00d9bcd00d | 639 | bool getSlaveDelayEnabled(uint8_t num); |
JojoS | 0:ab00d9bcd00d | 640 | void setSlaveDelayEnabled(uint8_t num, bool enabled); |
JojoS | 0:ab00d9bcd00d | 641 | |
JojoS | 0:ab00d9bcd00d | 642 | // SIGNAL_PATH_RESET register |
JojoS | 0:ab00d9bcd00d | 643 | void resetGyroscopePath(); |
JojoS | 0:ab00d9bcd00d | 644 | void resetAccelerometerPath(); |
JojoS | 0:ab00d9bcd00d | 645 | void resetTemperaturePath(); |
JojoS | 0:ab00d9bcd00d | 646 | |
JojoS | 0:ab00d9bcd00d | 647 | // MOT_DETECT_CTRL register |
JojoS | 0:ab00d9bcd00d | 648 | uint8_t getAccelerometerPowerOnDelay(); |
JojoS | 0:ab00d9bcd00d | 649 | void setAccelerometerPowerOnDelay(uint8_t delay); |
JojoS | 0:ab00d9bcd00d | 650 | uint8_t getFreefallDetectionCounterDecrement(); |
JojoS | 0:ab00d9bcd00d | 651 | void setFreefallDetectionCounterDecrement(uint8_t decrement); |
JojoS | 0:ab00d9bcd00d | 652 | uint8_t getMotionDetectionCounterDecrement(); |
JojoS | 0:ab00d9bcd00d | 653 | void setMotionDetectionCounterDecrement(uint8_t decrement); |
JojoS | 0:ab00d9bcd00d | 654 | |
JojoS | 0:ab00d9bcd00d | 655 | // USER_CTRL register |
JojoS | 0:ab00d9bcd00d | 656 | bool getFIFOEnabled(); |
JojoS | 0:ab00d9bcd00d | 657 | void setFIFOEnabled(bool enabled); |
JojoS | 0:ab00d9bcd00d | 658 | bool getI2CMasterModeEnabled(); |
JojoS | 0:ab00d9bcd00d | 659 | void setI2CMasterModeEnabled(bool enabled); |
JojoS | 0:ab00d9bcd00d | 660 | void switchSPIEnabled(bool enabled); |
JojoS | 0:ab00d9bcd00d | 661 | void resetFIFO(); |
JojoS | 0:ab00d9bcd00d | 662 | void resetI2CMaster(); |
JojoS | 0:ab00d9bcd00d | 663 | void resetSensors(); |
JojoS | 0:ab00d9bcd00d | 664 | |
JojoS | 0:ab00d9bcd00d | 665 | // PWR_MGMT_1 register |
JojoS | 0:ab00d9bcd00d | 666 | void reset(); |
JojoS | 0:ab00d9bcd00d | 667 | bool getSleepEnabled(); |
JojoS | 0:ab00d9bcd00d | 668 | void setSleepEnabled(bool enabled); |
JojoS | 0:ab00d9bcd00d | 669 | bool getWakeCycleEnabled(); |
JojoS | 0:ab00d9bcd00d | 670 | void setWakeCycleEnabled(bool enabled); |
JojoS | 0:ab00d9bcd00d | 671 | bool getTempSensorEnabled(); |
JojoS | 0:ab00d9bcd00d | 672 | void setTempSensorEnabled(bool enabled); |
JojoS | 0:ab00d9bcd00d | 673 | uint8_t getClockSource(); |
JojoS | 0:ab00d9bcd00d | 674 | void setClockSource(uint8_t source); |
JojoS | 0:ab00d9bcd00d | 675 | |
JojoS | 0:ab00d9bcd00d | 676 | // PWR_MGMT_2 register |
JojoS | 0:ab00d9bcd00d | 677 | uint8_t getWakeFrequency(); |
JojoS | 0:ab00d9bcd00d | 678 | void setWakeFrequency(uint8_t frequency); |
JojoS | 0:ab00d9bcd00d | 679 | bool getStandbyXAccelEnabled(); |
JojoS | 0:ab00d9bcd00d | 680 | void setStandbyXAccelEnabled(bool enabled); |
JojoS | 0:ab00d9bcd00d | 681 | bool getStandbyYAccelEnabled(); |
JojoS | 0:ab00d9bcd00d | 682 | void setStandbyYAccelEnabled(bool enabled); |
JojoS | 0:ab00d9bcd00d | 683 | bool getStandbyZAccelEnabled(); |
JojoS | 0:ab00d9bcd00d | 684 | void setStandbyZAccelEnabled(bool enabled); |
JojoS | 0:ab00d9bcd00d | 685 | bool getStandbyXGyroEnabled(); |
JojoS | 0:ab00d9bcd00d | 686 | void setStandbyXGyroEnabled(bool enabled); |
JojoS | 0:ab00d9bcd00d | 687 | bool getStandbyYGyroEnabled(); |
JojoS | 0:ab00d9bcd00d | 688 | void setStandbyYGyroEnabled(bool enabled); |
JojoS | 0:ab00d9bcd00d | 689 | bool getStandbyZGyroEnabled(); |
JojoS | 0:ab00d9bcd00d | 690 | void setStandbyZGyroEnabled(bool enabled); |
JojoS | 0:ab00d9bcd00d | 691 | |
JojoS | 0:ab00d9bcd00d | 692 | // FIFO_COUNT_* registers |
JojoS | 0:ab00d9bcd00d | 693 | uint16_t getFIFOCount(); |
JojoS | 0:ab00d9bcd00d | 694 | |
JojoS | 0:ab00d9bcd00d | 695 | // FIFO_R_W register |
JojoS | 0:ab00d9bcd00d | 696 | uint8_t getFIFOByte(); |
JojoS | 0:ab00d9bcd00d | 697 | void setFIFOByte(uint8_t data); |
JojoS | 0:ab00d9bcd00d | 698 | void getFIFOBytes(uint8_t *data, uint8_t length); |
JojoS | 0:ab00d9bcd00d | 699 | |
JojoS | 0:ab00d9bcd00d | 700 | // WHO_AM_I register |
JojoS | 0:ab00d9bcd00d | 701 | uint8_t getDeviceID(); |
JojoS | 0:ab00d9bcd00d | 702 | void setDeviceID(uint8_t id); |
JojoS | 0:ab00d9bcd00d | 703 | |
JojoS | 0:ab00d9bcd00d | 704 | // ======== UNDOCUMENTED/DMP REGISTERS/METHODS ======== |
JojoS | 0:ab00d9bcd00d | 705 | |
JojoS | 0:ab00d9bcd00d | 706 | // XG_OFFS_TC register |
JojoS | 0:ab00d9bcd00d | 707 | uint8_t getOTPBankValid(); |
JojoS | 0:ab00d9bcd00d | 708 | void setOTPBankValid(bool enabled); |
JojoS | 0:ab00d9bcd00d | 709 | int8_t getXGyroOffsetTC(); |
JojoS | 0:ab00d9bcd00d | 710 | void setXGyroOffsetTC(int8_t offset); |
JojoS | 0:ab00d9bcd00d | 711 | |
JojoS | 0:ab00d9bcd00d | 712 | // YG_OFFS_TC register |
JojoS | 0:ab00d9bcd00d | 713 | int8_t getYGyroOffsetTC(); |
JojoS | 0:ab00d9bcd00d | 714 | void setYGyroOffsetTC(int8_t offset); |
JojoS | 0:ab00d9bcd00d | 715 | |
JojoS | 0:ab00d9bcd00d | 716 | // ZG_OFFS_TC register |
JojoS | 0:ab00d9bcd00d | 717 | int8_t getZGyroOffsetTC(); |
JojoS | 0:ab00d9bcd00d | 718 | void setZGyroOffsetTC(int8_t offset); |
JojoS | 0:ab00d9bcd00d | 719 | |
JojoS | 0:ab00d9bcd00d | 720 | // X_FINE_GAIN register |
JojoS | 0:ab00d9bcd00d | 721 | int8_t getXFineGain(); |
JojoS | 0:ab00d9bcd00d | 722 | void setXFineGain(int8_t gain); |
JojoS | 0:ab00d9bcd00d | 723 | |
JojoS | 0:ab00d9bcd00d | 724 | // Y_FINE_GAIN register |
JojoS | 0:ab00d9bcd00d | 725 | int8_t getYFineGain(); |
JojoS | 0:ab00d9bcd00d | 726 | void setYFineGain(int8_t gain); |
JojoS | 0:ab00d9bcd00d | 727 | |
JojoS | 0:ab00d9bcd00d | 728 | // Z_FINE_GAIN register |
JojoS | 0:ab00d9bcd00d | 729 | int8_t getZFineGain(); |
JojoS | 0:ab00d9bcd00d | 730 | void setZFineGain(int8_t gain); |
JojoS | 0:ab00d9bcd00d | 731 | |
JojoS | 0:ab00d9bcd00d | 732 | // XA_OFFS_* registers |
JojoS | 0:ab00d9bcd00d | 733 | int16_t getXAccelOffset(); |
JojoS | 0:ab00d9bcd00d | 734 | void setXAccelOffset(int16_t offset); |
JojoS | 0:ab00d9bcd00d | 735 | |
JojoS | 0:ab00d9bcd00d | 736 | // YA_OFFS_* register |
JojoS | 0:ab00d9bcd00d | 737 | int16_t getYAccelOffset(); |
JojoS | 0:ab00d9bcd00d | 738 | void setYAccelOffset(int16_t offset); |
JojoS | 0:ab00d9bcd00d | 739 | |
JojoS | 0:ab00d9bcd00d | 740 | // ZA_OFFS_* register |
JojoS | 0:ab00d9bcd00d | 741 | int16_t getZAccelOffset(); |
JojoS | 0:ab00d9bcd00d | 742 | void setZAccelOffset(int16_t offset); |
JojoS | 0:ab00d9bcd00d | 743 | |
JojoS | 0:ab00d9bcd00d | 744 | // XG_OFFS_USR* registers |
JojoS | 0:ab00d9bcd00d | 745 | int16_t getXGyroOffset(); |
JojoS | 0:ab00d9bcd00d | 746 | void setXGyroOffset(int16_t offset); |
JojoS | 0:ab00d9bcd00d | 747 | |
JojoS | 0:ab00d9bcd00d | 748 | // YG_OFFS_USR* register |
JojoS | 0:ab00d9bcd00d | 749 | int16_t getYGyroOffset(); |
JojoS | 0:ab00d9bcd00d | 750 | void setYGyroOffset(int16_t offset); |
JojoS | 0:ab00d9bcd00d | 751 | |
JojoS | 0:ab00d9bcd00d | 752 | // ZG_OFFS_USR* register |
JojoS | 0:ab00d9bcd00d | 753 | int16_t getZGyroOffset(); |
JojoS | 0:ab00d9bcd00d | 754 | void setZGyroOffset(int16_t offset); |
JojoS | 0:ab00d9bcd00d | 755 | |
JojoS | 0:ab00d9bcd00d | 756 | // INT_ENABLE register (DMP functions) |
JojoS | 0:ab00d9bcd00d | 757 | bool getIntPLLReadyEnabled(); |
JojoS | 0:ab00d9bcd00d | 758 | void setIntPLLReadyEnabled(bool enabled); |
JojoS | 0:ab00d9bcd00d | 759 | bool getIntDMPEnabled(); |
JojoS | 0:ab00d9bcd00d | 760 | void setIntDMPEnabled(bool enabled); |
JojoS | 0:ab00d9bcd00d | 761 | |
JojoS | 0:ab00d9bcd00d | 762 | // DMP_INT_STATUS |
JojoS | 0:ab00d9bcd00d | 763 | bool getDMPInt5Status(); |
JojoS | 0:ab00d9bcd00d | 764 | bool getDMPInt4Status(); |
JojoS | 0:ab00d9bcd00d | 765 | bool getDMPInt3Status(); |
JojoS | 0:ab00d9bcd00d | 766 | bool getDMPInt2Status(); |
JojoS | 0:ab00d9bcd00d | 767 | bool getDMPInt1Status(); |
JojoS | 0:ab00d9bcd00d | 768 | bool getDMPInt0Status(); |
JojoS | 0:ab00d9bcd00d | 769 | |
JojoS | 0:ab00d9bcd00d | 770 | // INT_STATUS register (DMP functions) |
JojoS | 0:ab00d9bcd00d | 771 | bool getIntPLLReadyStatus(); |
JojoS | 0:ab00d9bcd00d | 772 | bool getIntDMPStatus(); |
JojoS | 0:ab00d9bcd00d | 773 | |
JojoS | 0:ab00d9bcd00d | 774 | // USER_CTRL register (DMP functions) |
JojoS | 0:ab00d9bcd00d | 775 | bool getDMPEnabled(); |
JojoS | 0:ab00d9bcd00d | 776 | void setDMPEnabled(bool enabled); |
JojoS | 0:ab00d9bcd00d | 777 | void resetDMP(); |
JojoS | 0:ab00d9bcd00d | 778 | |
JojoS | 0:ab00d9bcd00d | 779 | // BANK_SEL register |
JojoS | 0:ab00d9bcd00d | 780 | void setMemoryBank(uint8_t bank, bool prefetchEnabled=false, bool userBank=false); |
JojoS | 0:ab00d9bcd00d | 781 | |
JojoS | 0:ab00d9bcd00d | 782 | // MEM_START_ADDR register |
JojoS | 0:ab00d9bcd00d | 783 | void setMemoryStartAddress(uint8_t address); |
JojoS | 0:ab00d9bcd00d | 784 | |
JojoS | 0:ab00d9bcd00d | 785 | // MEM_R_W register |
JojoS | 0:ab00d9bcd00d | 786 | uint8_t readMemoryByte(); |
JojoS | 0:ab00d9bcd00d | 787 | void writeMemoryByte(uint8_t data); |
JojoS | 0:ab00d9bcd00d | 788 | void readMemoryBlock(uint8_t *data, uint16_t dataSize, uint8_t bank=0, uint8_t address=0); |
JojoS | 0:ab00d9bcd00d | 789 | bool writeMemoryBlock(const uint8_t *data, uint16_t dataSize, uint8_t bank=0, uint8_t address=0, bool verify=true, bool useProgMem=false); |
JojoS | 0:ab00d9bcd00d | 790 | bool writeProgMemoryBlock(const uint8_t *data, uint16_t dataSize, uint8_t bank=0, uint8_t address=0, bool verify=true); |
JojoS | 0:ab00d9bcd00d | 791 | |
JojoS | 0:ab00d9bcd00d | 792 | bool writeDMPConfigurationSet(const uint8_t *data, uint16_t dataSize, bool useProgMem=false); |
JojoS | 0:ab00d9bcd00d | 793 | bool writeProgDMPConfigurationSet(const uint8_t *data, uint16_t dataSize); |
JojoS | 0:ab00d9bcd00d | 794 | |
JojoS | 0:ab00d9bcd00d | 795 | // DMP_CFG_1 register |
JojoS | 0:ab00d9bcd00d | 796 | uint8_t getDMPConfig1(); |
JojoS | 0:ab00d9bcd00d | 797 | void setDMPConfig1(uint8_t config); |
JojoS | 0:ab00d9bcd00d | 798 | |
JojoS | 0:ab00d9bcd00d | 799 | // DMP_CFG_2 register |
JojoS | 0:ab00d9bcd00d | 800 | uint8_t getDMPConfig2(); |
JojoS | 0:ab00d9bcd00d | 801 | void setDMPConfig2(uint8_t config); |
JojoS | 0:ab00d9bcd00d | 802 | |
JojoS | 0:ab00d9bcd00d | 803 | // special methods for MotionApps 2.0 implementation |
JojoS | 0:ab00d9bcd00d | 804 | #ifdef MPU9150_INCLUDE_DMP_MOTIONAPPS20 |
JojoS | 0:ab00d9bcd00d | 805 | uint8_t *dmpPacketBuffer; |
JojoS | 0:ab00d9bcd00d | 806 | uint16_t dmpPacketSize; |
JojoS | 0:ab00d9bcd00d | 807 | |
JojoS | 0:ab00d9bcd00d | 808 | uint8_t dmpInitialize(); |
JojoS | 0:ab00d9bcd00d | 809 | bool dmpPacketAvailable(); |
JojoS | 0:ab00d9bcd00d | 810 | |
JojoS | 0:ab00d9bcd00d | 811 | uint8_t dmpSetFIFORate(uint8_t fifoRate); |
JojoS | 0:ab00d9bcd00d | 812 | uint8_t dmpGetFIFORate(); |
JojoS | 0:ab00d9bcd00d | 813 | uint8_t dmpGetSampleStepSizeMS(); |
JojoS | 0:ab00d9bcd00d | 814 | uint8_t dmpGetSampleFrequency(); |
JojoS | 0:ab00d9bcd00d | 815 | int32_t dmpDecodeTemperature(int8_t tempReg); |
JojoS | 0:ab00d9bcd00d | 816 | |
JojoS | 0:ab00d9bcd00d | 817 | // Register callbacks after a packet of FIFO data is processed |
JojoS | 0:ab00d9bcd00d | 818 | //uint8_t dmpRegisterFIFORateProcess(inv_obj_func func, int16_t priority); |
JojoS | 0:ab00d9bcd00d | 819 | //uint8_t dmpUnregisterFIFORateProcess(inv_obj_func func); |
JojoS | 0:ab00d9bcd00d | 820 | uint8_t dmpRunFIFORateProcesses(); |
JojoS | 0:ab00d9bcd00d | 821 | |
JojoS | 0:ab00d9bcd00d | 822 | // Setup FIFO for various output |
JojoS | 0:ab00d9bcd00d | 823 | uint8_t dmpSendQuaternion(uint_fast16_t accuracy); |
JojoS | 0:ab00d9bcd00d | 824 | uint8_t dmpSendGyro(uint_fast16_t elements, uint_fast16_t accuracy); |
JojoS | 0:ab00d9bcd00d | 825 | uint8_t dmpSendAccel(uint_fast16_t elements, uint_fast16_t accuracy); |
JojoS | 0:ab00d9bcd00d | 826 | uint8_t dmpSendLinearAccel(uint_fast16_t elements, uint_fast16_t accuracy); |
JojoS | 0:ab00d9bcd00d | 827 | uint8_t dmpSendLinearAccelInWorld(uint_fast16_t elements, uint_fast16_t accuracy); |
JojoS | 0:ab00d9bcd00d | 828 | uint8_t dmpSendControlData(uint_fast16_t elements, uint_fast16_t accuracy); |
JojoS | 0:ab00d9bcd00d | 829 | uint8_t dmpSendSensorData(uint_fast16_t elements, uint_fast16_t accuracy); |
JojoS | 0:ab00d9bcd00d | 830 | uint8_t dmpSendExternalSensorData(uint_fast16_t elements, uint_fast16_t accuracy); |
JojoS | 0:ab00d9bcd00d | 831 | uint8_t dmpSendGravity(uint_fast16_t elements, uint_fast16_t accuracy); |
JojoS | 0:ab00d9bcd00d | 832 | uint8_t dmpSendPacketNumber(uint_fast16_t accuracy); |
JojoS | 0:ab00d9bcd00d | 833 | uint8_t dmpSendQuantizedAccel(uint_fast16_t elements, uint_fast16_t accuracy); |
JojoS | 0:ab00d9bcd00d | 834 | uint8_t dmpSendEIS(uint_fast16_t elements, uint_fast16_t accuracy); |
JojoS | 0:ab00d9bcd00d | 835 | |
JojoS | 0:ab00d9bcd00d | 836 | // Get Fixed Point data from FIFO |
JojoS | 0:ab00d9bcd00d | 837 | uint8_t dmpGetAccel(int32_t *data, const uint8_t* packet=0); |
JojoS | 0:ab00d9bcd00d | 838 | uint8_t dmpGetAccel(int16_t *data, const uint8_t* packet=0); |
JojoS | 0:ab00d9bcd00d | 839 | uint8_t dmpGetAccel(VectorInt16 *v, const uint8_t* packet=0); |
JojoS | 0:ab00d9bcd00d | 840 | uint8_t dmpGetQuaternion(int32_t *data, const uint8_t* packet=0); |
JojoS | 0:ab00d9bcd00d | 841 | uint8_t dmpGetQuaternion(int16_t *data, const uint8_t* packet=0); |
JojoS | 0:ab00d9bcd00d | 842 | uint8_t dmpGetQuaternion(Quaternion *q, const uint8_t* packet=0); |
JojoS | 0:ab00d9bcd00d | 843 | uint8_t dmpGet6AxisQuaternion(int32_t *data, const uint8_t* packet=0); |
JojoS | 0:ab00d9bcd00d | 844 | uint8_t dmpGet6AxisQuaternion(int16_t *data, const uint8_t* packet=0); |
JojoS | 0:ab00d9bcd00d | 845 | uint8_t dmpGet6AxisQuaternion(Quaternion *q, const uint8_t* packet=0); |
JojoS | 0:ab00d9bcd00d | 846 | uint8_t dmpGetRelativeQuaternion(int32_t *data, const uint8_t* packet=0); |
JojoS | 0:ab00d9bcd00d | 847 | uint8_t dmpGetRelativeQuaternion(int16_t *data, const uint8_t* packet=0); |
JojoS | 0:ab00d9bcd00d | 848 | uint8_t dmpGetRelativeQuaternion(Quaternion *data, const uint8_t* packet=0); |
JojoS | 0:ab00d9bcd00d | 849 | uint8_t dmpGetGyro(int32_t *data, const uint8_t* packet=0); |
JojoS | 0:ab00d9bcd00d | 850 | uint8_t dmpGetGyro(int16_t *data, const uint8_t* packet=0); |
JojoS | 0:ab00d9bcd00d | 851 | uint8_t dmpGetGyro(VectorInt16 *v, const uint8_t* packet=0); |
JojoS | 0:ab00d9bcd00d | 852 | uint8_t dmpSetLinearAccelFilterCoefficient(float coef); |
JojoS | 0:ab00d9bcd00d | 853 | uint8_t dmpGetLinearAccel(int32_t *data, const uint8_t* packet=0); |
JojoS | 0:ab00d9bcd00d | 854 | uint8_t dmpGetLinearAccel(int16_t *data, const uint8_t* packet=0); |
JojoS | 0:ab00d9bcd00d | 855 | uint8_t dmpGetLinearAccel(VectorInt16 *v, const uint8_t* packet=0); |
JojoS | 0:ab00d9bcd00d | 856 | uint8_t dmpGetLinearAccel(VectorInt16 *v, VectorInt16 *vRaw, VectorFloat *gravity); |
JojoS | 0:ab00d9bcd00d | 857 | uint8_t dmpGetLinearAccelInWorld(int32_t *data, const uint8_t* packet=0); |
JojoS | 0:ab00d9bcd00d | 858 | uint8_t dmpGetLinearAccelInWorld(int16_t *data, const uint8_t* packet=0); |
JojoS | 0:ab00d9bcd00d | 859 | uint8_t dmpGetLinearAccelInWorld(VectorInt16 *v, const uint8_t* packet=0); |
JojoS | 0:ab00d9bcd00d | 860 | uint8_t dmpGetLinearAccelInWorld(VectorInt16 *v, VectorInt16 *vReal, Quaternion *q); |
JojoS | 0:ab00d9bcd00d | 861 | uint8_t dmpGetGyroAndAccelSensor(int32_t *data, const uint8_t* packet=0); |
JojoS | 0:ab00d9bcd00d | 862 | uint8_t dmpGetGyroAndAccelSensor(int16_t *data, const uint8_t* packet=0); |
JojoS | 0:ab00d9bcd00d | 863 | uint8_t dmpGetGyroAndAccelSensor(VectorInt16 *g, VectorInt16 *a, const uint8_t* packet=0); |
JojoS | 0:ab00d9bcd00d | 864 | uint8_t dmpGetGyroSensor(int32_t *data, const uint8_t* packet=0); |
JojoS | 0:ab00d9bcd00d | 865 | uint8_t dmpGetGyroSensor(int16_t *data, const uint8_t* packet=0); |
JojoS | 0:ab00d9bcd00d | 866 | uint8_t dmpGetGyroSensor(VectorInt16 *v, const uint8_t* packet=0); |
JojoS | 0:ab00d9bcd00d | 867 | uint8_t dmpGetControlData(int32_t *data, const uint8_t* packet=0); |
JojoS | 0:ab00d9bcd00d | 868 | uint8_t dmpGetTemperature(int32_t *data, const uint8_t* packet=0); |
JojoS | 0:ab00d9bcd00d | 869 | uint8_t dmpGetGravity(int32_t *data, const uint8_t* packet=0); |
JojoS | 0:ab00d9bcd00d | 870 | uint8_t dmpGetGravity(int16_t *data, const uint8_t* packet=0); |
JojoS | 0:ab00d9bcd00d | 871 | uint8_t dmpGetGravity(VectorInt16 *v, const uint8_t* packet=0); |
JojoS | 0:ab00d9bcd00d | 872 | uint8_t dmpGetGravity(VectorFloat *v, Quaternion *q); |
JojoS | 0:ab00d9bcd00d | 873 | uint8_t dmpGetUnquantizedAccel(int32_t *data, const uint8_t* packet=0); |
JojoS | 0:ab00d9bcd00d | 874 | uint8_t dmpGetUnquantizedAccel(int16_t *data, const uint8_t* packet=0); |
JojoS | 0:ab00d9bcd00d | 875 | uint8_t dmpGetUnquantizedAccel(VectorInt16 *v, const uint8_t* packet=0); |
JojoS | 0:ab00d9bcd00d | 876 | uint8_t dmpGetQuantizedAccel(int32_t *data, const uint8_t* packet=0); |
JojoS | 0:ab00d9bcd00d | 877 | uint8_t dmpGetQuantizedAccel(int16_t *data, const uint8_t* packet=0); |
JojoS | 0:ab00d9bcd00d | 878 | uint8_t dmpGetQuantizedAccel(VectorInt16 *v, const uint8_t* packet=0); |
JojoS | 0:ab00d9bcd00d | 879 | uint8_t dmpGetExternalSensorData(int32_t *data, uint16_t size, const uint8_t* packet=0); |
JojoS | 0:ab00d9bcd00d | 880 | uint8_t dmpGetEIS(int32_t *data, const uint8_t* packet=0); |
JojoS | 0:ab00d9bcd00d | 881 | |
JojoS | 0:ab00d9bcd00d | 882 | uint8_t dmpGetEuler(float *data, Quaternion *q); |
JojoS | 0:ab00d9bcd00d | 883 | uint8_t dmpGetYawPitchRoll(float *data, Quaternion *q, VectorFloat *gravity); |
JojoS | 0:ab00d9bcd00d | 884 | |
JojoS | 0:ab00d9bcd00d | 885 | // Get Floating Point data from FIFO |
JojoS | 0:ab00d9bcd00d | 886 | uint8_t dmpGetAccelFloat(float *data, const uint8_t* packet=0); |
JojoS | 0:ab00d9bcd00d | 887 | uint8_t dmpGetQuaternionFloat(float *data, const uint8_t* packet=0); |
JojoS | 0:ab00d9bcd00d | 888 | |
JojoS | 0:ab00d9bcd00d | 889 | uint8_t dmpProcessFIFOPacket(const unsigned char *dmpData); |
JojoS | 0:ab00d9bcd00d | 890 | uint8_t dmpReadAndProcessFIFOPacket(uint8_t numPackets, uint8_t *processed=NULL); |
JojoS | 0:ab00d9bcd00d | 891 | |
JojoS | 0:ab00d9bcd00d | 892 | uint8_t dmpSetFIFOProcessedCallback(void (*func) (void)); |
JojoS | 0:ab00d9bcd00d | 893 | |
JojoS | 0:ab00d9bcd00d | 894 | uint8_t dmpInitFIFOParam(); |
JojoS | 0:ab00d9bcd00d | 895 | uint8_t dmpCloseFIFO(); |
JojoS | 0:ab00d9bcd00d | 896 | uint8_t dmpSetGyroDataSource(uint8_t source); |
JojoS | 0:ab00d9bcd00d | 897 | uint8_t dmpDecodeQuantizedAccel(); |
JojoS | 0:ab00d9bcd00d | 898 | uint32_t dmpGetGyroSumOfSquare(); |
JojoS | 0:ab00d9bcd00d | 899 | uint32_t dmpGetAccelSumOfSquare(); |
JojoS | 0:ab00d9bcd00d | 900 | void dmpOverrideQuaternion(long *q); |
JojoS | 0:ab00d9bcd00d | 901 | uint16_t dmpGetFIFOPacketSize(); |
JojoS | 0:ab00d9bcd00d | 902 | #endif |
JojoS | 0:ab00d9bcd00d | 903 | |
JojoS | 0:ab00d9bcd00d | 904 | // special methods for MotionApps 4.1 implementation |
JojoS | 0:ab00d9bcd00d | 905 | #ifdef MPU9150_INCLUDE_DMP_MOTIONAPPS41 |
JojoS | 0:ab00d9bcd00d | 906 | uint8_t *dmpPacketBuffer; |
JojoS | 0:ab00d9bcd00d | 907 | uint16_t dmpPacketSize; |
JojoS | 0:ab00d9bcd00d | 908 | |
JojoS | 0:ab00d9bcd00d | 909 | uint8_t dmpInitialize(); |
JojoS | 0:ab00d9bcd00d | 910 | bool dmpPacketAvailable(); |
JojoS | 0:ab00d9bcd00d | 911 | |
JojoS | 0:ab00d9bcd00d | 912 | uint8_t dmpSetFIFORate(uint8_t fifoRate); |
JojoS | 0:ab00d9bcd00d | 913 | uint8_t dmpGetFIFORate(); |
JojoS | 0:ab00d9bcd00d | 914 | uint8_t dmpGetSampleStepSizeMS(); |
JojoS | 0:ab00d9bcd00d | 915 | uint8_t dmpGetSampleFrequency(); |
JojoS | 0:ab00d9bcd00d | 916 | int32_t dmpDecodeTemperature(int8_t tempReg); |
JojoS | 0:ab00d9bcd00d | 917 | |
JojoS | 0:ab00d9bcd00d | 918 | // Register callbacks after a packet of FIFO data is processed |
JojoS | 0:ab00d9bcd00d | 919 | //uint8_t dmpRegisterFIFORateProcess(inv_obj_func func, int16_t priority); |
JojoS | 0:ab00d9bcd00d | 920 | //uint8_t dmpUnregisterFIFORateProcess(inv_obj_func func); |
JojoS | 0:ab00d9bcd00d | 921 | uint8_t dmpRunFIFORateProcesses(); |
JojoS | 0:ab00d9bcd00d | 922 | |
JojoS | 0:ab00d9bcd00d | 923 | // Setup FIFO for various output |
JojoS | 0:ab00d9bcd00d | 924 | uint8_t dmpSendQuaternion(uint_fast16_t accuracy); |
JojoS | 0:ab00d9bcd00d | 925 | uint8_t dmpSendGyro(uint_fast16_t elements, uint_fast16_t accuracy); |
JojoS | 0:ab00d9bcd00d | 926 | uint8_t dmpSendAccel(uint_fast16_t elements, uint_fast16_t accuracy); |
JojoS | 0:ab00d9bcd00d | 927 | uint8_t dmpSendLinearAccel(uint_fast16_t elements, uint_fast16_t accuracy); |
JojoS | 0:ab00d9bcd00d | 928 | uint8_t dmpSendLinearAccelInWorld(uint_fast16_t elements, uint_fast16_t accuracy); |
JojoS | 0:ab00d9bcd00d | 929 | uint8_t dmpSendControlData(uint_fast16_t elements, uint_fast16_t accuracy); |
JojoS | 0:ab00d9bcd00d | 930 | uint8_t dmpSendSensorData(uint_fast16_t elements, uint_fast16_t accuracy); |
JojoS | 0:ab00d9bcd00d | 931 | uint8_t dmpSendExternalSensorData(uint_fast16_t elements, uint_fast16_t accuracy); |
JojoS | 0:ab00d9bcd00d | 932 | uint8_t dmpSendGravity(uint_fast16_t elements, uint_fast16_t accuracy); |
JojoS | 0:ab00d9bcd00d | 933 | uint8_t dmpSendPacketNumber(uint_fast16_t accuracy); |
JojoS | 0:ab00d9bcd00d | 934 | uint8_t dmpSendQuantizedAccel(uint_fast16_t elements, uint_fast16_t accuracy); |
JojoS | 0:ab00d9bcd00d | 935 | uint8_t dmpSendEIS(uint_fast16_t elements, uint_fast16_t accuracy); |
JojoS | 0:ab00d9bcd00d | 936 | |
JojoS | 0:ab00d9bcd00d | 937 | // Get Fixed Point data from FIFO |
JojoS | 0:ab00d9bcd00d | 938 | uint8_t dmpGetAccel(int32_t *data, const uint8_t* packet=0); |
JojoS | 0:ab00d9bcd00d | 939 | uint8_t dmpGetAccel(int16_t *data, const uint8_t* packet=0); |
JojoS | 0:ab00d9bcd00d | 940 | uint8_t dmpGetAccel(VectorInt16 *v, const uint8_t* packet=0); |
JojoS | 0:ab00d9bcd00d | 941 | uint8_t dmpGetQuaternion(int32_t *data, const uint8_t* packet=0); |
JojoS | 0:ab00d9bcd00d | 942 | uint8_t dmpGetQuaternion(int16_t *data, const uint8_t* packet=0); |
JojoS | 0:ab00d9bcd00d | 943 | uint8_t dmpGetQuaternion(Quaternion *q, const uint8_t* packet=0); |
JojoS | 0:ab00d9bcd00d | 944 | uint8_t dmpGet6AxisQuaternion(int32_t *data, const uint8_t* packet=0); |
JojoS | 0:ab00d9bcd00d | 945 | uint8_t dmpGet6AxisQuaternion(int16_t *data, const uint8_t* packet=0); |
JojoS | 0:ab00d9bcd00d | 946 | uint8_t dmpGet6AxisQuaternion(Quaternion *q, const uint8_t* packet=0); |
JojoS | 0:ab00d9bcd00d | 947 | uint8_t dmpGetRelativeQuaternion(int32_t *data, const uint8_t* packet=0); |
JojoS | 0:ab00d9bcd00d | 948 | uint8_t dmpGetRelativeQuaternion(int16_t *data, const uint8_t* packet=0); |
JojoS | 0:ab00d9bcd00d | 949 | uint8_t dmpGetRelativeQuaternion(Quaternion *data, const uint8_t* packet=0); |
JojoS | 0:ab00d9bcd00d | 950 | uint8_t dmpGetGyro(int32_t *data, const uint8_t* packet=0); |
JojoS | 0:ab00d9bcd00d | 951 | uint8_t dmpGetGyro(int16_t *data, const uint8_t* packet=0); |
JojoS | 0:ab00d9bcd00d | 952 | uint8_t dmpGetGyro(VectorInt16 *v, const uint8_t* packet=0); |
JojoS | 0:ab00d9bcd00d | 953 | uint8_t dmpGetMag(int16_t *data, const uint8_t* packet=0); |
JojoS | 0:ab00d9bcd00d | 954 | uint8_t dmpSetLinearAccelFilterCoefficient(float coef); |
JojoS | 0:ab00d9bcd00d | 955 | uint8_t dmpGetLinearAccel(int32_t *data, const uint8_t* packet=0); |
JojoS | 0:ab00d9bcd00d | 956 | uint8_t dmpGetLinearAccel(int16_t *data, const uint8_t* packet=0); |
JojoS | 0:ab00d9bcd00d | 957 | uint8_t dmpGetLinearAccel(VectorInt16 *v, const uint8_t* packet=0); |
JojoS | 0:ab00d9bcd00d | 958 | uint8_t dmpGetLinearAccel(VectorInt16 *v, VectorInt16 *vRaw, VectorFloat *gravity); |
JojoS | 0:ab00d9bcd00d | 959 | uint8_t dmpGetLinearAccelInWorld(int32_t *data, const uint8_t* packet=0); |
JojoS | 0:ab00d9bcd00d | 960 | uint8_t dmpGetLinearAccelInWorld(int16_t *data, const uint8_t* packet=0); |
JojoS | 0:ab00d9bcd00d | 961 | uint8_t dmpGetLinearAccelInWorld(VectorInt16 *v, const uint8_t* packet=0); |
JojoS | 0:ab00d9bcd00d | 962 | uint8_t dmpGetLinearAccelInWorld(VectorInt16 *v, VectorInt16 *vReal, Quaternion *q); |
JojoS | 0:ab00d9bcd00d | 963 | uint8_t dmpGetGyroAndAccelSensor(int32_t *data, const uint8_t* packet=0); |
JojoS | 0:ab00d9bcd00d | 964 | uint8_t dmpGetGyroAndAccelSensor(int16_t *data, const uint8_t* packet=0); |
JojoS | 0:ab00d9bcd00d | 965 | uint8_t dmpGetGyroAndAccelSensor(VectorInt16 *g, VectorInt16 *a, const uint8_t* packet=0); |
JojoS | 0:ab00d9bcd00d | 966 | uint8_t dmpGetGyroSensor(int32_t *data, const uint8_t* packet=0); |
JojoS | 0:ab00d9bcd00d | 967 | uint8_t dmpGetGyroSensor(int16_t *data, const uint8_t* packet=0); |
JojoS | 0:ab00d9bcd00d | 968 | uint8_t dmpGetGyroSensor(VectorInt16 *v, const uint8_t* packet=0); |
JojoS | 0:ab00d9bcd00d | 969 | uint8_t dmpGetControlData(int32_t *data, const uint8_t* packet=0); |
JojoS | 0:ab00d9bcd00d | 970 | uint8_t dmpGetTemperature(int32_t *data, const uint8_t* packet=0); |
JojoS | 0:ab00d9bcd00d | 971 | uint8_t dmpGetGravity(int32_t *data, const uint8_t* packet=0); |
JojoS | 0:ab00d9bcd00d | 972 | uint8_t dmpGetGravity(int16_t *data, const uint8_t* packet=0); |
JojoS | 0:ab00d9bcd00d | 973 | uint8_t dmpGetGravity(VectorInt16 *v, const uint8_t* packet=0); |
JojoS | 0:ab00d9bcd00d | 974 | uint8_t dmpGetGravity(VectorFloat *v, Quaternion *q); |
JojoS | 0:ab00d9bcd00d | 975 | uint8_t dmpGetUnquantizedAccel(int32_t *data, const uint8_t* packet=0); |
JojoS | 0:ab00d9bcd00d | 976 | uint8_t dmpGetUnquantizedAccel(int16_t *data, const uint8_t* packet=0); |
JojoS | 0:ab00d9bcd00d | 977 | uint8_t dmpGetUnquantizedAccel(VectorInt16 *v, const uint8_t* packet=0); |
JojoS | 0:ab00d9bcd00d | 978 | uint8_t dmpGetQuantizedAccel(int32_t *data, const uint8_t* packet=0); |
JojoS | 0:ab00d9bcd00d | 979 | uint8_t dmpGetQuantizedAccel(int16_t *data, const uint8_t* packet=0); |
JojoS | 0:ab00d9bcd00d | 980 | uint8_t dmpGetQuantizedAccel(VectorInt16 *v, const uint8_t* packet=0); |
JojoS | 0:ab00d9bcd00d | 981 | uint8_t dmpGetExternalSensorData(int32_t *data, uint16_t size, const uint8_t* packet=0); |
JojoS | 0:ab00d9bcd00d | 982 | uint8_t dmpGetEIS(int32_t *data, const uint8_t* packet=0); |
JojoS | 0:ab00d9bcd00d | 983 | |
JojoS | 0:ab00d9bcd00d | 984 | uint8_t dmpGetEuler(float *data, Quaternion *q); |
JojoS | 0:ab00d9bcd00d | 985 | uint8_t dmpGetYawPitchRoll(float *data, Quaternion *q, VectorFloat *gravity); |
JojoS | 0:ab00d9bcd00d | 986 | |
JojoS | 0:ab00d9bcd00d | 987 | // Get Floating Point data from FIFO |
JojoS | 0:ab00d9bcd00d | 988 | uint8_t dmpGetAccelFloat(float *data, const uint8_t* packet=0); |
JojoS | 0:ab00d9bcd00d | 989 | uint8_t dmpGetQuaternionFloat(float *data, const uint8_t* packet=0); |
JojoS | 0:ab00d9bcd00d | 990 | |
JojoS | 0:ab00d9bcd00d | 991 | uint8_t dmpProcessFIFOPacket(const unsigned char *dmpData); |
JojoS | 0:ab00d9bcd00d | 992 | uint8_t dmpReadAndProcessFIFOPacket(uint8_t numPackets, uint8_t *processed=NULL); |
JojoS | 0:ab00d9bcd00d | 993 | |
JojoS | 0:ab00d9bcd00d | 994 | uint8_t dmpSetFIFOProcessedCallback(void (*func) (void)); |
JojoS | 0:ab00d9bcd00d | 995 | |
JojoS | 0:ab00d9bcd00d | 996 | uint8_t dmpInitFIFOParam(); |
JojoS | 0:ab00d9bcd00d | 997 | uint8_t dmpCloseFIFO(); |
JojoS | 0:ab00d9bcd00d | 998 | uint8_t dmpSetGyroDataSource(uint8_t source); |
JojoS | 0:ab00d9bcd00d | 999 | uint8_t dmpDecodeQuantizedAccel(); |
JojoS | 0:ab00d9bcd00d | 1000 | uint32_t dmpGetGyroSumOfSquare(); |
JojoS | 0:ab00d9bcd00d | 1001 | uint32_t dmpGetAccelSumOfSquare(); |
JojoS | 0:ab00d9bcd00d | 1002 | void dmpOverrideQuaternion(long *q); |
JojoS | 0:ab00d9bcd00d | 1003 | uint16_t dmpGetFIFOPacketSize(); |
JojoS | 0:ab00d9bcd00d | 1004 | #endif |
JojoS | 0:ab00d9bcd00d | 1005 | |
JojoS | 0:ab00d9bcd00d | 1006 | private: |
JojoS | 0:ab00d9bcd00d | 1007 | uint8_t devAddr; |
JojoS | 0:ab00d9bcd00d | 1008 | uint8_t buffer[14]; |
JojoS | 0:ab00d9bcd00d | 1009 | }; |
JojoS | 0:ab00d9bcd00d | 1010 | |
JojoS | 0:ab00d9bcd00d | 1011 | #endif /* _MPU9150_H_ */ |