Using code and ideas from OpenDCC to create an AVR based DCC controller