Gyroscope and accelerometer sensor based on Korneliusz Jarzebski's lib
Dependents: weather_station_proj weather_station_project weather_station_proj_v1_2
MPU6050.h@0:aef0335c060b, 2018-07-01 (annotated)
- Committer:
- daniel_davvid
- Date:
- Sun Jul 01 11:58:49 2018 +0000
- Revision:
- 0:aef0335c060b
Updated so it can work in a weather station project using only the accelerometer
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
daniel_davvid | 0:aef0335c060b | 1 | /* |
daniel_davvid | 0:aef0335c060b | 2 | MPU6050.h - Header file for the MPU6050 Triple Axis Gyroscope & Accelerometer Arduino Library. |
daniel_davvid | 0:aef0335c060b | 3 | Version: 1.0.3 |
daniel_davvid | 0:aef0335c060b | 4 | (c) 2014-2015 Korneliusz Jarzebski |
daniel_davvid | 0:aef0335c060b | 5 | www.jarzebski.pl |
daniel_davvid | 0:aef0335c060b | 6 | This program is free software: you can redistribute it and/or modify |
daniel_davvid | 0:aef0335c060b | 7 | it under the terms of the version 3 GNU General Public License as |
daniel_davvid | 0:aef0335c060b | 8 | published by the Free Software Foundation. |
daniel_davvid | 0:aef0335c060b | 9 | This program is distributed in the hope that it will be useful, |
daniel_davvid | 0:aef0335c060b | 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
daniel_davvid | 0:aef0335c060b | 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
daniel_davvid | 0:aef0335c060b | 12 | GNU General Public License for more details. |
daniel_davvid | 0:aef0335c060b | 13 | You should have received a copy of the GNU General Public License |
daniel_davvid | 0:aef0335c060b | 14 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
daniel_davvid | 0:aef0335c060b | 15 | */ |
daniel_davvid | 0:aef0335c060b | 16 | |
daniel_davvid | 0:aef0335c060b | 17 | #ifndef MPU6050_h |
daniel_davvid | 0:aef0335c060b | 18 | #define MPU6050_h |
daniel_davvid | 0:aef0335c060b | 19 | |
daniel_davvid | 0:aef0335c060b | 20 | #include <mbed.h> |
daniel_davvid | 0:aef0335c060b | 21 | |
daniel_davvid | 0:aef0335c060b | 22 | // Using the GY-521 breakout board, I set ADO to 0 by grounding through a 4k7 resistor |
daniel_davvid | 0:aef0335c060b | 23 | // Seven-bit device address is 110100 for ADO = 0 and 110101 for ADO = 1 |
daniel_davvid | 0:aef0335c060b | 24 | #define ADO 0 |
daniel_davvid | 0:aef0335c060b | 25 | #if ADO |
daniel_davvid | 0:aef0335c060b | 26 | #define MPU6050_ADDRESS 0x69<<1 // Device address when ADO = 1 |
daniel_davvid | 0:aef0335c060b | 27 | #else |
daniel_davvid | 0:aef0335c060b | 28 | #define MPU6050_ADDRESS 0x68<<1 // Device address when ADO = 0 |
daniel_davvid | 0:aef0335c060b | 29 | #endif |
daniel_davvid | 0:aef0335c060b | 30 | |
daniel_davvid | 0:aef0335c060b | 31 | #define MPU6050_REG_ACCEL_XOFFS_H (0x06) |
daniel_davvid | 0:aef0335c060b | 32 | #define MPU6050_REG_ACCEL_XOFFS_L (0x07) |
daniel_davvid | 0:aef0335c060b | 33 | #define MPU6050_REG_ACCEL_YOFFS_H (0x08) |
daniel_davvid | 0:aef0335c060b | 34 | #define MPU6050_REG_ACCEL_YOFFS_L (0x09) |
daniel_davvid | 0:aef0335c060b | 35 | #define MPU6050_REG_ACCEL_ZOFFS_H (0x0A) |
daniel_davvid | 0:aef0335c060b | 36 | #define MPU6050_REG_ACCEL_ZOFFS_L (0x0B) |
daniel_davvid | 0:aef0335c060b | 37 | #define MPU6050_REG_GYRO_XOFFS_H (0x13) |
daniel_davvid | 0:aef0335c060b | 38 | #define MPU6050_REG_GYRO_XOFFS_L (0x14) |
daniel_davvid | 0:aef0335c060b | 39 | #define MPU6050_REG_GYRO_YOFFS_H (0x15) |
daniel_davvid | 0:aef0335c060b | 40 | #define MPU6050_REG_GYRO_YOFFS_L (0x16) |
daniel_davvid | 0:aef0335c060b | 41 | #define MPU6050_REG_GYRO_ZOFFS_H (0x17) |
daniel_davvid | 0:aef0335c060b | 42 | #define MPU6050_REG_GYRO_ZOFFS_L (0x18) |
daniel_davvid | 0:aef0335c060b | 43 | #define MPU6050_REG_CONFIG (0x1A) |
daniel_davvid | 0:aef0335c060b | 44 | #define MPU6050_REG_GYRO_CONFIG (0x1B) // Gyroscope Configuration |
daniel_davvid | 0:aef0335c060b | 45 | #define MPU6050_REG_ACCEL_CONFIG (0x1C) // Accelerometer Configuration |
daniel_davvid | 0:aef0335c060b | 46 | #define MPU6050_REG_FF_THRESHOLD (0x1D) |
daniel_davvid | 0:aef0335c060b | 47 | #define MPU6050_REG_FF_DURATION (0x1E) |
daniel_davvid | 0:aef0335c060b | 48 | #define MPU6050_REG_MOT_THRESHOLD (0x1F) |
daniel_davvid | 0:aef0335c060b | 49 | #define MPU6050_REG_MOT_DURATION (0x20) |
daniel_davvid | 0:aef0335c060b | 50 | #define MPU6050_REG_ZMOT_THRESHOLD (0x21) |
daniel_davvid | 0:aef0335c060b | 51 | #define MPU6050_REG_ZMOT_DURATION (0x22) |
daniel_davvid | 0:aef0335c060b | 52 | #define MPU6050_REG_INT_PIN_CFG (0x37) // INT Pin. Bypass Enable Configuration |
daniel_davvid | 0:aef0335c060b | 53 | #define MPU6050_REG_INT_ENABLE (0x38) // INT Enable |
daniel_davvid | 0:aef0335c060b | 54 | #define MPU6050_REG_INT_STATUS (0x3A) |
daniel_davvid | 0:aef0335c060b | 55 | #define MPU6050_REG_ACCEL_XOUT_H (0x3B) |
daniel_davvid | 0:aef0335c060b | 56 | #define MPU6050_REG_ACCEL_XOUT_L (0x3C) |
daniel_davvid | 0:aef0335c060b | 57 | #define MPU6050_REG_ACCEL_YOUT_H (0x3D) |
daniel_davvid | 0:aef0335c060b | 58 | #define MPU6050_REG_ACCEL_YOUT_L (0x3E) |
daniel_davvid | 0:aef0335c060b | 59 | #define MPU6050_REG_ACCEL_ZOUT_H (0x3F) |
daniel_davvid | 0:aef0335c060b | 60 | #define MPU6050_REG_ACCEL_ZOUT_L (0x40) |
daniel_davvid | 0:aef0335c060b | 61 | #define MPU6050_REG_TEMP_OUT_H (0x41) |
daniel_davvid | 0:aef0335c060b | 62 | #define MPU6050_REG_TEMP_OUT_L (0x42) |
daniel_davvid | 0:aef0335c060b | 63 | #define MPU6050_REG_GYRO_XOUT_H (0x43) |
daniel_davvid | 0:aef0335c060b | 64 | #define MPU6050_REG_GYRO_XOUT_L (0x44) |
daniel_davvid | 0:aef0335c060b | 65 | #define MPU6050_REG_GYRO_YOUT_H (0x45) |
daniel_davvid | 0:aef0335c060b | 66 | #define MPU6050_REG_GYRO_YOUT_L (0x46) |
daniel_davvid | 0:aef0335c060b | 67 | #define MPU6050_REG_GYRO_ZOUT_H (0x47) |
daniel_davvid | 0:aef0335c060b | 68 | #define MPU6050_REG_GYRO_ZOUT_L (0x48) |
daniel_davvid | 0:aef0335c060b | 69 | #define MPU6050_REG_MOT_DETECT_STATUS (0x61) |
daniel_davvid | 0:aef0335c060b | 70 | #define MPU6050_REG_MOT_DETECT_CTRL (0x69) |
daniel_davvid | 0:aef0335c060b | 71 | #define MPU6050_REG_USER_CTRL (0x6A) // User Control |
daniel_davvid | 0:aef0335c060b | 72 | #define MPU6050_REG_PWR_MGMT_1 (0x6B) // Power Management 1 |
daniel_davvid | 0:aef0335c060b | 73 | #define MPU6050_REG_WHO_AM_I (0x75) // Who Am I |
daniel_davvid | 0:aef0335c060b | 74 | |
daniel_davvid | 0:aef0335c060b | 75 | #ifndef VECTOR_STRUCT_H |
daniel_davvid | 0:aef0335c060b | 76 | #define VECTOR_STRUCT_H |
daniel_davvid | 0:aef0335c060b | 77 | struct Vector |
daniel_davvid | 0:aef0335c060b | 78 | { |
daniel_davvid | 0:aef0335c060b | 79 | float XAxis; |
daniel_davvid | 0:aef0335c060b | 80 | float YAxis; |
daniel_davvid | 0:aef0335c060b | 81 | float ZAxis; |
daniel_davvid | 0:aef0335c060b | 82 | }; |
daniel_davvid | 0:aef0335c060b | 83 | #endif |
daniel_davvid | 0:aef0335c060b | 84 | |
daniel_davvid | 0:aef0335c060b | 85 | struct Activites |
daniel_davvid | 0:aef0335c060b | 86 | { |
daniel_davvid | 0:aef0335c060b | 87 | bool isOverflow; |
daniel_davvid | 0:aef0335c060b | 88 | bool isFreeFall; |
daniel_davvid | 0:aef0335c060b | 89 | bool isInactivity; |
daniel_davvid | 0:aef0335c060b | 90 | bool isActivity; |
daniel_davvid | 0:aef0335c060b | 91 | bool isPosActivityOnX; |
daniel_davvid | 0:aef0335c060b | 92 | bool isPosActivityOnY; |
daniel_davvid | 0:aef0335c060b | 93 | bool isPosActivityOnZ; |
daniel_davvid | 0:aef0335c060b | 94 | bool isNegActivityOnX; |
daniel_davvid | 0:aef0335c060b | 95 | bool isNegActivityOnY; |
daniel_davvid | 0:aef0335c060b | 96 | bool isNegActivityOnZ; |
daniel_davvid | 0:aef0335c060b | 97 | bool isDataReady; |
daniel_davvid | 0:aef0335c060b | 98 | }; |
daniel_davvid | 0:aef0335c060b | 99 | |
daniel_davvid | 0:aef0335c060b | 100 | typedef enum |
daniel_davvid | 0:aef0335c060b | 101 | { |
daniel_davvid | 0:aef0335c060b | 102 | MPU6050_CLOCK_KEEP_RESET = 0b111, |
daniel_davvid | 0:aef0335c060b | 103 | MPU6050_CLOCK_EXTERNAL_19MHZ = 0b101, |
daniel_davvid | 0:aef0335c060b | 104 | MPU6050_CLOCK_EXTERNAL_32KHZ = 0b100, |
daniel_davvid | 0:aef0335c060b | 105 | MPU6050_CLOCK_PLL_ZGYRO = 0b011, |
daniel_davvid | 0:aef0335c060b | 106 | MPU6050_CLOCK_PLL_YGYRO = 0b010, |
daniel_davvid | 0:aef0335c060b | 107 | MPU6050_CLOCK_PLL_XGYRO = 0b001, |
daniel_davvid | 0:aef0335c060b | 108 | MPU6050_CLOCK_INTERNAL_8MHZ = 0b000 |
daniel_davvid | 0:aef0335c060b | 109 | } mpu6050_clockSource_t; |
daniel_davvid | 0:aef0335c060b | 110 | |
daniel_davvid | 0:aef0335c060b | 111 | typedef enum |
daniel_davvid | 0:aef0335c060b | 112 | { |
daniel_davvid | 0:aef0335c060b | 113 | MPU6050_SCALE_2000DPS = 0b11, |
daniel_davvid | 0:aef0335c060b | 114 | MPU6050_SCALE_1000DPS = 0b10, |
daniel_davvid | 0:aef0335c060b | 115 | MPU6050_SCALE_500DPS = 0b01, |
daniel_davvid | 0:aef0335c060b | 116 | MPU6050_SCALE_250DPS = 0b00 |
daniel_davvid | 0:aef0335c060b | 117 | } mpu6050_dps_t; |
daniel_davvid | 0:aef0335c060b | 118 | |
daniel_davvid | 0:aef0335c060b | 119 | typedef enum |
daniel_davvid | 0:aef0335c060b | 120 | { |
daniel_davvid | 0:aef0335c060b | 121 | MPU6050_RANGE_16G = 0b11, |
daniel_davvid | 0:aef0335c060b | 122 | MPU6050_RANGE_8G = 0b10, |
daniel_davvid | 0:aef0335c060b | 123 | MPU6050_RANGE_4G = 0b01, |
daniel_davvid | 0:aef0335c060b | 124 | MPU6050_RANGE_2G = 0b00, |
daniel_davvid | 0:aef0335c060b | 125 | } mpu6050_range_t; |
daniel_davvid | 0:aef0335c060b | 126 | |
daniel_davvid | 0:aef0335c060b | 127 | typedef enum |
daniel_davvid | 0:aef0335c060b | 128 | { |
daniel_davvid | 0:aef0335c060b | 129 | MPU6050_DELAY_3MS = 0b11, |
daniel_davvid | 0:aef0335c060b | 130 | MPU6050_DELAY_2MS = 0b10, |
daniel_davvid | 0:aef0335c060b | 131 | MPU6050_DELAY_1MS = 0b01, |
daniel_davvid | 0:aef0335c060b | 132 | MPU6050_NO_DELAY = 0b00, |
daniel_davvid | 0:aef0335c060b | 133 | } mpu6050_onDelay_t; |
daniel_davvid | 0:aef0335c060b | 134 | |
daniel_davvid | 0:aef0335c060b | 135 | typedef enum |
daniel_davvid | 0:aef0335c060b | 136 | { |
daniel_davvid | 0:aef0335c060b | 137 | MPU6050_DHPF_HOLD = 0b111, |
daniel_davvid | 0:aef0335c060b | 138 | MPU6050_DHPF_0_63HZ = 0b100, |
daniel_davvid | 0:aef0335c060b | 139 | MPU6050_DHPF_1_25HZ = 0b011, |
daniel_davvid | 0:aef0335c060b | 140 | MPU6050_DHPF_2_5HZ = 0b010, |
daniel_davvid | 0:aef0335c060b | 141 | MPU6050_DHPF_5HZ = 0b001, |
daniel_davvid | 0:aef0335c060b | 142 | MPU6050_DHPF_RESET = 0b000, |
daniel_davvid | 0:aef0335c060b | 143 | } mpu6050_dhpf_t; |
daniel_davvid | 0:aef0335c060b | 144 | |
daniel_davvid | 0:aef0335c060b | 145 | typedef enum |
daniel_davvid | 0:aef0335c060b | 146 | { |
daniel_davvid | 0:aef0335c060b | 147 | MPU6050_DLPF_6 = 0b110, |
daniel_davvid | 0:aef0335c060b | 148 | MPU6050_DLPF_5 = 0b101, |
daniel_davvid | 0:aef0335c060b | 149 | MPU6050_DLPF_4 = 0b100, |
daniel_davvid | 0:aef0335c060b | 150 | MPU6050_DLPF_3 = 0b011, |
daniel_davvid | 0:aef0335c060b | 151 | MPU6050_DLPF_2 = 0b010, |
daniel_davvid | 0:aef0335c060b | 152 | MPU6050_DLPF_1 = 0b001, |
daniel_davvid | 0:aef0335c060b | 153 | MPU6050_DLPF_0 = 0b000, |
daniel_davvid | 0:aef0335c060b | 154 | } mpu6050_dlpf_t; |
daniel_davvid | 0:aef0335c060b | 155 | |
daniel_davvid | 0:aef0335c060b | 156 | class MPU6050 |
daniel_davvid | 0:aef0335c060b | 157 | { |
daniel_davvid | 0:aef0335c060b | 158 | public: |
daniel_davvid | 0:aef0335c060b | 159 | MPU6050(PinName sda, PinName scl); |
daniel_davvid | 0:aef0335c060b | 160 | MPU6050(I2C &i2c); |
daniel_davvid | 0:aef0335c060b | 161 | |
daniel_davvid | 0:aef0335c060b | 162 | bool begin(mpu6050_dps_t scale = MPU6050_SCALE_2000DPS, mpu6050_range_t range = MPU6050_RANGE_2G, int mpua = MPU6050_ADDRESS); |
daniel_davvid | 0:aef0335c060b | 163 | |
daniel_davvid | 0:aef0335c060b | 164 | void setClockSource(mpu6050_clockSource_t source); |
daniel_davvid | 0:aef0335c060b | 165 | void setScale(mpu6050_dps_t scale); |
daniel_davvid | 0:aef0335c060b | 166 | void setRange(mpu6050_range_t range); |
daniel_davvid | 0:aef0335c060b | 167 | mpu6050_clockSource_t getClockSource(void); |
daniel_davvid | 0:aef0335c060b | 168 | mpu6050_dps_t getScale(void); |
daniel_davvid | 0:aef0335c060b | 169 | mpu6050_range_t getRange(void); |
daniel_davvid | 0:aef0335c060b | 170 | void setDHPFMode(mpu6050_dhpf_t dhpf); |
daniel_davvid | 0:aef0335c060b | 171 | void setDLPFMode(mpu6050_dlpf_t dlpf); |
daniel_davvid | 0:aef0335c060b | 172 | mpu6050_onDelay_t getAccelPowerOnDelay(); |
daniel_davvid | 0:aef0335c060b | 173 | void setAccelPowerOnDelay(mpu6050_onDelay_t delay); |
daniel_davvid | 0:aef0335c060b | 174 | |
daniel_davvid | 0:aef0335c060b | 175 | uint8_t getIntStatus(void); |
daniel_davvid | 0:aef0335c060b | 176 | |
daniel_davvid | 0:aef0335c060b | 177 | bool getIntZeroMotionEnabled(void); |
daniel_davvid | 0:aef0335c060b | 178 | void setIntZeroMotionEnabled(bool state); |
daniel_davvid | 0:aef0335c060b | 179 | bool getIntMotionEnabled(void); |
daniel_davvid | 0:aef0335c060b | 180 | void setIntMotionEnabled(bool state); |
daniel_davvid | 0:aef0335c060b | 181 | bool getIntFreeFallEnabled(void); |
daniel_davvid | 0:aef0335c060b | 182 | void setIntFreeFallEnabled(bool state); |
daniel_davvid | 0:aef0335c060b | 183 | |
daniel_davvid | 0:aef0335c060b | 184 | uint8_t getMotionDetectionThreshold(void); |
daniel_davvid | 0:aef0335c060b | 185 | void setMotionDetectionThreshold(uint8_t threshold); |
daniel_davvid | 0:aef0335c060b | 186 | uint8_t getMotionDetectionDuration(void); |
daniel_davvid | 0:aef0335c060b | 187 | void setMotionDetectionDuration(uint8_t duration); |
daniel_davvid | 0:aef0335c060b | 188 | |
daniel_davvid | 0:aef0335c060b | 189 | uint8_t getZeroMotionDetectionThreshold(void); |
daniel_davvid | 0:aef0335c060b | 190 | void setZeroMotionDetectionThreshold(uint8_t threshold); |
daniel_davvid | 0:aef0335c060b | 191 | uint8_t getZeroMotionDetectionDuration(void); |
daniel_davvid | 0:aef0335c060b | 192 | void setZeroMotionDetectionDuration(uint8_t duration); |
daniel_davvid | 0:aef0335c060b | 193 | |
daniel_davvid | 0:aef0335c060b | 194 | uint8_t getFreeFallDetectionThreshold(void); |
daniel_davvid | 0:aef0335c060b | 195 | void setFreeFallDetectionThreshold(uint8_t threshold); |
daniel_davvid | 0:aef0335c060b | 196 | uint8_t getFreeFallDetectionDuration(void); |
daniel_davvid | 0:aef0335c060b | 197 | void setFreeFallDetectionDuration(uint8_t duration); |
daniel_davvid | 0:aef0335c060b | 198 | |
daniel_davvid | 0:aef0335c060b | 199 | bool getSleepEnabled(void); |
daniel_davvid | 0:aef0335c060b | 200 | void setSleepEnabled(bool state); |
daniel_davvid | 0:aef0335c060b | 201 | bool getI2CMasterModeEnabled(void); |
daniel_davvid | 0:aef0335c060b | 202 | void setI2CMasterModeEnabled(bool state); |
daniel_davvid | 0:aef0335c060b | 203 | bool getI2CBypassEnabled(void); |
daniel_davvid | 0:aef0335c060b | 204 | void setI2CBypassEnabled(bool state); |
daniel_davvid | 0:aef0335c060b | 205 | |
daniel_davvid | 0:aef0335c060b | 206 | float readTemperature(void); |
daniel_davvid | 0:aef0335c060b | 207 | Activites readActivites(void); |
daniel_davvid | 0:aef0335c060b | 208 | |
daniel_davvid | 0:aef0335c060b | 209 | int16_t getGyroOffsetX(void); |
daniel_davvid | 0:aef0335c060b | 210 | void setGyroOffsetX(int16_t offset); |
daniel_davvid | 0:aef0335c060b | 211 | int16_t getGyroOffsetY(void); |
daniel_davvid | 0:aef0335c060b | 212 | void setGyroOffsetY(int16_t offset); |
daniel_davvid | 0:aef0335c060b | 213 | int16_t getGyroOffsetZ(void); |
daniel_davvid | 0:aef0335c060b | 214 | void setGyroOffsetZ(int16_t offset); |
daniel_davvid | 0:aef0335c060b | 215 | |
daniel_davvid | 0:aef0335c060b | 216 | int16_t getAccelOffsetX(void); |
daniel_davvid | 0:aef0335c060b | 217 | void setAccelOffsetX(int16_t offset); |
daniel_davvid | 0:aef0335c060b | 218 | int16_t getAccelOffsetY(void); |
daniel_davvid | 0:aef0335c060b | 219 | void setAccelOffsetY(int16_t offset); |
daniel_davvid | 0:aef0335c060b | 220 | int16_t getAccelOffsetZ(void); |
daniel_davvid | 0:aef0335c060b | 221 | void setAccelOffsetZ(int16_t offset); |
daniel_davvid | 0:aef0335c060b | 222 | |
daniel_davvid | 0:aef0335c060b | 223 | void calibrateGyro(uint8_t samples = 50); |
daniel_davvid | 0:aef0335c060b | 224 | void setThreshold(uint8_t multiple = 1); |
daniel_davvid | 0:aef0335c060b | 225 | uint8_t getThreshold(void); |
daniel_davvid | 0:aef0335c060b | 226 | |
daniel_davvid | 0:aef0335c060b | 227 | Vector readRawGyro(void); |
daniel_davvid | 0:aef0335c060b | 228 | Vector readNormalizeGyro(void); |
daniel_davvid | 0:aef0335c060b | 229 | |
daniel_davvid | 0:aef0335c060b | 230 | Vector readRawAccel(void); |
daniel_davvid | 0:aef0335c060b | 231 | Vector readNormalizeAccel(void); |
daniel_davvid | 0:aef0335c060b | 232 | Vector readScaledAccel(void); |
daniel_davvid | 0:aef0335c060b | 233 | |
daniel_davvid | 0:aef0335c060b | 234 | private: |
daniel_davvid | 0:aef0335c060b | 235 | |
daniel_davvid | 0:aef0335c060b | 236 | I2C &i2c_; |
daniel_davvid | 0:aef0335c060b | 237 | char i2cRaw[sizeof(I2C)]; |
daniel_davvid | 0:aef0335c060b | 238 | |
daniel_davvid | 0:aef0335c060b | 239 | Vector ra, rg; // Raw vectors |
daniel_davvid | 0:aef0335c060b | 240 | Vector na, ng; // Normalized vectors |
daniel_davvid | 0:aef0335c060b | 241 | Vector tg, dg; // Threshold and Delta for Gyro |
daniel_davvid | 0:aef0335c060b | 242 | Vector th; // Threshold |
daniel_davvid | 0:aef0335c060b | 243 | Activites a; // Activities |
daniel_davvid | 0:aef0335c060b | 244 | |
daniel_davvid | 0:aef0335c060b | 245 | float dpsPerDigit, rangePerDigit; |
daniel_davvid | 0:aef0335c060b | 246 | float actualThreshold; |
daniel_davvid | 0:aef0335c060b | 247 | bool useCalibrate; |
daniel_davvid | 0:aef0335c060b | 248 | int mpuAddress; |
daniel_davvid | 0:aef0335c060b | 249 | |
daniel_davvid | 0:aef0335c060b | 250 | uint8_t fastRegister8(uint8_t reg, bool repeated=false); |
daniel_davvid | 0:aef0335c060b | 251 | uint8_t readRegister8(uint8_t reg, bool repeated=false); |
daniel_davvid | 0:aef0335c060b | 252 | void writeRegister8(uint8_t reg, uint8_t value, bool repeated=false); |
daniel_davvid | 0:aef0335c060b | 253 | |
daniel_davvid | 0:aef0335c060b | 254 | int16_t readRegister16(uint8_t reg, bool repeated=false); |
daniel_davvid | 0:aef0335c060b | 255 | void writeRegister16(uint8_t reg, int16_t value, bool repeated=false); |
daniel_davvid | 0:aef0335c060b | 256 | |
daniel_davvid | 0:aef0335c060b | 257 | bool readRegisterBit(uint8_t reg, uint8_t pos); |
daniel_davvid | 0:aef0335c060b | 258 | void writeRegisterBit(uint8_t reg, uint8_t pos, bool state); |
daniel_davvid | 0:aef0335c060b | 259 | |
daniel_davvid | 0:aef0335c060b | 260 | }; |
daniel_davvid | 0:aef0335c060b | 261 | |
daniel_davvid | 0:aef0335c060b | 262 | #endif |