- // How soon for the timer to go off?
- else if (TIMSK & (1 << OCIE0 | 1 << TOIE0)) {
- // force waiting for timer0 update (overflow glitches otherwise)
- TCCR0 = TCCR0;
- while (ASSR & (1 << TCN0UB | 1 << OCR0UB | 1 << TCR0UB))
- ;
- diff = OCR0 - TCNT0;
- if (diff < 16 || TCNT0 > 240)
- return ATM128_POWER_EXT_STANDBY;
- return ATM128_POWER_SAVE;
- }