//////////////////////////////////////////////////////////////////////////////////////////// // File: i2cmsu.h // This code is provided by Dr. Robert Reese. // We thank him for the use of it. // // //////////////////////////////////////////////////////////////////////////////////////////// /* I2C Functions i2c_idle(); -- waits for idle condition on i2c interface i2c_start(); -- sends start and waits for finish of start i2c_rstart(); -- sends repeated start and waits for finish of repeated start extern i2c_stop(); -- sends stop and waits for finish of stop i2c_ack(unsigned char ackbit); -- do acknowledge i2c_putbyte(unsigned char byte); -- sends byte on i2c bus, check idle first i2c_put(unsigned char byte); -- same as previous, do not check idle i2c_put_noerr(unsigned char byte); -- do not reset on ack error unsigned char i2c_getbyte(unsigned char ackbit); -- read byte from i2c bus, do ack char i2c_ackerr; -- variable that tracks current operation void i2c_print_err(); -- print error message based on i2c_ackerr value These functions assume the WatchDogTimer is in operation, and that the i2c_ackerr variable can be used to identify which function was being executed if the WDT timer timeout within one of these functions. */ extern i2c_idle(); extern i2c_start(); extern i2c_rstart(); extern i2c_stop(); i2c_ack(unsigned char ackbit); extern unsigned char i2c_putbyte(unsigned char byte); extern unsigned char i2c_put(unsigned char byte); extern unsigned char i2c_put_noerr(unsigned char byte); extern unsigned char i2c_get(unsigned char ackbit); extern unsigned char i2c_getbyte(unsigned char ackbit); extern persistent char i2c_ackerr;