An improved version of mbed's I2C class.
Dependents: acd52832_Humidity_Temp_Example BB acnSensa_LIS aconnoCellularGnss ... more
aconno_i2c.h@4:db46d6bb60f0, 2018-05-24 (annotated)
- Committer:
- jurica238814
- Date:
- Thu May 24 17:50:45 2018 +0200
- Revision:
- 4:db46d6bb60f0
- Parent:
- 2:3c0eab894a4b
- Child:
- 6:4d1b387c12c3
repeated param added
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 | 4:db46d6bb60f0 | 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 | 4:db46d6bb60f0 | 20 | uint8_t sendCommand(char *command, uint8_t len, char *response, |
jurica238814 | 4:db46d6bb60f0 | 21 | uint8_t responseLen, bool repeated = false); |
jurica238814 | 1:5ae1807e3902 | 22 | uint8_t sendCommand(char *command, uint8_t len); |
jurica238814 | 1:5ae1807e3902 | 23 | uint8_t readBus(char *dataBuffer, int len); |
jurica238814 | 0:bfefd65ef71d | 24 | private: |
jurica238814 | 0:bfefd65ef71d | 25 | uint8_t i2cAddress; |
jurica238814 | 2:3c0eab894a4b | 26 | I2C *i2c; |
jurica238814 | 0:bfefd65ef71d | 27 | }; |
jurica238814 | 0:bfefd65ef71d | 28 | |
jurica238814 | 4:db46d6bb60f0 | 29 | #endif // ACONNO_I2C_H |
jurica238814 | 4:db46d6bb60f0 | 30 |