1.32.26.67 SERCOMx_I2C_IsBusy Function

C

/* x = SERCOM instance number */

/* I2C master mode and slave in interrupt mode */

bool SERCOMx_I2C_IsBusy(void)	

Summary

Returns the Peripheral busy status

Description

I2C master mode

In master mode, this function returns true if the FLEXCOMx TWI module is busy with a transfer. The application can use this function to check if FLEXCOMx TWI 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 as soon as the address match event occurs and returns false after a STOP bit has been detected. The application can use this API to ensure no TWI transfer is in progress.

Precondition

SERCOMx_I2C_Initialize must have been called for the associated SERCOM instance.

Parameters

None.

Returns

Param Description
true Busy
false Not busy

Example

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

Remarks

None.