1.36.7.54 FLEXCOMx_TWI_WriteByte Function
C
/* x = FLEXCOM instance number */
/* TWI slave mode */
void FLEXCOMx_TWI_WriteByte(uint8_t wrByte)
Summary
Write a data byte to TWI master
Description
This function writes a data byte to be sent to the TWI master
Precondition
FLEXCOMx_TWI_Initialize must have been called for the associated FLEXCOM TWI instance.
Parameters
Param | Description |
---|---|
wrByte | Data byte to be written. |
Returns
None
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