Updating libraries for atmega328 (adding it to a couple of #if's, etc.).

This commit is contained in:
David A. Mellis 2008-11-08 21:57:48 +00:00
parent 65b1e9225c
commit b2b32eb4f3
3 changed files with 6 additions and 6 deletions

View File

@ -141,7 +141,7 @@ extern FirmataClass Firmata;
#define setFirmwareVersion(x, y) setFirmwareNameAndVersion(__FILE__, x, y)
// total number of pins currently supported
#if defined(__AVR_ATmega168__) // Arduino NG and Diecimila
#if defined(__AVR_ATmega168__) || defined(__AVR_ATmega328P__) // Arduino NG and Diecimila
#define TOTAL_ANALOG_PINS 8
#define TOTAL_DIGITAL_PINS 22 // 14 digital + 8 analog
#define TOTAL_PORTS 3 // total number of ports for the board

View File

@ -40,10 +40,10 @@ void Servo::seizeTimer1()
ICR1 = clockCyclesPerMicrosecond()*(20000L/8); // 20000 uS is a bit fast for the refresh, 20ms, but
// it keeps us from overflowing ICR1 at 20MHz clocks
// That "/8" at the end is the prescaler.
#if defined(__AVR_ATmega168__)
TIMSK1 &= ~(_BV(OCIE1A) | _BV(OCIE1B) | _BV(TOIE1) );
#else
#if defined(__AVR_ATmega8__)
TIMSK &= ~(_BV(TICIE1) | _BV(OCIE1A) | _BV(OCIE1B) | _BV(TOIE1) );
#else
TIMSK1 &= ~(_BV(OCIE1A) | _BV(OCIE1B) | _BV(TOIE1) );
#endif
SREG = oldSREG; // undo cli()

View File

@ -64,7 +64,7 @@ void twi_init(void)
// initialize state
twi_state = TWI_READY;
#if defined(__AVR_ATmega168__) || defined(__AVR_ATmega8__)
#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);
@ -329,7 +329,7 @@ void twi_releaseBus(void)
twi_state = TWI_READY;
}
SIGNAL(SIG_2WIRE_SERIAL)
SIGNAL(TWI_vect)
{
switch(TW_STATUS){
// All Master