John-Lluch / Encoder

Arduino Rotary Encoder library using fast timer interrupts that actually works
19 stars 3 forks source link

ATMega328 not supported? #1

Open solidifier opened 5 years ago

solidifier commented 5 years ago

See below for errors I get.

I'm pretty sure that these problems are because I'm trying to use it on an Arduino Nano. However, I'm not 100% sure as I still get other errors when compiling for Arduino Mega. Does it also require another timer library to be included?

Anyway, it would be nice to have something in the Readme about what board it requires and maybe a complete example with includes.

......

Arduino: 1.8.9 (Mac OS X), Board: "Arduino Nano, ATmega328P (Old Bootloader)"

Build options changed, rebuilding all sketch/Encoder.cpp: In function 'void setupTimerInterrupt()': Encoder.cpp:12:3: error: 'TCCR3A' was not declared in this scope TCCR3A = 0; // set entire TCCR3A register to 0 ^ Encoder.cpp:13:3: error: 'TCCR3B' was not declared in this scope TCCR3B = 0; // same for TCCR3B ^ Encoder.cpp:14:3: error: 'TCNT3' was not declared in this scope TCNT3 = 0; //initialize counter value to 0 ^ Encoder.cpp:17:3: error: 'OCR3AH' was not declared in this scope OCR3AH = 0; ^ Encoder.cpp:23:3: error: 'OCR3AL' was not declared in this scope OCR3AL = INTERRUPT_PERIOD; ^ Encoder.cpp:26:3: error: 'TIMSK3' was not declared in this scope TIMSK3 = (1 << OCIE3A); ^ Encoder.cpp:26:18: error: 'OCIE3A' was not declared in this scope TIMSK3 = (1 << OCIE3A); ^ Encoder.cpp:29:19: error: 'WGM32' was not declared in this scope TCCR3B |= (1 << WGM32); ^ Encoder.cpp:32:19: error: 'CS30' was not declared in this scope TCCR3B |= (1 << CS30) | (1 << CS31); ^ Encoder.cpp:32:33: error: 'CS31' was not declared in this scope TCCR3B |= (1 << CS30) | (1 << CS31); ^ exit status 1 'TCCR3A' was not declared in this scope

This report would have more information with "Show verbose output during compilation" option enabled in File -> Preferences.

chrismolloy commented 3 years ago

did you resolve this? I have same issue with nano

John-Lluch commented 3 years ago

Please can you test if this works now. I just have added support for ATmega328P, using timer 2