14 #ifndef I2C_MAX_TX_SIZE
15 #define I2C_MAX_TX_SIZE 4
18 #ifndef I2C_MAX_RX_SIZE
19 #define I2C_MAX_RX_SIZE 4
22 #ifndef I2C_MAX_TRANSACTIONS
23 #define I2C_MAX_TRANSACTIONS 4
27 uint8_t writeData[I2C_MAX_TX_SIZE];
28 uint8_t readData[I2C_MAX_RX_SIZE];
29 uint16_t slave_address;
31 uint16_t writeLength : 4;
32 uint16_t readLength : 4;
34 uint16_t retryCount : 3;
35 uint16_t blocking : 1;
36 uint16_t finished : 1;
44 #define TRANSACTION_FAILED 1
45 #define TRANSACTION_SUCCESSFUL 0
50 uint8_t I2C_Tx_Handler(uint8_t channel);
51 void I2C_Rx_Handler(uint8_t channel, uint8_t byte);
56 uint16_t I2C_GetSlaveAddress(uint8_t channel);
57 void I2C_Rx_Handler(uint8_t channel, uint8_t byte);
58 uint8_t I2C_GetTxByte(uint8_t channel);
59 uint8_t I2C_GetTxSize(uint8_t channel);
60 uint8_t I2C_GetRxSize(uint8_t channel);
61 void I2C_TransactionSuccess(uint8_t channel);
62 void I2C_TransactionFail(uint8_t channel);
68 void hal_I2C_Enable(uint8_t channel);
69 void hal_I2C_Disable(uint8_t channel);
70 void hal_I2C_SendStart(uint8_t channel);
72 void hal_I2C_EnableInterrupts(uint8_t channel);
73 void hal_I2C_DisableInterrupts(uint8_t channel);