Additional file renames and modifications to change CDC demos to VirtualSerial.
[pub/USBasp.git] / Demos / Device / LowLevel / AudioInput / AudioInput.c
index a01c672..a61ff59 100644 (file)
@@ -84,9 +84,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 USB_Disconnect event. This indicates that the device is no longer connected to a host via\r
@@ -169,10 +169,10 @@ void USB_Audio_Task(void)
                /* Audio sample is ADC value scaled to fit the entire range */\r
                int16_t AudioSample = ((SAMPLE_MAX_RANGE / ADC_MAX_RANGE) * ADC_GetResult());\r
                \r
-#if defined(MICROPHONE_BIASED_TO_HALF_RAIL)\r
+               #if defined(MICROPHONE_BIASED_TO_HALF_RAIL)\r
                /* Microphone is biased to half rail voltage, subtract the bias from the sample value */\r
                AudioSample -= (SAMPLE_MAX_RANGE / 2));\r
-#endif\r
+               #endif\r
 \r
                /* Write the sample to the buffer */\r
                Endpoint_Write_Word_LE(AudioSample);\r