Timer and timebase code for the Atmel ATmega328P.