AnsweredAssumed Answered

I2C compentent stop bit control

Question asked by gordon gao on Dec 4, 2017
Latest reply on Dec 21, 2017 by gordon gao

I use i2c0 compentent,How can I control the stop bit, 

I change "LDD_I2C_SEND_STOP" to "LDD_I2C_NO_SEND_STOP" flag ,but only will sent out stop bit.

Thanks!

 

code:

uint8_t GI2C1_ReadAddress(uint8_t i2cAddr, uint8_t *memAddr, uint8_t memAddrSize, uint8_t *data, uint16_t dataSize)
{
uint8_t res = ERR_OK;

if (GI2C1_SelectSlave(i2cAddr)!=ERR_OK) {
return ERR_FAILED;
}
for(;;) { /* breaks */
if(memAddr!=NULL) { /* only if we want to send an address */
/* send device address and memory address */
GI2C1_deviceData.dataTransmittedFlg = FALSE;
res = CI2C1_MasterSendBlock(GI2C1_deviceData.handle, memAddr, memAddrSize, LDD_I2C_NO_SEND_STOP);
if (res!=ERR_OK) {
break; /* break for(;;) */
}
}
do { /* Wait until data is sent */
} while (!GI2C1_deviceData.dataTransmittedFlg);
/* receive data */
GI2C1_deviceData.dataReceivedFlg = FALSE;
res = CI2C1_MasterReceiveBlock(GI2C1_deviceData.handle, data, dataSize, LDD_I2C_NO_SEND_STOP);// LDD_I2C_SEND_STOP);
if (res!=ERR_OK) {
break; /* break for(;;) */
}
do
{ /* Wait until data is received */
} while (!GI2C1_deviceData.dataReceivedFlg);
break; /* break for(;;) */
} /* for(;;) */
if (GI2C1_UnselectSlave()!=ERR_OK) {
return ERR_FAILED;
}
return res;
}

Outcomes