1.1.11.15 I2CSMBx_LastByteAckStatusGet Function
C
/* x = I2C SMBUS peripheral instance number */
/* I2C slave mode */
I2C_SLAVE_ACK_STATUS I2CSMBx_LastByteAckStatusGet(void)
Summary
Returns the ACK status of the last byte written to the I2C master.
Description
This function returns the ACK status of the last byte written to the I2C master.
Precondition
I2Cx_Initialize must have been called for the associated I2C instance.
Parameters
None.
Returns
I2C_SLAVE_ACK_STATUS_RECEIVED_ACK - I2C master acknowledged the last byte
I2C_SLAVE_ACK_STATUS_RECEIVED_NAK - I2C master sent NAK
Example
bool APP_I2C_SLAVE_Callback ( I2C_SLAVE_TRANSFER_EVENT event, uintptr_t contextHandle ) { bool isSuccess = true; switch(event) { case I2C_SLAVE_TRANSFER_EVENT_ADDR_MATCH: transferDir = I2CSMB0_TransferDirGet(); break; case I2C_SLAVE_TRANSFER_EVENT_RX_READY: // handle RX ready event by reading the received data break; case I2C_SLAVE_TRANSFER_EVENT_TX_READY: if (I2CSMB0_LastByteAckStatusGet() == I2C_SLAVE_ACK_STATUS_RECEIVED_ACK) { // Last byte is ACK'd by I2C master. Continue writing more data. I2CSMB0_WriteByte(data); } else { // Last byte is NAK'd by I2C master. Transfer complete. } break; } }
Remarks
None