1.27.5.61 FLEXCOMx_TWI_ReadByte Function

C

/* x = FLEXCOM instance number */

/* TWI slave mode */
uint8_t FLEXCOMx_TWI_ReadByte(void)

Summary

Read the received TWI byte

Description

This function returns the TWI data byte.

Precondition

FLEXCOMx_TWI_Initialize must have been called for the associated FLEXCOM TWI instance.

Parameters

None.

Returns

The data byte present in the data buffer.

Example

void APP_FLEXCOM_TWI_Callback ( FLEXCOM_TWI_SLAVE_TRANSFER_EVENT event, uintptr_t contextHandle )
{
    switch(event)
    {
        case FLEXCOM_TWI_SLAVE_TRANSFER_EVENT_ADDR_MATCH:
        // Handle address match event
        break;
        
        case FLEXCOM_TWI_SLAVE_TRANSFER_EVENT_RX_READY:
        
        // Read the received data byte
        rxData = FLEXCOM0_TWI_ReadByte();
        
        break;
        case FLEXCOM_TWI_SLAVE_TRANSFER_EVENT_TX_READY:
        
        // Provide data to TWI master
        FLEXCOM0_TWI_WriteByte(txData);
        
        break;
        
        case FLEXCOM_TWI_SLAVE_TRANSFER_EVENT_TRANSMISSION_COMPLETE:
        // Handle stop bit received event
        break;
    }
}

Remarks

None.