upm  0.5.1
Sensor/Actuator repository for libmraa (v0.9.1)
 All Data Structures Files Functions Variables Enumerations Enumerator Macros Groups Pages
mpu60x0.h
1 /*
2  * Author: Jon Trulson <jtrulson@ics.com>
3  * Copyright (c) 2015 Intel Corporation.
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining
6  * a copy of this software and associated documentation files (the
7  * "Software"), to deal in the Software without restriction, including
8  * without limitation the rights to use, copy, modify, merge, publish,
9  * distribute, sublicense, and/or sell copies of the Software, and to
10  * permit persons to whom the Software is furnished to do so, subject to
11  * the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be
14  * included in all copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23  */
24 #pragma once
25 
26 #include <string>
27 #include <mraa/common.hpp>
28 #include <mraa/i2c.hpp>
29 
30 #include <mraa/gpio.hpp>
31 
32 #define MPU60X0_I2C_BUS 0
33 #define MPU60X0_DEFAULT_I2C_ADDR 0x68
34 
35 namespace upm {
36 
61  class MPU60X0 {
62  public:
63 
64  // NOTE: These enums were composed from both the mpu6050 and
65  // mpu9150 register maps, since this driver was written using an
66  // mpu9150, but we'd like this module to be usable with a
67  // standalone mpu60x0.
68  //
69  // Registers and bitfields marked with an '*' in their
70  // comment indicate registers or bit fields present in the mpu9150
71  // register map, but not in the original mpu6050 register map. If
72  // using this module on a standalone mpu6050, you should avoid
73  // using those registers or bitfields marked with an *.
74 
78  typedef enum {
79  REG_SELF_TEST_X = 0x0d,
80  REG_SELF_TEST_Y = 0x0e,
81  REG_SELF_TEST_Z = 0x0f,
82  REG_SELF_TEST_A = 0x10,
83 
84  REG_SMPLRT_DIV = 0x19, // sample rate divider
85 
86  REG_CONFIG = 0x1a,
87  REG_GYRO_CONFIG = 0x1b,
88  REG_ACCEL_CONFIG = 0x1c,
89 
90  REG_FF_THR = 0x1d, // *freefall threshold
91  REG_FF_DUR = 0x1e, // *freefall duration
92 
93  REG_MOT_THR = 0x1f, // motion threshold
94  REG_MOT_DUR = 0x20, // *motion duration
95 
96  REG_ZRMOT_THR = 0x21, // *zero motion threshhold
97  REG_ZRMOT_DUR = 0x22, // *zero motion duration
98 
99  REG_FIFO_EN = 0x23,
100 
101  REG_I2C_MST_CTRL = 0x24, // I2C master control
102 
103  REG_I2C_SLV0_ADDR = 0x25, // I2C slave 0
104  REG_I2C_SLV0_REG = 0x26,
105  REG_I2C_SLV0_CTRL = 0x27,
106 
107  REG_I2C_SLV1_ADDR = 0x28, // I2C slave 1
108  REG_I2C_SLV1_REG = 0x29,
109  REG_I2C_SLV1_CTRL = 0x2a,
110 
111  REG_I2C_SLV2_ADDR = 0x2b, // I2C slave 2
112  REG_I2C_SLV2_REG = 0x2c,
113  REG_I2C_SLV2_CTRL = 0x2d,
114 
115  REG_I2C_SLV3_ADDR = 0x2e, // I2C slave 3
116  REG_I2C_SLV3_REG = 0x2f,
117  REG_I2C_SLV3_CTRL = 0x30,
118 
119  REG_I2C_SLV4_ADDR = 0x31, // I2C slave 4
120  REG_I2C_SLV4_REG = 0x32,
121  REG_I2C_SLV4_DO = 0x33,
122  REG_I2C_SLV4_CTRL = 0x34,
123  REG_I2C_SLV4_DI = 0x35,
124 
125  REG_I2C_MST_STATUS = 0x36, // I2C master status
126 
127  REG_INT_PIN_CFG = 0x37, // interrupt pin config/i2c bypass
128  REG_INT_ENABLE = 0x38,
129 
130  // 0x39 reserved
131 
132  REG_INT_STATUS = 0x3a, // interrupt status
133 
134  REG_ACCEL_XOUT_H = 0x3b, // accelerometer outputs
135  REG_ACCEL_XOUT_L = 0x3c,
136 
137  REG_ACCEL_YOUT_H = 0x3d,
138  REG_ACCEL_YOUT_L = 0x3e,
139 
140  REG_ACCEL_ZOUT_H = 0x3f,
141  REG_ACCEL_ZOUT_L = 0x40,
142 
143  REG_TEMP_OUT_H = 0x41, // temperature output
144  REG_TEMP_OUT_L = 0x42,
145 
146  REG_GYRO_XOUT_H = 0x43, // gyro outputs
147  REG_GYRO_XOUT_L = 0x44,
148 
149  REG_GYRO_YOUT_H = 0x45,
150  REG_GYRO_YOUT_L = 0x46,
151 
152  REG_GYRO_ZOUT_H = 0x47,
153  REG_GYRO_ZOUT_L = 0x48,
154 
155  REG_EXT_SENS_DATA_00 = 0x49, // external sensor data
156  REG_EXT_SENS_DATA_01 = 0x4a,
157  REG_EXT_SENS_DATA_02 = 0x4b,
158  REG_EXT_SENS_DATA_03 = 0x4c,
159  REG_EXT_SENS_DATA_04 = 0x4d,
160  REG_EXT_SENS_DATA_05 = 0x4e,
161  REG_EXT_SENS_DATA_06 = 0x4f,
162  REG_EXT_SENS_DATA_07 = 0x50,
163  REG_EXT_SENS_DATA_08 = 0x51,
164  REG_EXT_SENS_DATA_09 = 0x52,
165  REG_EXT_SENS_DATA_10 = 0x53,
166  REG_EXT_SENS_DATA_11 = 0x54,
167  REG_EXT_SENS_DATA_12 = 0x55,
168  REG_EXT_SENS_DATA_13 = 0x56,
169  REG_EXT_SENS_DATA_14 = 0x57,
170  REG_EXT_SENS_DATA_15 = 0x58,
171  REG_EXT_SENS_DATA_16 = 0x59,
172  REG_EXT_SENS_DATA_17 = 0x5a,
173  REG_EXT_SENS_DATA_18 = 0x5b,
174  REG_EXT_SENS_DATA_19 = 0x5c,
175  REG_EXT_SENS_DATA_20 = 0x5d,
176  REG_EXT_SENS_DATA_21 = 0x5e,
177  REG_EXT_SENS_DATA_22 = 0x5f,
178  REG_EXT_SENS_DATA_23 = 0x60,
179 
180  REG_MOT_DETECT_STATUS = 0x61, // *
181 
182  // 0x62 reserved
183 
184  REG_I2C_SLV0_DO = 0x63, // I2C slave data outs
185  REG_I2C_SLV1_DO = 0x64,
186  REG_I2C_SLV2_DO = 0x65,
187  REG_I2C_SLV3_DO = 0x66,
188 
189  REG_I2C_MST_DELAY_CTRL = 0x67,
190 
191  REG_SIGNAL_PATH_RESET = 0x68, // signal path resets
192 
193  REG_MOT_DETECT_CTRL = 0x69,
194 
195  REG_USER_CTRL = 0x6a,
196 
197  REG_PWR_MGMT_1 = 0x6b, // power management
198  REG_PWR_MGMT_2 = 0x6c,
199 
200  // 0x6d-0x71 reserved
201 
202  REG_FIFO_COUNTH = 0x72,
203  REG_FIFO_COUNTL = 0x73,
204 
205  REG_FIFO_R_W = 0x74,
206 
207  REG_WHO_AM_I = 0x75
208  } MPU60X0_REG_T;
209 
213  typedef enum {
214  CONFIG_DLPF_CFG0 = 0x01, // digital low-pass filter config
215  CONFIG_DLPF_CFG1 = 0x02,
216  CONFIG_DLPF_CFG2 = 0x04,
217  _CONFIG_DLPF_SHIFT = 0,
218  _CONFIG_DLPF_MASK = 7,
219 
220  CONFIG_EXT_SYNC_SET0 = 0x08, // FSYNC pin config
221  CONFIG_EXT_SYNC_SET1 = 0x10,
222  CONFIG_EXT_SYNC_SET2 = 0x20,
223  _CONFIG_EXT_SYNC_SET_SHIFT = 3,
224  _CONFIG_EXT_SYNC_SET_MASK = 7
225  } CONFIG_BITS_T;
226 
230  typedef enum {
231  DLPF_260_256 = 0, // accel/gyro bandwidth (Hz)
232  DLPF_184_188 = 1,
233  DLPF_94_98 = 2,
234  DLPF_44_42 = 3,
235  DLPF_21_20 = 4,
236  DLPF_10_10 = 5,
237  DLPF_5_5 = 6,
238  DLPF_RESERVED = 7
239  } DLPF_CFG_T;
240 
244  typedef enum {
245  EXT_SYNC_DISABLED = 0,
246  EXT_SYNC_TEMP_OUT = 1,
247  EXT_SYNC_GYRO_XOUT = 2,
248  EXT_SYNC_GYRO_YOUT = 3,
249  EXT_SYNC_GYRO_ZOUT = 4,
250  EXT_SYNC_ACCEL_XOUT = 5,
251  EXT_SYNC_ACCEL_YOUT = 6,
252  EXT_SYNC_ACCEL_ZOUT = 7
253  } EXT_SYNC_SET_T;
254 
258  typedef enum {
259  // 0x01-0x04 reserved
260  FS_SEL0 = 0x08, // gyro full scale range
261  FS_SEL1 = 0x10,
262  _FS_SEL_SHIFT = 3,
263  _FS_SEL_MASK = 3,
264 
265  ZG_ST = 0x20, // gyro self test bits
266  YG_ST = 0x40,
267  XG_ST = 0x80
269 
273  typedef enum {
274  FS_250 = 0, // 250 deg/s, 131 LSB deg/s
275  FS_500 = 1, // 500 deg/s, 65.5 LSB deg/s
276  FS_1000 = 2, // 1000 deg/s, 32.8 LSB deg/s
277  FS_2000 = 3 // 2000 deg/s, 16.4 LSB deg/s
278  } FS_SEL_T;
279 
283  typedef enum {
284  // 0x01-0x04 reserved
285  AFS_SEL0 = 0x08, // accel full scale range
286  AFS_SEL1 = 0x10,
287  _AFS_SEL_SHIFT = 3,
288  _AFS_SEL_MASK = 3,
289 
290  ZA_ST = 0x20, // gyro self test bits
291  YA_ST = 0x40,
292  XA_ST = 0x80
294 
298  typedef enum {
299  AFS_2 = 0, // 2g, 16384 LSB/g
300  AFS_4 = 1, // 4g, 8192 LSB/g
301  AFS_8 = 2, // 8g, 4096 LSB/g
302  AFS_16 = 3 // 16g, 2048 LSB/g
303  } AFS_SEL_T;
304 
308  typedef enum {
309  SLV0_FIFO_EN = 0x01,
310  SLV1_FIFO_EN = 0x02,
311  SLV2_FIFO_EN = 0x04,
312 
313  ACCEL_FIFO_EN = 0x08,
314 
315  ZG_FIFO_EN = 0x10,
316  YG_FIFO_EN = 0x20,
317  XG_FIFO_EN = 0x40,
318 
319  TEMP_FIFO_EN = 0x80
320  } FIFO_EN_BITS_T;
321 
325  typedef enum {
326  I2C_MST_CLK0 = 0x01,
327  I2C_MST_CLK1 = 0x02,
328  I2C_MST_CLK2 = 0x04,
329  I2C_MST_CLK3 = 0x08,
330  _I2C_MST_CLK_SHIFT = 0,
331  _I2C_MST_CLK_MASK = 15,
332 
333  I2C_MST_P_NSR = 0x10,
334 
335  SLV_3_FIFO_EN = 0x20,
336 
337  WAIT_FOR_ES = 0x40,
338 
339  MULT_MST_EN = 0x80
341 
345  typedef enum {
346  MST_CLK_348 = 0, // 348Khz
347  MST_CLK_333 = 1,
348  MST_CLK_320 = 2,
349  MST_CLK_308 = 3,
350  MST_CLK_296 = 4,
351  MST_CLK_286 = 5,
352  MST_CLK_276 = 6,
353  MST_CLK_267 = 7,
354  MST_CLK_258 = 8,
355  MST_CLK_500 = 9,
356  MST_CLK_471 = 10,
357  MST_CLK_444 = 11,
358  MST_CLK_421 = 12,
359  MST_CLK_400 = 13,
360  MST_CLK_381 = 14,
361  MST_CLK_364 = 15
362  } I2C_MST_CLK_T;
363 
367  typedef enum {
368  I2C_SLV_ADDR0 = 0x01,
369  I2C_SLV_ADDR1 = 0x02,
370  I2C_SLV_ADDR2 = 0x04,
371  I2C_SLV_ADDR3 = 0x08,
372  I2C_SLV_ADDR4 = 0x10,
373  I2C_SLV_ADDR5 = 0x20,
374  I2C_SLV_ADDR6 = 0x40,
375  _I2C_SLV_ADDR_SHIFT = 0,
376  _I2C_SLV_ADDR_MASK = 127,
377 
378  I2C_SLV_RW = 0x80
380 
384  typedef enum {
385  I2C_SLV_LEN0 = 0x01,
386  I2C_SLV_LEN1 = 0x02,
387  I2C_SLV_LEN2 = 0x04,
388  I2C_SLV_LEN3 = 0x08,
389  _I2C_SLV_LEN_SHIFT = 0,
390  _I2C_SLV_LEN_MASK = 15,
391 
392  I2C_SLV_GRP = 0x10,
393  I2C_SLV_REG_DIS = 0x20,
394  I2C_SLV_BYTE_SW = 0x40,
395  I2C_SLV_EN = 0x80
397 
408  typedef enum {
409  I2C_MST_DLY0 = 0x01,
410  I2C_MST_DLY1 = 0x02,
411  I2C_MST_DLY2 = 0x04,
412  I2C_MST_DLY3 = 0x08,
413  I2C_MST_DLY4 = 0x10,
414  _I2C_MST_DLY_SHIFT = 0,
415  _I2C_MST_DLY_MASK = 31,
416 
417  I2C_SLV4_REG_DIS = 0x20,
418  I2C_SLV4_INT_EN = 0x40,
419  I2C_SLV4_EN = 0x80
421 
425  typedef enum {
426  I2C_SLV0_NACK = 0x01,
427  I2C_SLV1_NACK = 0x02,
428  I2C_SLV2_NACK = 0x04,
429  I2C_SLV3_NACK = 0x08,
430  I2C_SLV4_NACK = 0x10,
431 
432  I2C_LOST_ARB = 0x20,
433  I2C_SLV4_DONE = 0x40,
434  PASS_THROUGH = 0x80
436 
440  typedef enum {
441  CLKOUT_EN = 0x01, // *
442 
443  I2C_BYPASS_ENABLE = 0x02,
444 
445  FSYNC_INT_EN = 0x04,
446  FSYNC_INT_LEVEL = 0x08,
447 
448  INT_RD_CLEAR = 0x10,
449 
450  LATCH_INT_EN = 0x20,
451 
452  INT_OPEN = 0x40,
453  INT_LEVEL = 0x80
455 
459  typedef enum {
460  DATA_RDY_EN = 0x01, // *
461 
462  // 0x02, 0x04 reserved
463 
464  I2C_MST_INT_EN = 0x08,
465 
466  FIFO_OFLOW_EN = 0x10,
467 
468  ZMOT_EN = 0x20, // *zero motion
469  MOT_EN = 0x40,
470  FF_EN = 0x80 // *freefall
472 
476  typedef enum {
477  DATA_RDY_INT = 0x01,
478 
479  // 0x02, 0x04 reserved
480 
481  I2C_MST_INT = 0x08,
482 
483  FIFO_OFLOW_INT = 0x10,
484 
485  ZMOT_INT = 0x20, // *zero motion
486  MOT_INT = 0x40,
487  FF_INT = 0x80 // *freefall
489 
493  typedef enum {
494  MOT_ZRMOT = 0x01, // *
495 
496  // 0x02 reserved
497 
498  MOT_ZPOS = 0x04, // *
499  MOT_ZNEG = 0x08, // *
500 
501  MOT_YPOS = 0x10, // *
502  MOT_YNEG = 0x20, // *
503 
504  MOT_XPOS = 0x40, // *
505  MOT_XNEG = 0x80, // *
507 
511  typedef enum {
512  I2C_SLV0_DLY_EN = 0x01,
513  I2C_SLV1_DLY_EN = 0x02,
514  I2C_SLV2_DLY_EN = 0x04,
515  I2C_SLV3_DLY_EN = 0x08,
516  I2C_SLV4_DLY_EN = 0x10,
517 
518  // 0x20, 0x40, reserved
519 
520  DELAY_ES_SHADOW = 0x80
522 
526  typedef enum {
527  TEMP_RESET = 0x01,
528  ACCEL_RESET = 0x02,
529  GYRO_RESET = 0x04
530 
531  // 0x08-0x80 reserved
533 
537  typedef enum {
538  MOT_COUNT0 = 0x01, // *
539  MOT_COUNT1 = 0x02, // *
540  _MOT_COUNT_SHIFT = 0,
541  _MOT_COUNT_MASK = 3,
542 
543  FF_COUNT0 = 0x04, // *
544  FF_COUNT1 = 0x08, // *
545  _FF_COUNT_SHIFT = 2,
546  _FF_COUNT_MASK = 3,
547 
548  ACCEL_ON_DELAY0 = 0x10,
549  ACCEL_ON_DELAY1 = 0x20,
550  _ACCEL_ON_DELAY_SHIFT = 4,
551  _ACCEL_ON_DELAY_MASK = 3
552  // 0x40,0x80 reserved
554 
558  typedef enum {
559  COUNT_0 = 0, // Reset
560  COUNT_1 = 1, // counter decrement 1
561  COUNT_2 = 2, // counter decrement 2
562  COUNT_4 = 3 // counter decrement 4
563  } MOT_FF_COUNT_T;
564 
568  typedef enum {
569  ON_DELAY_0 = 0, // no delay
570  ON_DELAY_1 = 1, // add 1ms
571  ON_DELAY_2 = 2, // add 2ms
572  ON_DELAY_3 = 3 // add 3ms
574 
578  typedef enum {
579  SIG_COND_RESET = 0x01,
580  I2C_MST_RESET = 0x02,
581  FIFO_RESET = 0x04,
582 
583  // 0x08 reserved
584 
585  I2C_IF_DIS = 0x10,
586  I2C_MST_EN = 0x20,
587  FIFO_EN = 0x40
588 
591 
595  typedef enum {
596  CLKSEL0 = 0x01,
597  CLKSEL1 = 0x02,
598  CLKSEL2 = 0x04,
599  _CLKSEL_SHIFT = 0,
600  _CLKSEL_MASK = 7,
601 
602  TEMP_DIS = 0x08,
603 
604  // 0x10 reserved
605 
606  PWR_CYCLE = 0x20,
607  PWR_SLEEP = 0x40,
608  DEVICE_RESET = 0x80
610 
614  typedef enum {
615  INT_8MHZ = 0, // internal 8Mhz osc
616  PLL_XG = 1, // PLL X axis gyro
617  PLL_YG = 2, // PLL Y axis gyro
618  PLL_ZG = 3, // PLL Z axis gyro
619  PLL_EXT_32KHZ = 4, // PLL with external 32.768Khz ref
620  PLL_EXT_19MHZ = 5, // PLL with external 19.2Mhz ref
621  // 6 - reserved
622  CLK_STOP = 7 // stops clk
623  } CLKSEL_T;
624 
628  typedef enum {
629  STBY_ZG = 0x01,
630  STBY_YG = 0x02,
631  STBY_XG = 0x04,
632  STBY_ZA = 0x08,
633  STBY_YA = 0x10,
634  STBY_XA = 0x20,
635 
636  LP_WAKE_CTRL0 = 0x40,
637  LP_WAKE_CTRL1 = 0x80,
638  _LP_WAKE_CTRL_SHIFT = 6,
639  _LP_WAKE_CTRL_MASK = 3
641 
645  typedef enum {
646  LP_WAKE_1_25 = 0, // wakeup feq: 1.25hz
647  LP_WAKE_5 = 1, // 5hz
648  LP_WAKE_20 = 2, // 20hz
649  LP_WAKE_40 = 3, // 40hz
650  } LP_WAKE_CRTL_T;
651 
652 
659  MPU60X0(int bus=MPU60X0_I2C_BUS, uint8_t address=MPU60X0_DEFAULT_I2C_ADDR);
660 
664  ~MPU60X0();
665 
671  bool init();
672 
686  void update();
687 
694  uint8_t readReg(uint8_t reg);
695 
704  void readRegs(uint8_t reg, uint8_t *buffer, int len);
705 
713  bool writeReg(uint8_t reg, uint8_t val);
714 
721  bool setSleep(bool enable);
722 
729  bool setClockSource(CLKSEL_T clk);
730 
737  bool setGyroscopeScale(FS_SEL_T scale);
738 
745  bool setAccelerometerScale(AFS_SEL_T scale);
746 
755 
774  bool setSampleRateDivider(uint8_t div);
775 
781  uint8_t getSampleRateDivider();
782 
791  void getAccelerometer(float *x, float *y, float *z);
792 
801  void getGyroscope(float *x, float *y, float *z);
802 
803 #if defined(SWIGJAVA) || defined(JAVACALLBACK)
804 
809  float *getAccelerometer();
810 
816  float *getGyroscope();
817 #endif
818 
819 
825  virtual float getTemperature();
826 
833  bool enableTemperatureSensor(bool enable);
834 
851 
859  bool enableI2CBypass(bool enable);
860 
870  bool setMotionDetectionThreshold(uint8_t thr);
871 
877  uint8_t getInterruptStatus();
878 
885  bool setInterruptEnables(uint8_t enables);
886 
892  uint8_t getInterruptEnables();
893 
900  bool setInterruptPinConfig(uint8_t cfg);
901 
907  uint8_t getInterruptPinConfig();
908 
920 #if defined(SWIGJAVA) || defined(JAVACALLBACK)
921  void installISR(int gpio, mraa::Edge level, jobject runnable);
922 #else
923  void installISR(int gpio, mraa::Edge level, void (*isr)(void *), void *arg);
924 #endif
925 
930  void uninstallISR();
931 
932  protected:
933  // uncompensated accelerometer and gyroscope values
934  float m_accelX;
935  float m_accelY;
936  float m_accelZ;
937 
938  float m_gyroX;
939  float m_gyroY;
940  float m_gyroZ;
941 
942  // uncompensated temperature value
943  float m_temp;
944 
945  // accelerometer and gyro scaling factors, depending on their Full
946  // Scale settings.
947  float m_accelScale;
948  float m_gyroScale;
949 
950  private:
951  mraa::I2c m_i2c;
952  uint8_t m_addr;
953 
954  mraa::Gpio *m_gpioIRQ;
955  };
956 }
957 
958 
bool setSampleRateDivider(uint8_t div)
Definition: mpu60x0.cxx:282
bool setMotionDetectionThreshold(uint8_t thr)
Definition: mpu60x0.cxx:357
bool setExternalSync(EXT_SYNC_SET_T val)
Definition: mpu60x0.cxx:334
AFS_SEL_T
Definition: mpu60x0.h:298
MOT_DETECT_STATUS_BITS_T
Definition: mpu60x0.h:493
bool enableTemperatureSensor(bool enable)
Definition: mpu60x0.cxx:322
MOT_FF_COUNT_T
Definition: mpu60x0.h:558
MOT_DETECT_CTRL_BITS_T
Definition: mpu60x0.h:537
void getGyroscope(float *x, float *y, float *z)
Definition: mpu60x0.cxx:304
INT_STATUS_BITS_T
Definition: mpu60x0.h:476
bool setAccelerometerScale(AFS_SEL_T scale)
Definition: mpu60x0.cxx:228
uint8_t readReg(uint8_t reg)
Definition: mpu60x0.cxx:139
ACCEL_CONFIG_BITS_T
Definition: mpu60x0.h:283
bool writeReg(uint8_t reg, uint8_t val)
Definition: mpu60x0.cxx:149
EXT_SYNC_SET_T
Definition: mpu60x0.h:244
bool setClockSource(CLKSEL_T clk)
Definition: mpu60x0.cxx:174
uint8_t getSampleRateDivider()
Definition: mpu60x0.cxx:287
PWR_MGMT_2_BITS_T
Definition: mpu60x0.h:628
PWR_MGMT_1_BITS_T
Definition: mpu60x0.h:595
void update()
Definition: mpu60x0.cxx:105
FS_SEL_T
Definition: mpu60x0.h:273
SIGNAL_PATH_RESET_BITS_T
Definition: mpu60x0.h:526
DLPF_CFG_T
Definition: mpu60x0.h:230
MPU60X0(int bus=MPU60X0_I2C_BUS, uint8_t address=MPU60X0_DEFAULT_I2C_ADDR)
Definition: mpu60x0.cxx:35
MST_DELAY_CTRL_BITS_T
Definition: mpu60x0.h:511
I2C_SLV_ADDR_BITS_T
Definition: mpu60x0.h:367
INT_PIN_CFG_BITS_T
Definition: mpu60x0.h:440
MPU60X0_REG_T
Definition: mpu60x0.h:78
void uninstallISR()
Definition: mpu60x0.cxx:415
USER_CTRL_BITS_T
Definition: mpu60x0.h:578
uint8_t getInterruptEnables()
Definition: mpu60x0.cxx:372
I2C_SLV_CTRL_BITS_T
Definition: mpu60x0.h:384
FIFO_EN_BITS_T
Definition: mpu60x0.h:308
bool setDigitalLowPassFilter(DLPF_CFG_T dlp)
Definition: mpu60x0.cxx:271
CLKSEL_T
Definition: mpu60x0.h:614
LP_WAKE_CRTL_T
Definition: mpu60x0.h:645
void installISR(int gpio, mraa::Edge level, void(*isr)(void *), void *arg)
Definition: mpu60x0.cxx:401
void readRegs(uint8_t reg, uint8_t *buffer, int len)
Definition: mpu60x0.cxx:144
virtual float getTemperature()
Definition: mpu60x0.cxx:316
bool setInterruptPinConfig(uint8_t cfg)
Definition: mpu60x0.cxx:377
bool setGyroscopeScale(FS_SEL_T scale)
Definition: mpu60x0.cxx:185
uint8_t getInterruptStatus()
Definition: mpu60x0.cxx:362
I2C_SLV4_CTRL_BITS_T
Definition: mpu60x0.h:408
bool init()
Definition: mpu60x0.cxx:67
ACCEL_ON_DELAY_T
Definition: mpu60x0.h:568
bool setSleep(bool enable)
Definition: mpu60x0.cxx:162
I2C_MST_STATUS_BITS_T
Definition: mpu60x0.h:425
I2C_MST_CTRL_BITS_T
Definition: mpu60x0.h:325
bool enableI2CBypass(bool enable)
Definition: mpu60x0.cxx:345
void getAccelerometer(float *x, float *y, float *z)
Definition: mpu60x0.cxx:292
uint8_t getInterruptPinConfig()
Definition: mpu60x0.cxx:382
GRYO_CONFIG_BITS_T
Definition: mpu60x0.h:258
bool setInterruptEnables(uint8_t enables)
Definition: mpu60x0.cxx:367
I2C_MST_CLK_T
Definition: mpu60x0.h:345
API for the MPU60X0 3-axis Gyroscope and 3-axis Accelerometer.
Definition: mpu60x0.h:61
INT_ENABLE_BITS_T
Definition: mpu60x0.h:459
~MPU60X0()
Definition: mpu60x0.cxx:62
CONFIG_BITS_T
Definition: mpu60x0.h:213