Jurica Resetar / aconno_I2C

Dependents:   acd52832_Humidity_Temp_Example BB acnSensa_LIS aconnoCellularGnss ... more

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers aconno_i2c.h Source File

aconno_i2c.h

00001 /*
00002  *  I2C library made by Jurica Resetar @ aconno
00003  *  2017
00004  *  More info @ aconno.de
00005  *  jurica_resetar@yahoo.com
00006  *  All right reserved
00007  *
00008  */
00009 
00010 #ifndef ACONNO_I2C_H
00011 #define ACONNO_I2C_H
00012 
00013 #include "mbed.h"
00014 
00015 class aconno_i2c{
00016     public:
00017         aconno_i2c(I2C *i2c, char address);
00018         uint8_t writeToReg(char regAddress, char *data, int len);
00019         uint8_t readFromReg(char regAddress, char *dataBuffer, int len);
00020         uint8_t sendCommand(char *command, uint8_t len, char *response,
00021                 uint8_t responseLen, bool repeated = false);
00022         uint8_t sendCommand(char *command, uint8_t len);
00023         uint8_t readBus(char *dataBuffer, int len);
00024         uint16_t changeRegBits(char regAddress, uint8_t regSize,
00025             uint16_t newValue, uint16_t numOfBits, uint16_t offset);
00026     private:
00027         uint8_t i2cAddress;
00028         I2C *i2c;
00029 };
00030 
00031 #endif // ACONNO_I2C_H