mchr3k / arduino-libs-manchester

173 stars 113 forks source link

Attiny2313 Support #16

Closed bkconrad closed 10 years ago

bkconrad commented 10 years ago

Hello,

I've got the library building for the atiny2313, however I can't get the chip to actually receive anything. I'm very new to AVR-C and I'm not sure if I've got a hardware or a software problem, so I was wondering if you (or anyone else) could verify the register flags I'm using:

#elif defined( __AVR_ATtinyX313__ )

#if F_CPU == 1000000UL
  TCCR1A = _BV(WGM12); // reset counter on match
  TCCR1B =  _BV(CS11); // 1/8 prescaler
  OCR1B = (64 >> speedFactor) - 1; 
#elif F_CPU == 8000000UL
// ...
#else
#error "Manchester library only supports 1mhz, 8mhz, 16mhz, 16.5Mhz clock speeds on ATtiny85 chip"
#endif

OCR1A = 0; // Trigger interrupt when TCNT1 is reset to 0
TIMSK |= _BV(OCIE1A); // Turn on interrupt
TCNT1 = 0; // Set counter to 0

I'm only using the 1Mhz clock rate for now, but once I get that working I'd be happy to get the constants for the other speeds.