aboutsummaryrefslogtreecommitdiffstats
path: root/Demos/Device
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2009-04-14 12:07:41 +0000
committerDean Camera <dean@fourwalledcubicle.com>2009-04-14 12:07:41 +0000
commitecaf872177e771b6b7e331b47a5b68832b5dd126 (patch)
tree233b76b77d998ce10f3c82cc5d4d14d46dcd9d1f /Demos/Device
parent6a5a37d7d141f109dc02d0bb6d8f4757b533408d (diff)
downloadlufa-ecaf872177e771b6b7e331b47a5b68832b5dd126.tar.gz
lufa-ecaf872177e771b6b7e331b47a5b68832b5dd126.tar.bz2
lufa-ecaf872177e771b6b7e331b47a5b68832b5dd126.zip
Corrected AudioInput and AudioOutput demos, to fix endpoint underflows due to rounding in the sample reload timer.
Diffstat (limited to 'Demos/Device')
-rw-r--r--Demos/Device/AudioInput/AudioInput.c2
-rw-r--r--Demos/Device/AudioOutput/AudioOutput.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/Demos/Device/AudioInput/AudioInput.c b/Demos/Device/AudioInput/AudioInput.c
index b0c029573..fca24c360 100644
--- a/Demos/Device/AudioInput/AudioInput.c
+++ b/Demos/Device/AudioInput/AudioInput.c
@@ -95,7 +95,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
}
diff --git a/Demos/Device/AudioOutput/AudioOutput.c b/Demos/Device/AudioOutput/AudioOutput.c
index 0554361c6..ffeee418e 100644
--- a/Demos/Device/AudioOutput/AudioOutput.c
+++ b/Demos/Device/AudioOutput/AudioOutput.c
@@ -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