src-avr: Run CPU at 8MHz, even with a 16MHz xtal
[fw/altos] / src-avr / ao_timer.c
index f0918a7d68da066064725937bf5893df65778844..aec404750f308b3d95af12f81b5da667f9666385 100644 (file)
@@ -140,7 +140,13 @@ ao_clock_init(void)
        /* Disable the clock prescaler */
        cli();
        CLKPR = (1 << CLKPCE);
+
+       /* Always run the system clock at 8MHz */
+#if AVR_CLOCK > 12000000UL
+       CLKPR = 1;
+#else
        CLKPR = 0;
+#endif
        sei();
 
        /* Set up the PLL to use the crystal */