"An idle timeout is also implemented which send a spacebar keystroke after 8 seconds of inactivity. "
=D You need to learn some c. Don't bother with the ++.
Edit: if you cut these parts out you should get rid of the spaces
// Configure timer 0 to generate a timer overflow interrupt every
// 256*1024 clock cycles, or approx 61 Hz when using 16 MHz clock
// This demonstrates how to use interrupts to implement a simple
// inactivity timeout.
TCCR0A = 0x00;
TCCR0B = 0x05;
TIMSK0 = (1<<TOIE0);
// if any keypresses were detected, reset the idle counter
if (reset_idle) {
// variables shared with interrupt routines must be
// accessed carefully so the interrupt routine doesn't
// try to use the variable in the middle of our access
cli();
idle_count = 0;
sei();
}
// This interrupt routine is run approx 61 times per second.
// A very simple inactivity timeout is implemented, where we
// will send a space character.
ISR(TIMER0_OVF_vect)
{
idle_count++;
if (idle_count > 61 * 8) {
idle_count = 0;
usb_keyboard_press(KEY_SPACE, 0);
}
}
As well as anything involving "reset_idle"