Implemented first Hangar-Service
Dependencies: CalibrateMagneto QuaternionMath
Fork of SML2 by
I2CPeripheral.h@46:fd5a62296b12, 2015-05-27 (annotated)
- Committer:
- pvaibhav
- Date:
- Wed May 27 13:01:43 2015 +0000
- Revision:
- 46:fd5a62296b12
- Parent:
- 7:604a8369b801
Code reformatted
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 | 7:604a8369b801 | 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 |