1.17.9.10 I2Cx_IsBusy Function

C

/* x = I2C instance number */

/* I2C master mode and slave mode */

bool I2Cx_IsBusy(void)

Summary

Returns the Peripheral busy status.

Description

I2C master mode

In master mode, this function returns true if the I2Cx module is busy with a transfer. The application can use this function to check if I2Cx module is busy before calling any of the data transfer functions. The library does not allow a data transfer operation if another transfer operation is already in progress.

I2C slave mode

In slave mode, the function returns true if a start bit has been detected last on the bus by the peripheral. The application can use this API to ensure no I2C transfer is in progress.

Precondition

I2Cx_Initialize must have been called for the associated I2C instance.

Parameters

None.

Returns

true - Busy

false - Not busy

Example

// wait for the current transfer to complete
while(I2C1_IsBusy());

Remarks

None.