42 #define I2C_PORT_LOCATION 1
44 I2CSPM_Init_TypeDef
i2cInit = I2CSPM_INIT_DEFAULT;
113 I2C_TransferSeq_TypeDef seq;
114 I2C_TransferReturn_TypeDef ret;
115 uint8_t i2c_read_data[0];
117 seq.addr = iicAddress;
118 seq.flags = I2C_FLAG_WRITE;
120 seq.buf[0].data = wBuffer;
121 seq.buf[0].len = wLength;
123 seq.buf[1].data = i2c_read_data;
126 ret = I2CSPM_Transfer(
i2cInit.port, &seq);
128 if (ret != i2cTransferDone) {
153 I2C_TransferSeq_TypeDef seq;
154 I2C_TransferReturn_TypeDef ret;
156 seq.addr = iicAddress;
157 seq.flags = I2C_FLAG_READ;
160 seq.buf[0].data = rBuffer;
161 seq.buf[0].len = rLength;
163 ret = I2CSPM_Transfer(
i2cInit.port, &seq);
165 if (ret != i2cTransferDone) {
190 bool IIC_WriteReadBuffer(uint8_t iicAddress, uint8_t * wBuffer, uint8_t wLength, uint8_t *rBuffer, uint8_t rLength){
191 I2C_TransferSeq_TypeDef seq;
192 I2C_TransferReturn_TypeDef ret;
194 seq.addr = iicAddress;
195 seq.flags = I2C_FLAG_WRITE_READ;
197 seq.buf[0].data = wBuffer;
198 seq.buf[0].len = wLength;
201 seq.buf[1].data = rBuffer;
202 seq.buf[1].len = rLength;
204 ret = I2CSPM_Transfer(
i2cInit.port, &seq);
206 if (ret != i2cTransferDone) {