[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: I2C ACK/NACK



On Friday 20 June 2003 17:51, Pieter Grimmerink wrote:
> In the I2C driver, there is a i2c_sendack(), but there is no
> i2c_sendnack().

Perhaps this would be slightly better:

void
i2c_sendnack(void)
{
	/*
	 * enable output
	 */
	i2c_delay(CLOCK_LOW_TIME);
	i2c_dir_out();

	/*
	 * set ack pulse low
	 */
	i2c_data(I2C_DATA_HIGH);

	/*
	 * generate clock pulse
	 */
	i2c_delay(CLOCK_HIGH_TIME/6);
	i2c_clk(I2C_CLOCK_HIGH);
	i2c_delay(CLOCK_HIGH_TIME);
	i2c_clk(I2C_CLOCK_LOW);

	i2c_delay(CLOCK_LOW_TIME);

	i2c_dir_in();
}

Regards,

Pieter