1.11.12.3 1.12.12.3 1.13.11.3 1.15.11.3 1.16.9.3 1.17.9.3 1.18.10.3 1.19.9.3 1.20.9.3 1.21.10.3 1.22.14.3 1.23.13.3 1.24.11.3 I2Cx_WriteByte Function

C

/* x = I2C instance number */

/* I2C slave mode */
void I2Cx_WriteByte(uint8_t wrByte)

Summary

Write a data byte to I2C master

Description

This function writes a data byte to be sent to the I2C master

Precondition

I2Cx_Initialize must have been called for the associated I2C instance.

Parameters

Param Description
wrByte Data byte to be written.

Returns

None

Example

bool APP_I2C_SLAVE_Callback ( I2C_SLAVE_TRANSFER_EVENT event, uintptr_t contextHandle )
{
    switch(event)
    {
        case I2C_SLAVE_TRANSFER_EVENT_ADDR_MATCH:
        // Handle address match event
        break;
        
        case I2C_SLAVE_TRANSFER_EVENT_RX_READY:
        
        // Read the received data byte
        rxData = I2C1_ReadByte();
        
        break;
        case I2C_SLAVE_TRANSFER_EVENT_TX_READY:
        
        // Provide data to I2C master
        I2C1_WriteByte(txData);
        
        break;
        
        case I2C_SLAVE_TRANSFER_EVENT_STOP_BIT_RECEIVED:
        // Handle stop bit received event
        break;
    }
}

Remarks

None