Dasilib is “Dave’s Simple Library” containing a number of useful things for the AVR ATMega Microcontroller. The source code is here.