The incomplete StandaloneProgrammer project now uses Host and Device Mass storage...
[pub/USBasp.git] / Demos / Device / ClassDriver / AudioInput / AudioInput.c
index 3aa26ae..9bd5fe4 100644 (file)
@@ -102,10 +102,10 @@ void ProcessNextSample(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
                Audio_Device_WriteSample16(&Microphone_Audio_Interface, AudioSample);\r
        }\r
@@ -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