1.1.11.20 I2CSMBx_HostTransferSetup Function

C

/* x = I2C SMBUS peripheral instance number */

/* I2C SMBUS Host mode */
bool I2CSMBx_HostTransferSetup(I2C_SMB_HOST_TRANSFER_SETUP* setup, uint32_t srcClkFreq )

Summary

Dynamic setup of I2C Peripheral in SMBUS host mode.

Description

This API is generally used when there are multiple clients on the same I2C bus having different I2C clock speed. In such a case, the I2CSMBx_HostTransferSetup API must be called to set the appropriate I2C bus speed before starting the I2C transfer.

Precondition

I2CSMBx_Initialize must have been called for the associated I2C instance. The transfer status should not be busy.

Parameters

Param Description
setup Pointer to the structure containing the transfer setup.
srcClkFreq I2C Peripheral Clock Source Frequency.

Returns

true - Transfer setup was updated Successfully.

false - Failure while updating transfer setup.

Example

I2C_TRANSFER_SETUP setup;

setup.clkSpeed = 400000;

if (I2CSMB0_TransferSetup( &setup, 0 ) == true)
{
    // Transfer Setup updated successfully
}

Remarks

srcClkFreq overrides any change in the peripheral clock frequency. If configured to zero PLIB takes the peripheral clock frequency from MCC.