inline uint16_t timer_elapsed(uint16_t last) { uint32_t t; uint8_t sreg = SREG; cli(); t = timer_count; SREG = sreg; return TIMER_DIFF_16((t & 0xFFFF), last); }
inline bool has_oneshot_layer_timed_out() { return TIMER_DIFF_16(timer_read(), oneshot_layer_time) >= ONESHOT_TIMEOUT && !(get_oneshot_layer_state() & ONESHOT_TOGGLED); }
uint16_t timer_elapsed(uint16_t last) { return TIMER_DIFF_16(timer_read(), last); }
bool has_oneshot_mods_timed_out(void) { return TIMER_DIFF_16(timer_read(), oneshot_time) >= ONESHOT_TIMEOUT; }