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.
This commit is contained in:
Embedded Innovation
2016-07-17 10:28:00 +02:00
committed by Olivier
parent 1305aeca8a
commit 83cbb921f5
+2 -2
View File
@@ -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;
}