Rearranged original code port/fork to: * Make library compatible with TiltyQuad IMU; * Prevent multiple definition, and added inclusion guard; * Cleaner access to library functions and file structure; and * "Broke out" code to control Sampling Rate and FIFO buffer update rate. By Trung Tin Ian HUA 2014. Credit to Jeff Rowberg for his original code, the best DMP implementation thus far; and szymon gaertig for porting the arduino library to mbed.
Fork of MPU6050 by
I2Cdev.h
00001 //ported from arduino library: https://github.com/jrowberg/i2cdevlib/tree/master/Arduino/MPU6050 00002 //written by szymon gaertig (email: szymon@gaertig.com.pl) 00003 // 00004 //Changelog: 00005 //2013-01-08 - first beta release 00006 00007 #ifndef I2Cdev_h 00008 #define I2Cdev_h 00009 00010 #include "mbed.h" 00011 00012 #define I2C_SDA p9 00013 #define I2C_SCL p10 00014 00015 class I2Cdev 00016 { 00017 private: 00018 I2C i2c; 00019 00020 public: 00021 Serial debugSerial; 00022 I2Cdev(); 00023 I2Cdev(PinName i2cSda, PinName i2cScl); 00024 00025 int8_t readBit(uint8_t devAddr, uint8_t regAddr, uint8_t bitNum, uint8_t *data, uint16_t timeout=I2Cdev::readTimeout()); 00026 int8_t readBitW(uint8_t devAddr, uint8_t regAddr, uint8_t bitNum, uint16_t *data, uint16_t timeout=I2Cdev::readTimeout()); 00027 int8_t readBits(uint8_t devAddr, uint8_t regAddr, uint8_t bitStart, uint8_t length, uint8_t *data, uint16_t timeout=I2Cdev::readTimeout()); 00028 int8_t readBitsW(uint8_t devAddr, uint8_t regAddr, uint8_t bitStart, uint8_t length, uint16_t *data, uint16_t timeout=I2Cdev::readTimeout()); 00029 int8_t readByte(uint8_t devAddr, uint8_t regAddr, uint8_t *data, uint16_t timeout=I2Cdev::readTimeout()); 00030 int8_t readWord(uint8_t devAddr, uint8_t regAddr, uint16_t *data, uint16_t timeout=I2Cdev::readTimeout()); 00031 int8_t readBytes(uint8_t devAddr, uint8_t regAddr, uint8_t length, uint8_t *data, uint16_t timeout=I2Cdev::readTimeout()); 00032 int8_t readWords(uint8_t devAddr, uint8_t regAddr, uint8_t length, uint16_t *data, uint16_t timeout=I2Cdev::readTimeout()); 00033 00034 bool writeBit(uint8_t devAddr, uint8_t regAddr, uint8_t bitNum, uint8_t data); 00035 bool writeBitW(uint8_t devAddr, uint8_t regAddr, uint8_t bitNum, uint16_t data); 00036 bool writeBits(uint8_t devAddr, uint8_t regAddr, uint8_t bitStart, uint8_t length, uint8_t data); 00037 bool writeBitsW(uint8_t devAddr, uint8_t regAddr, uint8_t bitStart, uint8_t length, uint16_t data); 00038 bool writeByte(uint8_t devAddr, uint8_t regAddr, uint8_t data); 00039 bool writeWord(uint8_t devAddr, uint8_t regAddr, uint16_t data); 00040 bool writeBytes(uint8_t devAddr, uint8_t regAddr, uint8_t length, uint8_t *data); 00041 bool writeWords(uint8_t devAddr, uint8_t regAddr, uint8_t length, uint16_t *data); 00042 00043 static uint16_t readTimeout(void); 00044 }; 00045 00046 #endif
Generated on Thu Jul 14 2022 01:27:45 by 1.7.2