diff --git a/Makefile b/Makefile index 76a898b..7f25d98 100644 --- a/Makefile +++ b/Makefile @@ -22,7 +22,7 @@ MCU=attiny85 # TARGET_PLATFORM=m328p # for attiny85 TARGET_PLATFORM=t85 -USB_PORT=usb:001:013 +USB_PORT=usb:001:006 LD_FLAGS=-DF_CPU=$(CLOCK_FREQ) diff --git a/src/driver/i2c.c b/src/driver/i2c.c index 2d77605..3f87e5a 100644 --- a/src/driver/i2c.c +++ b/src/driver/i2c.c @@ -56,7 +56,7 @@ bool i2c_start() { // ensure both lines are high i2c_port |= (_BV(i2c_sda) | _BV(i2c_scl)); // wait till clock pin is high - while (!(i2c_pin & _BV(i2c_scl))); + while (!(i2c_port & _BV(i2c_scl))); _delay_us(T2_TWI); // pull data line low @@ -104,7 +104,7 @@ unsigned char transfer(unsigned char mask) { // wait short _delay_us(T4_TWI); // toggle clock again - i2c_control = _BV(USITC); + i2c_control |= _BV(USITC); } while (!(i2c_status & _BV(USIOIF))); _delay_us(T2_TWI);