diff options
Diffstat (limited to 'libraries/Wire/utility/twi.c')
-rw-r--r-- | libraries/Wire/utility/twi.c | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/libraries/Wire/utility/twi.c b/libraries/Wire/utility/twi.c index cef8373..d80114b 100644 --- a/libraries/Wire/utility/twi.c +++ b/libraries/Wire/utility/twi.c @@ -23,6 +23,7 @@ #include <avr/io.h> #include <avr/interrupt.h> #include <compat/twi.h> +#include "Arduino.h" // for digitalWrite #ifndef cbi #define cbi(sfr, bit) (_SFR_BYTE(sfr) &= ~_BV(bit)) @@ -32,6 +33,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 +65,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); |