From 0ba051569c05b34631b60221d42b82bdbcba8a59 Mon Sep 17 00:00:00 2001 From: DashyFox Date: Fri, 15 Mar 2024 15:19:26 +0300 Subject: [PATCH] OCR2A cleanup code --- IR_Encoder.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/IR_Encoder.h b/IR_Encoder.h index b25c3dd..0e34f89 100644 --- a/IR_Encoder.h +++ b/IR_Encoder.h @@ -33,11 +33,9 @@ public: TCCR2A |= (1 << WGM21); // Clear Timer On Compare (Сброс по совпадению) TCCR2B |= (1 << CS20); // Предделитель 1 TIMSK2 |= (1 << OCIE2A); // Прерывание по совпадению - #if F_CPU == 16000000 + OCR2A = /* 465 */((F_CPU / (38000 * 2)) - 2); //38кГц - #elif F_CPU == 8000000 - OCR2A = ((F_CPU / (38000 * 2)) - 2); //38кГц Частота_мк / (Предделитель * Частота * 2) - #endif + SREG = oldSREG; // Return interrupt settings }