Our company uses a few types of PSoC5 and 4 devices with projects sharing a common code-base for the I2C protocol. With the same instance name for the I2C component, the function names are inherently different between the two families.
Are there any novel suggestions or ideas to keep the function names similar between PSoC families? Thought below of possibly redefining the PSoC5 function names??
#if (ProjType == Project1)
#if (ProjType == Project2)
#define I2C_R_I2CSlaveInitReadBuf I2C_R_SlaveInitReadBuf
#define I2C_R_I2CSlaveInitWriteBuf I2C_R_SlaveInitWriteBuf
#define I2C_R_I2C_SSTAT_WR_CMPLT I2C_R_SSTAT_WR_CMPLT
#define I2C_R_I2CSlaveStatus I2C_R_SlaveStatus
#define I2C_R_I2CSlaveGetWriteBufSize I2C_R_SlaveGetWriteBufSize
#define I2C_R_I2CSlaveClearWriteBuf I2C_R_SlaveClearWriteBuf
#define I2C_R_I2CSlaveClearWriteStatus I2C_R_SlaveClearWriteStatus
#define I2C_R_I2C_SSTAT_RD_CMPLT I2C_R_SSTAT_RD_CMPLT
#define I2C_R_I2CSlaveClearReadBuf I2C_R_SlaveClearReadBuf
#define I2C_R_I2CSlaveClearReadStatus I2C_R_SlaveClearReadStatus
With Best Regards
Your #defines will solve your problem, but I would suggest to use in #if conditions as CY_PSOC4 or CY_PSOC5 to be independent from the project. The conditions you find in Creator -> Help -> System Reference Guides.