56 #define I2C_BITRATE_SLOW 10000
57 #define I2C_BITRATE_NORMAL 100000
58 #define I2C_BITRATE_FAST 400000
59 #define I2C_BITRATE_HIGHSPEED 3500000
62 #define E_I2C_INIT ( E_I2C + 1 )
63 #define E_I2C_INIT_DESCR "Initialization error"
66 #define E_I2C_ARB_LOST ( E_I2C + 2 )
67 #define E_I2C_ARB_LOST_DESCR "Arbitration Lost"
69 #define E_I2C_NO_ACK ( E_I2C + 3 )
70 #define E_I2C_NO_ACK_DESCR "No acknowledge"
74 #define E_I2C_TIME_OUT ( E_I2C + 4 )
77 #define E_I2C_TIME_OUT_DESCR "Transmission time out"
87 #define E_I2C_IC_PROTO ( E_I2C + 10 )
88 #define E_I2C_IC_PROTO_DESCR "IC did not respond corrctly"
225 void i2cDebug(
bool enable);
bool i2cWrite(I2C_Device *dev, i2cAddr addr, uint8_t *bytes, int len)
Writes to the I2C device.
bool i2cExists(I2C_Device *dev, i2cAddr addr, bool *canRead, bool *canWrite)
Checks whether or not an I2C address is present on the bus.
Structure defines OpenCores I2C Device.
bool i2cSendCmdAlt(I2C_Device *dev, i2cAddr addr, uint8_t *cmd, int cmd_len, uint8_t *answer, int answer_len)
Writes a command to the I2C device and receive the answer.
uint8_t i2cAddr
I2C address type.
bool i2cReadReg(I2C_Device *dev, i2cAddr addr, uint8_t regNo, uint8_t *rd, int rdLen)
Reads from the I2C device register.
bool i2cWriteRead(I2C_Device *dev, i2cAddr addr, uint8_t *wr, int wrLen, uint8_t *rd, int rdLen)
Writes and Reads To and from the I2C device.
bool i2cWriteReg(I2C_Device *dev, i2cAddr addr, uint8_t regNo, uint8_t *wr, int wrLen)
Writes to the I2C device register.
Manages the global system error.
bool i2cInit(I2C_Device *dev, uint32_t bitrate)
Initializes the I2C device with the specified bitrate.
bool i2cReadRegAlt(I2C_Device *dev, i2cAddr addr, uint8_t reg_addr, uint8_t *answer, int len)
Reads a register from a I2C device.
This module is responsible for distributing error codes.
bool i2cRead(I2C_Device *dev, i2cAddr addr, uint8_t *bytes, int len)
Reads from the I2C device.
This file assigns all device structures to memory mapped structures.