AllJoyn/Samples/BACnetAdapter/bacnet-stack-0.8.2/ports/xplained/ASF/xmega/drivers/twi/twis.c
void TWI_SlaveAddressMatchHandler(TWI_Slave_t * twi)
{
    /* If application signalling need to abort (error occured). */
    if (twi->abort) {
        twi->interface->SLAVE.CTRLB = TWI_SLAVE_CMD_COMPTRANS_gc;
        TWI_SlaveTransactionFinished(twi, TWIS_RESULT_ABORTED);
        twi->abort = false;
    } else {
        twi->status = TWIS_STATUS_BUSY;
        twi->result = TWIS_RESULT_UNKNOWN;

        /* Disable stop interrupt. */
        uint8_t currentCtrlA = twi->interface->SLAVE.CTRLA;
        twi->interface->SLAVE.CTRLA = currentCtrlA & ~TWI_SLAVE_PIEN_bm;

        twi->bytesReceived = 0;
        twi->bytesSent = 0;

        /* Send ACK, wait for data interrupt. */
        twi->interface->SLAVE.CTRLB = TWI_SLAVE_CMD_RESPONSE_gc;
    }
}
/*! \brief TWI address match interrupt handler.
 *
 *  Prepares TWI module for transaction when an address match occurs.
 *
 *  \param twi The TWI_Slave_t struct instance.
 */
\brief TWI address match interrupt handler.
Prepares TWI module for transaction when an address match occurs.

\param twi The TWI_Slave_t struct instance.
\ brief TWI address match interrupt handler . Prepares TWI module for transaction when an address match occurs . \ param twi The TWI_Slave_t struct instance .
void TWI_SlaveAddressMatchHandler(TWI_Slave_t * twi)
{
    if (twi->abort) {
        twi->interface->SLAVE.CTRLB = TWI_SLAVE_CMD_COMPTRANS_gc;
        TWI_SlaveTransactionFinished(twi, TWIS_RESULT_ABORTED);
        twi->abort = false;
    } else {
        twi->status = TWIS_STATUS_BUSY;
        twi->result = TWIS_RESULT_UNKNOWN;
        uint8_t currentCtrlA = twi->interface->SLAVE.CTRLA;
        twi->interface->SLAVE.CTRLA = currentCtrlA & ~TWI_SLAVE_PIEN_bm;
        twi->bytesReceived = 0;
        twi->bytesSent = 0;
        twi->interface->SLAVE.CTRLB = TWI_SLAVE_CMD_RESPONSE_gc;
    }
}
void TWI_SlaveAddressMatchHandler ( TWI_Slave_t * twi ) { if ( twi -> abort ) { twi -> interface -> SLAVE . CTRLB = TWI_SLAVE_CMD_COMPTRANS_gc ; TWI_SlaveTransactionFinished ( twi , TWIS_RESULT_ABORTED ) ; twi -> abort = false ; } else { twi -> status = TWIS_STATUS_BUSY ; twi -> result = TWIS_RESULT_UNKNOWN ; uint8_t currentCtrlA = twi -> interface -> SLAVE . CTRLA ; twi -> interface -> SLAVE . CTRLA = currentCtrlA & ~ TWI_SLAVE_PIEN_bm ; twi -> bytesReceived = 0 ; twi -> bytesSent = 0 ; twi -> interface -> SLAVE . CTRLB = TWI_SLAVE_CMD_RESPONSE_gc ; } }
\brief TWI address match interrupt handler.
\ brief TWI address match interrupt handler .
/* If application signalling need to abort (error occured). */ /* Disable stop interrupt. */ /* Send ACK, wait for data interrupt. */