NOT FINISHED YET!!! My first try to get a self built fully working Quadrocopter based on an mbed, a self built frame and some other more or less cheap parts.

Dependencies:   mbed MODI2C

Committer:
maetugr
Date:
Fri Feb 14 14:17:32 2014 +0000
Revision:
40:2ca410923691
Parent:
36:128c55793728
now with MPU6050 before taking it too FlyBed2

Who changed what in which revision?

UserRevisionLine numberNew contents of line
maetugr 34:3aa1cbcde59d 1 // by MaEtUgR
maetugr 34:3aa1cbcde59d 2
maetugr 34:3aa1cbcde59d 3 #ifndef I2C_Sensor_H
maetugr 34:3aa1cbcde59d 4 #define I2C_Sensor_H
maetugr 34:3aa1cbcde59d 5
maetugr 34:3aa1cbcde59d 6 #include "mbed.h"
maetugr 36:128c55793728 7 #include "MODI2C.h"
maetugr 34:3aa1cbcde59d 8
maetugr 34:3aa1cbcde59d 9 class I2C_Sensor
maetugr 34:3aa1cbcde59d 10 {
maetugr 34:3aa1cbcde59d 11 public:
maetugr 34:3aa1cbcde59d 12 I2C_Sensor(PinName sda, PinName scl, char address);
maetugr 34:3aa1cbcde59d 13
maetugr 34:3aa1cbcde59d 14 protected:
maetugr 34:3aa1cbcde59d 15 // Calibration
maetugr 34:3aa1cbcde59d 16 void saveCalibrationValues(float values[], int size, char * filename);
maetugr 34:3aa1cbcde59d 17 void loadCalibrationValues(float values[], int size, char * filename);
maetugr 34:3aa1cbcde59d 18
maetugr 34:3aa1cbcde59d 19 // I2C functions
maetugr 34:3aa1cbcde59d 20 char readRegister(char reg);
maetugr 34:3aa1cbcde59d 21 void writeRegister(char reg, char data);
maetugr 34:3aa1cbcde59d 22 void readMultiRegister(char reg, char* output, int size);
maetugr 34:3aa1cbcde59d 23
maetugr 34:3aa1cbcde59d 24 private:
maetugr 36:128c55793728 25 I2C i2c_init; // original mbed I2C-library just to initialise the control registers
maetugr 36:128c55793728 26 MODI2C i2c; // I2C-Bus
maetugr 34:3aa1cbcde59d 27 char i2c_address; // address
maetugr 34:3aa1cbcde59d 28
maetugr 34:3aa1cbcde59d 29 LocalFileSystem local; // file access to save calibration values
maetugr 34:3aa1cbcde59d 30 };
maetugr 34:3aa1cbcde59d 31
maetugr 34:3aa1cbcde59d 32 #endif