Only imu output
Fork of FYDP_Final2 by
Diff: drivers/MPU6050-DMP-Ian/I2C/I2Cdev2.h
- Revision:
- 0:21019d94ad33
diff -r 000000000000 -r 21019d94ad33 drivers/MPU6050-DMP-Ian/I2C/I2Cdev2.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/drivers/MPU6050-DMP-Ian/I2C/I2Cdev2.h Sat Mar 21 21:31:29 2015 +0000 @@ -0,0 +1,44 @@ +//ported from arduino library: https://github.com/jrowberg/i2cdevlib/tree/master/Arduino/MPU6050 +//written by szymon gaertig (email: szymon@gaertig.com.pl) +// +//Changelog: +//2013-01-08 - first beta release + +#ifndef I2Cdev2_h +#define I2Cdev2_h + +#include "mbed.h" + +#define I2C2_SDA PTC9 +#define I2C2_SCL PTC8 + +class I2Cdev2 { + private: + I2C i2c; + //Serial debugSerial; + public: + I2Cdev2(); + I2Cdev2(PinName i2cSda, PinName i2cScl); + + int8_t readBit(uint8_t devAddr, uint8_t regAddr, uint8_t bitNum, uint8_t *data, uint16_t timeout=I2Cdev2::readTimeout()); + int8_t readBitW(uint8_t devAddr, uint8_t regAddr, uint8_t bitNum, uint16_t *data, uint16_t timeout=I2Cdev2::readTimeout()); + int8_t readBits(uint8_t devAddr, uint8_t regAddr, uint8_t bitStart, uint8_t length, uint8_t *data, uint16_t timeout=I2Cdev2::readTimeout()); + int8_t readBitsW(uint8_t devAddr, uint8_t regAddr, uint8_t bitStart, uint8_t length, uint16_t *data, uint16_t timeout=I2Cdev2::readTimeout()); + int8_t readByte(uint8_t devAddr, uint8_t regAddr, uint8_t *data, uint16_t timeout=I2Cdev2::readTimeout()); + int8_t readWord(uint8_t devAddr, uint8_t regAddr, uint16_t *data, uint16_t timeout=I2Cdev2::readTimeout()); + int8_t readBytes(uint8_t devAddr, uint8_t regAddr, uint8_t length, uint8_t *data, uint16_t timeout=I2Cdev2::readTimeout()); + int8_t readWords(uint8_t devAddr, uint8_t regAddr, uint8_t length, uint16_t *data, uint16_t timeout=I2Cdev2::readTimeout()); + + bool writeBit(uint8_t devAddr, uint8_t regAddr, uint8_t bitNum, uint8_t data); + bool writeBitW(uint8_t devAddr, uint8_t regAddr, uint8_t bitNum, uint16_t data); + bool writeBits(uint8_t devAddr, uint8_t regAddr, uint8_t bitStart, uint8_t length, uint8_t data); + bool writeBitsW(uint8_t devAddr, uint8_t regAddr, uint8_t bitStart, uint8_t length, uint16_t data); + bool writeByte(uint8_t devAddr, uint8_t regAddr, uint8_t data); + bool writeWord(uint8_t devAddr, uint8_t regAddr, uint16_t data); + bool writeBytes(uint8_t devAddr, uint8_t regAddr, uint8_t length, uint8_t *data); + bool writeWords(uint8_t devAddr, uint8_t regAddr, uint8_t length, uint16_t *data); + + static uint16_t readTimeout(void); +}; + +#endif \ No newline at end of file