Only imu output

Dependencies:   Servo mbed

Fork of FYDP_Final2 by Mark Vandermeulen

Committer:
tntmarket
Date:
Wed Mar 25 09:58:50 2015 +0000
Revision:
5:d2e955a94940
Parent:
0:21019d94ad33
only imu output

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 I2Cdev_h
majik 0:21019d94ad33 8 #define I2Cdev_h
majik 0:21019d94ad33 9
majik 0:21019d94ad33 10 #include "mbed.h"
majik 0:21019d94ad33 11
majik 0:21019d94ad33 12 #define I2C_SDA PTE0
majik 0:21019d94ad33 13 #define I2C_SCL PTE1
majik 0:21019d94ad33 14 //#define I2C_SDA PTE0
majik 0:21019d94ad33 15 //#define I2C_SCL PTE1
majik 0:21019d94ad33 16
majik 0:21019d94ad33 17
majik 0:21019d94ad33 18 class I2Cdev {
majik 0:21019d94ad33 19 private:
majik 0:21019d94ad33 20 I2C i2c;
majik 0:21019d94ad33 21 //Serial debugSerial;
majik 0:21019d94ad33 22 public:
majik 0:21019d94ad33 23 I2Cdev();
majik 0:21019d94ad33 24 I2Cdev(PinName i2cSda, PinName i2cScl);
majik 0:21019d94ad33 25
majik 0:21019d94ad33 26 int8_t readBit(uint8_t devAddr, uint8_t regAddr, uint8_t bitNum, uint8_t *data, uint16_t timeout=I2Cdev::readTimeout());
majik 0:21019d94ad33 27 int8_t readBitW(uint8_t devAddr, uint8_t regAddr, uint8_t bitNum, uint16_t *data, uint16_t timeout=I2Cdev::readTimeout());
majik 0:21019d94ad33 28 int8_t readBits(uint8_t devAddr, uint8_t regAddr, uint8_t bitStart, uint8_t length, uint8_t *data, uint16_t timeout=I2Cdev::readTimeout());
majik 0:21019d94ad33 29 int8_t readBitsW(uint8_t devAddr, uint8_t regAddr, uint8_t bitStart, uint8_t length, uint16_t *data, uint16_t timeout=I2Cdev::readTimeout());
majik 0:21019d94ad33 30 int8_t readByte(uint8_t devAddr, uint8_t regAddr, uint8_t *data, uint16_t timeout=I2Cdev::readTimeout());
majik 0:21019d94ad33 31 int8_t readWord(uint8_t devAddr, uint8_t regAddr, uint16_t *data, uint16_t timeout=I2Cdev::readTimeout());
majik 0:21019d94ad33 32 int8_t readBytes(uint8_t devAddr, uint8_t regAddr, uint8_t length, uint8_t *data, uint16_t timeout=I2Cdev::readTimeout());
majik 0:21019d94ad33 33 int8_t readWords(uint8_t devAddr, uint8_t regAddr, uint8_t length, uint16_t *data, uint16_t timeout=I2Cdev::readTimeout());
majik 0:21019d94ad33 34
majik 0:21019d94ad33 35 bool writeBit(uint8_t devAddr, uint8_t regAddr, uint8_t bitNum, uint8_t data);
majik 0:21019d94ad33 36 bool writeBitW(uint8_t devAddr, uint8_t regAddr, uint8_t bitNum, uint16_t data);
majik 0:21019d94ad33 37 bool writeBits(uint8_t devAddr, uint8_t regAddr, uint8_t bitStart, uint8_t length, uint8_t data);
majik 0:21019d94ad33 38 bool writeBitsW(uint8_t devAddr, uint8_t regAddr, uint8_t bitStart, uint8_t length, uint16_t data);
majik 0:21019d94ad33 39 bool writeByte(uint8_t devAddr, uint8_t regAddr, uint8_t data);
majik 0:21019d94ad33 40 bool writeWord(uint8_t devAddr, uint8_t regAddr, uint16_t data);
majik 0:21019d94ad33 41 bool writeBytes(uint8_t devAddr, uint8_t regAddr, uint8_t length, uint8_t *data);
majik 0:21019d94ad33 42 bool writeWords(uint8_t devAddr, uint8_t regAddr, uint8_t length, uint16_t *data);
majik 0:21019d94ad33 43
majik 0:21019d94ad33 44 static uint16_t readTimeout(void);
majik 0:21019d94ad33 45 };
majik 0:21019d94ad33 46
majik 0:21019d94ad33 47 #endif