src-avr: Run CPU at 8MHz, even with a 16MHz xtal
authorKeith Packard <keithp@keithp.com>
Sun, 5 Jun 2011 00:58:51 +0000 (17:58 -0700)
committerKeith Packard <keithp@keithp.com>
Sun, 5 Jun 2011 00:58:51 +0000 (17:58 -0700)
This allows the Teensy to run at 3.3V.

Signed-off-by: Keith Packard <keithp@keithp.com>
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 */