From 83cbb921f513d7e87cdca4a9baf40f8b7d1465e8 Mon Sep 17 00:00:00 2001 From: Embedded Innovation Date: Sun, 17 Jul 2016 10:28:00 +0200 Subject: [PATCH] Unify interrupt handling (#520) ATMega328 hardware abstraction used a mix of AVR cli/sei and Arduino noInterrupts/interrupts calls. Changed to use AVR cli/sei only. --- core/MyHwATMega328.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/MyHwATMega328.cpp b/core/MyHwATMega328.cpp index 11e0912..349e775 100644 --- a/core/MyHwATMega328.cpp +++ b/core/MyHwATMega328.cpp @@ -161,7 +161,7 @@ uint16_t hwCPUVoltage() { } uint16_t hwCPUFrequency() { - noInterrupts(); + cli(); // setup timer1 TIFR1 = 0xFF; TCNT1 = 0; @@ -183,7 +183,7 @@ uint16_t hwCPUFrequency() { wdt_reset(); WDTCSR |= (1 << WDCE) | (1 << WDE); WDTCSR = WDTsave; - interrupts(); + sei(); // return frequency in 1/10MHz (accuracy +- 10%) return TCNT1 * 2048UL / 100000UL; }