void SkI2cStop( SK_IOC IoC) /* I/O Context */ { /* Init data and Clock to output lines */ /* Set Data low */ I2C_DATA_OUT(IoC); I2C_DATA_LOW(IoC); SkDgWaitTime(IoC, NS2BCLK(T_CLK_2_DATA_OUT)); /* Set Clock high */ I2C_CLK_HIGH(IoC); SkDgWaitTime(IoC, NS2BCLK(T_STOP_SETUP)); /* * Set Data High: Do it by setting the Data Line to Input. * Because of a pull up resistor the Data Line * floods to high. */ I2C_DATA_IN(IoC); /* * When I2C activity is stopped * o DATA should be set to input and * o CLOCK should be set to high! */ SkDgWaitTime(IoC, NS2BCLK(T_BUS_IDLE)); } /* SkI2cStop */
/* * sending one bit */ void SkI2cSndBit( SK_IOC IoC, /* I/O Context */ SK_U8 Bit) /* Bit to send */ { I2C_DATA_OUT(IoC); if (Bit) { I2C_DATA_HIGH(IoC); } else { I2C_DATA_LOW(IoC); } SkDgWaitTime(IoC, NS2BCLK(T_DATA_IN_SETUP)); I2C_CLK_HIGH(IoC); SkDgWaitTime(IoC, NS2BCLK(T_CLK_HIGH)); I2C_CLK_LOW(IoC); } /* SkI2cSndBit*/
/* * Signal a start to the I2C Bus. * * A start is signaled when data goes to low in a high clock cycle. * * Ends with Clock Low. * * Status: not tested */ void SkI2cStart( SK_IOC IoC) /* I/O Context */ { /* Init data and Clock to output lines */ /* Set Data high */ I2C_DATA_OUT(IoC); I2C_DATA_HIGH(IoC); /* Set Clock high */ I2C_CLK_HIGH(IoC); SkDgWaitTime(IoC, NS2BCLK(T_START_SETUP)); /* Set Data Low */ I2C_DATA_LOW(IoC); SkDgWaitTime(IoC, NS2BCLK(T_START_HOLD)); /* Clock low without Data to Input */ I2C_START_COND(IoC); SkDgWaitTime(IoC, NS2BCLK(T_CLK_LOW)); } /* SkI2cStart */