An improved version of mbed's I2C class.
Dependents: acd52832_Humidity_Temp_Example BB acnSensa_LIS aconnoCellularGnss ... more
aconno_i2c.h@2:3c0eab894a4b, 2017-09-26 (annotated)
- Committer:
- jurica238814
- Date:
- Tue Sep 26 12:03:09 2017 +0000
- Revision:
- 2:3c0eab894a4b
- Parent:
- 1:5ae1807e3902
- Child:
- 4:db46d6bb60f0
I2C inheritance removed.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jurica238814 | 0:bfefd65ef71d | 1 | /* |
jurica238814 | 0:bfefd65ef71d | 2 | * I2C library made by Jurica Resetar @ aconno |
jurica238814 | 0:bfefd65ef71d | 3 | * 2017 |
jurica238814 | 0:bfefd65ef71d | 4 | * More info @ aconno.de |
jurica238814 | 0:bfefd65ef71d | 5 | * jurica_resetar@yahoo.com |
jurica238814 | 0:bfefd65ef71d | 6 | * All right reserved |
jurica238814 | 0:bfefd65ef71d | 7 | * |
jurica238814 | 0:bfefd65ef71d | 8 | */ |
jurica238814 | 0:bfefd65ef71d | 9 | |
jurica238814 | 0:bfefd65ef71d | 10 | #ifndef ACONNO_I2C_H |
jurica238814 | 0:bfefd65ef71d | 11 | #define ACONNO_I2C_H |
jurica238814 | 0:bfefd65ef71d | 12 | |
jurica238814 | 0:bfefd65ef71d | 13 | #include "mbed.h" |
jurica238814 | 0:bfefd65ef71d | 14 | |
jurica238814 | 2:3c0eab894a4b | 15 | class aconno_i2c{ |
jurica238814 | 0:bfefd65ef71d | 16 | public: |
jurica238814 | 2:3c0eab894a4b | 17 | aconno_i2c(I2C *i2c, char address); |
jurica238814 | 0:bfefd65ef71d | 18 | uint8_t writeToReg(char regAddress, char *data, int len); |
jurica238814 | 0:bfefd65ef71d | 19 | uint8_t readFromReg(char regAddress, char *dataBuffer, int len); |
jurica238814 | 0:bfefd65ef71d | 20 | uint8_t sendCommand(char *command, uint8_t len, char *response, uint8_t responseLen); |
jurica238814 | 1:5ae1807e3902 | 21 | uint8_t sendCommand(char *command, uint8_t len); |
jurica238814 | 1:5ae1807e3902 | 22 | uint8_t readBus(char *dataBuffer, int len); |
jurica238814 | 0:bfefd65ef71d | 23 | private: |
jurica238814 | 0:bfefd65ef71d | 24 | uint8_t i2cAddress; |
jurica238814 | 2:3c0eab894a4b | 25 | I2C *i2c; |
jurica238814 | 0:bfefd65ef71d | 26 | }; |
jurica238814 | 0:bfefd65ef71d | 27 | |
jurica238814 | 0:bfefd65ef71d | 28 | #endif // ACONNO_I2C_H |