1.2.21.58 1.3.25.58 1.4.21.58 1.5.25.58 1.6.22.58 1.7.23.58 1.9.19.58 1.29.23.58 1.30.18.58 1.31.18.58 1.32.26.58 1.33.16.58 1.37.18.58 1.38.21.58 1.39.18.58 1.40.20.58 SERCOMx_I2C_WriteByte Function

C

/* x = SERCOM instance number */

/* I2C slave mode */

void SERCOMx_I2C_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

SERCOMx_I2C_Initialize must have been called for the associated SERCOM I2C instance

Parameters

Param Description
wrByte Data byte to be written.

Returns

None

Example

bool APP_SERCOM_I2C_Callback ( SERCOM_I2C_SLAVE_TRANSFER_EVENT event, uintptr_t contextHandle )
{
    switch(event)
    {
        case SERCOM_I2C_SLAVE_TRANSFER_EVENT_ADDR_MATCH:
        // Handle address match event
        break;
        
        case SERCOM_I2C_SLAVE_TRANSFER_EVENT_RX_READY:
        
        // Read the received data byte
        rxData = SERCOM0_I2C_ReadByte();
        
        break;
        case SERCOM_I2C_SLAVE_TRANSFER_EVENT_TX_READY:
        
        // Provide data to I2C master
        SERCOM0_I2C_WriteByte(txData);
        
        break;
        
        case SERCOM_I2C_SLAVE_TRANSFER_EVENT_STOP_BIT_RECEIVED:
        // Handle stop bit received event
        break;
    }
}

Remarks

None.