1.8.7.61 1.25.6.61 1.26.5.61 1.27.5.61 1.28.6.61 1.36.7.59 1.41.5.61 1.42.3.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.