arduino-libs-manchester
arduino-libs-manchester copied to clipboard
Add support for ATTiny167
I need to use the library with the Attiny167 micro, I use the arduino core: ATTinyCore
But it does not take the micro model, I wanted to insert the code so that it recognizes it inside the library, but it does not work it continues giving error:
error: 'TCNT2' was not declared in this scope
Code.
#elif defined( __AVR_ATtiny167__) || defined(attinyx7)
/*
Timer 1 is used with a ATtiny87/167.
How to find the correct value: (OCRxA +1) = F_CPU / prescaler / 1953.125
OCR1A/B are 8 bit registers
*/
#if F_CPU == 1000000UL
TCCR1A = 0;
TCCR1B = _BV(WGM12) | _BV(CS11); // reset counter on match, 1/8 prescaler
OCR1A = (64 >> speedFactor) - 1;
#elif F_CPU == 8000000UL
TCCR1B = _BV(WGM12) | _BV(CS12) | _BV(CS11) | _BV(CS10); // 1/64 prescaler
OCR1A = (64 >> speedFactor) - 1;
#else
#error "Manchester library only supports 1mhz, 8mhz clock speeds on ATtiny87/167 chip"
#endif
OCR1B = 0; // Trigger interrupt when TCNT1 is reset to 0
TIMSK |= _BV(OCIE1B); // Turn on interrupt
TCNT1 = 0; // Set counter to 0
I don't know what's wrong, someone can help me.