Implemented first Hangar-Service
Dependencies: CalibrateMagneto QuaternionMath
Fork of SML2 by
I2CPeripheral.h@5:b9f2f62a8f90, 2015-02-12 (annotated)
- Committer:
- pvaibhav
- Date:
- Thu Feb 12 17:17:35 2015 +0000
- Revision:
- 5:b9f2f62a8f90
- Parent:
- 0:943820483318
- Child:
- 7:604a8369b801
Gyro data can now be read fine. 100 Hz.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
pvaibhav | 0:943820483318 | 1 | #ifndef _H_I2CPERIPHERAL_H |
pvaibhav | 0:943820483318 | 2 | #define _H_I2CPERIPHERAL_H |
pvaibhav | 0:943820483318 | 3 | |
pvaibhav | 0:943820483318 | 4 | #include "mbed.h" |
pvaibhav | 0:943820483318 | 5 | |
pvaibhav | 0:943820483318 | 6 | class I2CPeripheral |
pvaibhav | 0:943820483318 | 7 | { |
pvaibhav | 5:b9f2f62a8f90 | 8 | protected: |
pvaibhav | 0:943820483318 | 9 | I2C* mBus; |
pvaibhav | 0:943820483318 | 10 | uint8_t mAddress; |
pvaibhav | 0:943820483318 | 11 | |
pvaibhav | 0:943820483318 | 12 | protected: |
pvaibhav | 0:943820483318 | 13 | void write_reg(const uint8_t reg, const uint8_t val); |
pvaibhav | 0:943820483318 | 14 | uint8_t read_reg(const uint8_t reg); |
pvaibhav | 5:b9f2f62a8f90 | 15 | void read_reg(const uint8_t reg, uint8_t* destination, const size_t nBytes = 1); |
pvaibhav | 0:943820483318 | 16 | |
pvaibhav | 0:943820483318 | 17 | public: |
pvaibhav | 0:943820483318 | 18 | I2CPeripheral(I2C &i2c, const uint8_t address); |
pvaibhav | 0:943820483318 | 19 | }; |
pvaibhav | 0:943820483318 | 20 | |
pvaibhav | 0:943820483318 | 21 | #endif//_H_I2CPERIPHERAL_H |