Software I2C Master Component for PSoC 3/4/5

Version 1

    Attached file contains the implementation of a software I2C Master component, which does not require any UDB or Fixed-Function block. It implements non-blocking functions to write and read i2c packets without using any interrupt. The user needs to call a "process" function to move on with the i2c packet. Here is an example on how to use this component in the main loop:

     

    SW_I2C_WriteBuf(I2C_SLAVE_ADDR, i2cBuffer, PACKET_SIZE, SW_I2C_MODE_COMPLETE_XFER);
    
    for(;;)
        {     
            status = SW_I2C_Process();
    
            if ((status & SW_I2C_MSTAT_WR_CMPLT) != 0)
            {   
                /* Do something */                
            }
            
            if ((status & SW_I2C_MSTAT_RD_CMPLT) != 0)
            {
                /* Do something */   
            }
    
             CyDelayUs(5);
        }
    

     

    To use the attached file, follow the steps from this video.

     

    This is NOT an official release from Cypress. Use it on your own risk.