Make Audio device demos compatible with AVRs running at 16MHz instead of 8MHz.
[pub/USBasp.git] / Demos / Device / ClassDriver / AudioInput / AudioInput.c
index 3aa26ae..cf9d3b4 100644 (file)
@@ -117,9 +117,9 @@ void EVENT_USB_Device_Connect(void)
        LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);\r
 \r
        /* Sample reload timer initialization */\r
-       OCR0A   = (F_CPU / AUDIO_SAMPLE_FREQUENCY) - 1;\r
+       OCR0A   = (F_CPU / 8 / AUDIO_SAMPLE_FREQUENCY) - 1;\r
        TCCR0A  = (1 << WGM01);  // CTC mode\r
-       TCCR0B  = (1 << CS00);   // Fcpu speed\r
+       TCCR0B  = (1 << CS01);   // Fcpu/8 speed\r
 }\r
 \r
 /** Event handler for the library USB Disconnection event. */\r