Platform/ECM3532/DSP/hw/csp/ecm3532/src/eta_csp_i2c.c
/***************************************************************************/
/**
 *
 * EtaCspI2cDeviceAck - Read and or write to an I2C device.
 *
 * @param ui8TxData DevAddr and Read(write not) of device to poll for ack
 * @return Return the status.
 *
 ******************************************************************************/
Read and or write to an I2C device.
@param ui8TxData DevAddr and Read(write not) of device to poll for ack
@return Return the status.
Read and or write to an I2C device . @param ui8TxData DevAddr and Read ( write not ) of device to poll for ack @return Return the status .
tEtaStatus
EtaCspI2cDeviceAck(uint8_t ui8TxData)
{
    tEtaStatus result = eEtaSuccess;
    REG_I2C2_CONFIG = (REG_I2C2_CONFIG & ~BM_I2C2_CONFIG_IGNORE_NACK) |
                      (1 << BP_I2C2_CONFIG_IGNORE_NACK);
    result |= EtaCspI2cTransferPoll(&ui8TxData, 1, &ui8TxData, 0, 1);
    result |= EtaCspI2cDonePoll();
    REG_I2C2_CONFIG = (REG_I2C2_CONFIG & ~BM_I2C2_CONFIG_IGNORE_NACK) |
                      (0 << BP_I2C2_CONFIG_IGNORE_NACK);
    if(result)
    {
        return(eEtaFailure);
    }
    if(REG_I2C2_GENERAL_DEBUG & BM_I2C2_GENERAL_DEBUG_LAST_BYTE_HAD_NACK)
    {
        result = eEtaI2cUnexpectedNack;
    }
    else
    {
        result = eEtaSuccess;
    }
    return(result);
}
tEtaStatus EtaCspI2cDeviceAck ( uint8_t ui8TxData ) { tEtaStatus result = eEtaSuccess ; REG_I2C2_CONFIG = ( REG_I2C2_CONFIG & ~ BM_I2C2_CONFIG_IGNORE_NACK ) | ( 1 << BP_I2C2_CONFIG_IGNORE_NACK ) ; result |= EtaCspI2cTransferPoll ( & ui8TxData , 1 , & ui8TxData , 0 , 1 ) ; result |= EtaCspI2cDonePoll ( ) ; REG_I2C2_CONFIG = ( REG_I2C2_CONFIG & ~ BM_I2C2_CONFIG_IGNORE_NACK ) | ( 0 << BP_I2C2_CONFIG_IGNORE_NACK ) ; if ( result ) { return ( eEtaFailure ) ; } if ( REG_I2C2_GENERAL_DEBUG & BM_I2C2_GENERAL_DEBUG_LAST_BYTE_HAD_NACK ) { result = eEtaI2cUnexpectedNack ; } else { result = eEtaSuccess ; } return ( result ) ; }
EtaCspI2cDeviceAck - Read and or write to an I2C device.
EtaCspI2cDeviceAck - Read and or write to an I2C device .
// Turn off NACK hold // upper 7 is device id, lower bit is Read (write not) // Turn back on NACK hold