File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -49,8 +49,7 @@ constexpr int32_t MAXIRQTICKSCCYS = microsecondsToClockCycles(10000);
49
49
// Maximum servicing time for any single IRQ
50
50
constexpr uint32_t ISRTIMEOUTCCYS = microsecondsToClockCycles(18 );
51
51
// The latency between in-ISR rearming of the timer and the earliest firing
52
- constexpr int32_t IRQLATENCYCCYS = clockCyclesPerMicrosecond() == 160 ?
53
- microsecondsToClockCycles (1 ) >> 1 : microsecondsToClockCycles(1 );
52
+ constexpr int32_t IRQLATENCYCCYS = microsecondsToClockCycles(1 );
54
53
55
54
// for INFINITE, the NMI proceeds on the waveform without expiry deadline.
56
55
// for EXPIRES, the NMI expires the waveform automatically on the expiry ccy.
@@ -406,12 +405,17 @@ static ICACHE_RAM_ATTR void timer1Interrupt() {
406
405
nextTimerCcys = callbackCcys;
407
406
}
408
407
408
+ // Timer is 80MHz fixed. 160MHz CPU frequency need scaling.
409
+ constexpr bool cpuFreq160MHz = clockCyclesPerMicrosecond () == 160 ;
410
+ if (cpuFreq160MHz || CPU2X & 1 ) {
411
+ nextTimerCcys >>= 1 ;
412
+ }
413
+
409
414
// Firing timer too soon, the NMI occurs before ISR has returned.
410
415
if (nextTimerCcys <= IRQLATENCYCCYS) {
411
416
nextTimerCcys = IRQLATENCYCCYS;
412
417
}
413
418
414
419
// Register access is fast and edge IRQ was configured before.
415
- // Timer is 80MHz fixed. 160MHz binaries need scaling.
416
- T1L = (CPU2X & 1 ) ? nextTimerCcys >> 1 : nextTimerCcys;
420
+ T1L = nextTimerCcys;
417
421
}
You can’t perform that action at this time.
0 commit comments