Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: FatFileSystemCpp mbed PowerControl USBHostLite
mpu6000.h
00001 // MPU6000 MBED library developed for swimmers 00002 00003 #ifndef _mpu6000_h_ 00004 #define _mpu6000_h_ 00005 #include "mbed.h" 00006 00007 // MPU6000 class 00008 class MPU6000 00009 { 00010 // Hardware objects 00011 SPI& spi; 00012 DigitalOut cs; 00013 00014 // Public methods 00015 public: 00016 MPU6000(SPI& _spi, PinName _cs); 00017 void regWrite(uint8_t ADDR, uint8_t DATA); 00018 uint8_t regRead(uint8_t ADDR); 00019 uint8_t init(); 00020 void valRead(bool device, short int &x, short int &y, short int &z); 00021 }; 00022 00023 #endif 00024 00025 // MPU6000 defines ============================================================= 00026 00027 // Read flag 00028 #define READ 0x80 00029 00030 // Device defines 00031 #define ACCEL 0 00032 #define GYRO 1 00033 00034 // Registers =================================================================== 00035 #define CONFIG 0x1A 00036 #define GYRO_CONFIG 0x1B 00037 #define ACCEL_CONFIG 0x1C 00038 #define MOT_THR 0x1F 00039 #define INT_PIN_CFG 0x37 00040 #define INT_ENABLE 0x38 00041 #define INT_STATUS 0x3A 00042 #define ACCEL_XOUT_H 0x3B 00043 #define ACCEL_XOUT_L 0x3C 00044 #define ACCEL_YOUT_H 0x3D 00045 #define ACCEL_YOUT_L 0x3E 00046 #define ACCEL_ZOUT_H 0x3F 00047 #define ACCEL_ZOUT_L 0x40 00048 #define TEMP_OUT_H 0x41 00049 #define TEMP_OUT_L 0x42 00050 #define GYRO_XOUT_H 0x43 00051 #define GYRO_XOUT_L 0x44 00052 #define GYRO_YOUT_H 0x45 00053 #define GYRO_YOUT_L 0x46 00054 #define GYRO_ZOUT_H 0x47 00055 #define GYRO_ZOUT_L 0x48 00056 #define MOT_DETECT_CTRL 0x69 00057 #define USER_CTRL 0x6A 00058 #define PWR_MGMT_1 0x6B 00059 #define PWR_MGMT_2 0x6C 00060 #define WHO_AM_I 0x75
Generated on Mon Jul 18 2022 01:02:56 by
