/******************************************************************************* * Function Name: I2CS_I2CCyBtldrCommStart ****************************************************************************//** * * Starts the I2C component and enables its interrupt. * Every incoming I2C write transaction is treated as a command for the * bootloader. * Every incoming I2C read transaction returns 0xFF until the bootloader * provides a response to the executed command. * * \globalvars * I2CS_applyBuffer - the flag to release the buffer with a response * to be read by the host. * *******************************************************************************/ void I2CS_I2CCyBtldrCommStart(void) { I2CS_I2CSlaveInitWriteBuf(I2CS_slWriteBuf, I2CS_I2C_BTLDR_SIZEOF_WRITE_BUFFER); I2CS_I2CSlaveInitReadBuf (I2CS_slReadBuf, 0u); I2CS_SetCustomInterruptHandler(&I2CS_I2CResposeInsert); I2CS_applyBuffer = 0u; I2CS_Start(); }
/*! * @brief Initialiser I2C modulet. * @details Initailiser I2C komponent på PSoC'en. * @public * @memberof I2C * @author Jeppe Stærk ([email protected]) */ void i2c_init() { I2CS_I2CSlaveInitReadBuf(i2cTxBuffer, I2C_BUFFER_SIZE); I2CS_I2CSlaveClearReadBuf(); I2CS_I2CSlaveClearReadStatus(); I2CS_I2CSlaveInitWriteBuf(i2cRxBuffer, I2C_BUFFER_SIZE); I2CS_I2CSlaveClearWriteBuf(); I2CS_I2CSlaveClearWriteStatus(); I2CS_Start(); }