Only imu output

Dependencies:   Servo mbed

Fork of FYDP_Final2 by Mark Vandermeulen

Committer:
majik
Date:
Sat Mar 21 21:31:29 2015 +0000
Revision:
0:21019d94ad33
Both IMUs work now

Who changed what in which revision?

UserRevisionLine numberNew contents of line
majik 0:21019d94ad33 1 //ported from arduino library: https://github.com/jrowberg/i2cdevlib/tree/master/Arduino/MPU6050
majik 0:21019d94ad33 2 //written by szymon gaertig (email: szymon@gaertig.com.pl)
majik 0:21019d94ad33 3 //
majik 0:21019d94ad33 4 //Changelog:
majik 0:21019d94ad33 5 //2013-01-08 - first beta release
majik 0:21019d94ad33 6
majik 0:21019d94ad33 7 #ifndef I2Cdev2_h
majik 0:21019d94ad33 8 #define I2Cdev2_h
majik 0:21019d94ad33 9
majik 0:21019d94ad33 10 #include "mbed.h"
majik 0:21019d94ad33 11
majik 0:21019d94ad33 12 #define I2C2_SDA PTC9
majik 0:21019d94ad33 13 #define I2C2_SCL PTC8
majik 0:21019d94ad33 14
majik 0:21019d94ad33 15 class I2Cdev2 {
majik 0:21019d94ad33 16 private:
majik 0:21019d94ad33 17 I2C i2c;
majik 0:21019d94ad33 18 //Serial debugSerial;
majik 0:21019d94ad33 19 public:
majik 0:21019d94ad33 20 I2Cdev2();
majik 0:21019d94ad33 21 I2Cdev2(PinName i2cSda, PinName i2cScl);
majik 0:21019d94ad33 22
majik 0:21019d94ad33 23 int8_t readBit(uint8_t devAddr, uint8_t regAddr, uint8_t bitNum, uint8_t *data, uint16_t timeout=I2Cdev2::readTimeout());
majik 0:21019d94ad33 24 int8_t readBitW(uint8_t devAddr, uint8_t regAddr, uint8_t bitNum, uint16_t *data, uint16_t timeout=I2Cdev2::readTimeout());
majik 0:21019d94ad33 25 int8_t readBits(uint8_t devAddr, uint8_t regAddr, uint8_t bitStart, uint8_t length, uint8_t *data, uint16_t timeout=I2Cdev2::readTimeout());
majik 0:21019d94ad33 26 int8_t readBitsW(uint8_t devAddr, uint8_t regAddr, uint8_t bitStart, uint8_t length, uint16_t *data, uint16_t timeout=I2Cdev2::readTimeout());
majik 0:21019d94ad33 27 int8_t readByte(uint8_t devAddr, uint8_t regAddr, uint8_t *data, uint16_t timeout=I2Cdev2::readTimeout());
majik 0:21019d94ad33 28 int8_t readWord(uint8_t devAddr, uint8_t regAddr, uint16_t *data, uint16_t timeout=I2Cdev2::readTimeout());
majik 0:21019d94ad33 29 int8_t readBytes(uint8_t devAddr, uint8_t regAddr, uint8_t length, uint8_t *data, uint16_t timeout=I2Cdev2::readTimeout());
majik 0:21019d94ad33 30 int8_t readWords(uint8_t devAddr, uint8_t regAddr, uint8_t length, uint16_t *data, uint16_t timeout=I2Cdev2::readTimeout());
majik 0:21019d94ad33 31
majik 0:21019d94ad33 32 bool writeBit(uint8_t devAddr, uint8_t regAddr, uint8_t bitNum, uint8_t data);
majik 0:21019d94ad33 33 bool writeBitW(uint8_t devAddr, uint8_t regAddr, uint8_t bitNum, uint16_t data);
majik 0:21019d94ad33 34 bool writeBits(uint8_t devAddr, uint8_t regAddr, uint8_t bitStart, uint8_t length, uint8_t data);
majik 0:21019d94ad33 35 bool writeBitsW(uint8_t devAddr, uint8_t regAddr, uint8_t bitStart, uint8_t length, uint16_t data);
majik 0:21019d94ad33 36 bool writeByte(uint8_t devAddr, uint8_t regAddr, uint8_t data);
majik 0:21019d94ad33 37 bool writeWord(uint8_t devAddr, uint8_t regAddr, uint16_t data);
majik 0:21019d94ad33 38 bool writeBytes(uint8_t devAddr, uint8_t regAddr, uint8_t length, uint8_t *data);
majik 0:21019d94ad33 39 bool writeWords(uint8_t devAddr, uint8_t regAddr, uint8_t length, uint16_t *data);
majik 0:21019d94ad33 40
majik 0:21019d94ad33 41 static uint16_t readTimeout(void);
majik 0:21019d94ad33 42 };
majik 0:21019d94ad33 43
majik 0:21019d94ad33 44 #endif