Ported from Arduino Library : https://github.com/jrowberg/i2cdevlib/tree/master/Arduino/MPU6050

Dependents:   kopija_NUCLEO_CELL_LOCKER_copy

Fork of MPU6050 by Simon Garfieldsg

Committer:
OsmanKameric
Date:
Tue Aug 01 15:03:01 2017 +0000
Revision:
3:b21c8c3456be
Parent:
2:e2081d9de7af
Child:
4:1e0b279766be
-Initial Commit;

Who changed what in which revision?

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