1234567891011121314151617181920212223242526272829303132333435363738 |
- #ifndef I2C_H
- #define I2C_H
- /**** I2C bitbanging support ****/
- // clock line port
- //#define SCLPORT PORTB // i2c clock port
- #define SCLDDR DDRC // i2c clock port direction
- #define SCLPIN PINC
- // data line port
- //#define SDAPORT PORTB // i2c data port
- #define SDADDR DDRC // i2c data port direction
- #define SDAPIN PINC // i2c data port input
- // pin assignments
- #define SCL _BV(PC0) // i2c clock pin
- #define SDA _BV(PC1) // i2c data pin
- // defines and constants
- #define READ 0x01 // I2C READ bit
- // functions
- // initialize I2C interface pins
- //void i2cInit(void);
- // send I2C data to <device> register
- void i2cSend(unsigned char reg, unsigned char length, unsigned char *data, unsigned char device);
- // receive I2C data from <device> register
- void i2cReceive(unsigned char reg, unsigned char length, unsigned char *data, unsigned char device);
- unsigned char i2cPutbyte(unsigned char b);
- unsigned char i2cGetbyte(unsigned char notlast);
- void istart(void);
- void istop(void);
- #endif
|