Corrected AudioInput and AudioOutput demos, to fix endpoint underflows due to rounding in the sample reload timer.

This commit is contained in:
Dean Camera 2009-04-14 12:07:41 +00:00
parent 6a5a37d7d1
commit ecaf872177
3 changed files with 4 additions and 4 deletions

View file

@ -90,7 +90,7 @@ EVENT_HANDLER(USB_Connect)
UpdateStatus(Status_USBEnumerating);
/* Sample reload timer initialization */
OCR0A = (F_CPU / AUDIO_SAMPLE_FREQUENCY) - ((F_CPU % AUDIO_SAMPLE_FREQUENCY) == 0 ? 1 : 0);
OCR0A = (F_CPU / AUDIO_SAMPLE_FREQUENCY) - 1;
TCCR0A = (1 << WGM01); // CTC mode
TCCR0B = (1 << CS00); // Fcpu speed