![](/media/cache/profiles/8ad6635f33710af6a535e8fb8486975e.50x50_q85.jpg)
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.
Sensors/I2C_Sensor.h@15:753c5d6a63b3, 2012-10-29 (annotated)
- Committer:
- maetugr
- Date:
- Mon Oct 29 16:43:10 2012 +0000
- Revision:
- 15:753c5d6a63b3
- Parent:
- 14:cf260677ecde
- Child:
- 16:74a6531350b5
I2C/Interrupt-Problem gel?st!! erste Versuche an gespannter schnur, falsche PID werte mitten im umschreiben auf I2C_Sensor mutterklasse
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
maetugr | 14:cf260677ecde | 1 | #ifndef I2C_Sensor_H |
maetugr | 14:cf260677ecde | 2 | #define I2C_Sensor_H |
maetugr | 14:cf260677ecde | 3 | |
maetugr | 14:cf260677ecde | 4 | class I2C_Sensor |
maetugr | 14:cf260677ecde | 5 | { |
maetugr | 14:cf260677ecde | 6 | public: |
maetugr | 14:cf260677ecde | 7 | I2C_Sensor(PinName sda, PinName scl, int8_t address); |
maetugr | 14:cf260677ecde | 8 | |
maetugr | 14:cf260677ecde | 9 | float data[3]; |
maetugr | 14:cf260677ecde | 10 | void read(); |
maetugr | 14:cf260677ecde | 11 | void calibrate(); |
maetugr | 14:cf260677ecde | 12 | |
maetugr | 14:cf260677ecde | 13 | protected: |
maetugr | 14:cf260677ecde | 14 | // I2C functions |
maetugr | 15:753c5d6a63b3 | 15 | char readRegister(char reg); |
maetugr | 15:753c5d6a63b3 | 16 | void writeRegister(char reg, char data); |
maetugr | 15:753c5d6a63b3 | 17 | void readMultiRegister(char reg, char* output, int size); |
maetugr | 14:cf260677ecde | 18 | |
maetugr | 14:cf260677ecde | 19 | // raw data and function to measure it |
maetugr | 14:cf260677ecde | 20 | int raw[3]; |
maetugr | 14:cf260677ecde | 21 | void readraw(); |
maetugr | 14:cf260677ecde | 22 | |
maetugr | 15:753c5d6a63b3 | 23 | private: |
maetugr | 15:753c5d6a63b3 | 24 | I2C i2c; // I2C-Bus |
maetugr | 15:753c5d6a63b3 | 25 | int8_t i2c_address; // address |
maetugr | 15:753c5d6a63b3 | 26 | |
maetugr | 14:cf260677ecde | 27 | LocalFileSystem local; // file access to save calibration values |
maetugr | 14:cf260677ecde | 28 | }; |
maetugr | 14:cf260677ecde | 29 | |
maetugr | 14:cf260677ecde | 30 | #endif |