diff --git a/libraries/Wire/utility/twi.c b/libraries/Wire/utility/twi.c index cef8373a8..120d77a27 100644 --- a/libraries/Wire/utility/twi.c +++ b/libraries/Wire/utility/twi.c @@ -32,6 +32,7 @@ #define sbi(sfr, bit) (_SFR_BYTE(sfr) |= _BV(bit)) #endif +#include "pins_arduino.h" #include "twi.h" static volatile uint8_t twi_state; @@ -63,18 +64,10 @@ void twi_init(void) { // initialize state twi_state = TWI_READY; - - #if defined(__AVR_ATmega168__) || defined(__AVR_ATmega8__) || defined(__AVR_ATmega328P__) - // activate internal pull-ups for twi - // as per note from atmega8 manual pg167 - sbi(PORTC, 4); - sbi(PORTC, 5); - #else - // activate internal pull-ups for twi - // as per note from atmega128 manual pg204 - sbi(PORTD, 0); - sbi(PORTD, 1); - #endif + + // activate internal pullups for twi. + digitalWrite(SDA, 1); + digitalWrite(SCL, 1); // initialize twi prescaler and bit rate cbi(TWSR, TWPS0);