Commit fea5d085 authored by Dean Camera's avatar Dean Camera
Browse files

Adjusted sample CTC timer calculations in the AudioOutput and AudioInput demos...

Adjusted sample CTC timer calculations in the AudioOutput and AudioInput demos to account for situations where the division results in a value with no remainder, requiring one to be subtracted from the result (thanks to Robin Theunis).
parent af02b5b0
...@@ -95,7 +95,7 @@ EVENT_HANDLER(USB_Connect) ...@@ -95,7 +95,7 @@ EVENT_HANDLER(USB_Connect)
UpdateStatus(Status_USBEnumerating); UpdateStatus(Status_USBEnumerating);
/* Sample reload timer initialization */ /* Sample reload timer initialization */
OCR0A = (F_CPU / AUDIO_SAMPLE_FREQUENCY); OCR0A = (F_CPU / AUDIO_SAMPLE_FREQUENCY) - ((F_CPU % AUDIO_SAMPLE_FREQUENCY) == 0 ? 1 : 0);
TCCR0A = (1 << WGM01); // CTC mode TCCR0A = (1 << WGM01); // CTC mode
TCCR0B = (1 << CS00); // Fcpu speed TCCR0B = (1 << CS00); // Fcpu speed
} }
......
...@@ -90,7 +90,7 @@ EVENT_HANDLER(USB_Connect) ...@@ -90,7 +90,7 @@ EVENT_HANDLER(USB_Connect)
UpdateStatus(Status_USBEnumerating); UpdateStatus(Status_USBEnumerating);
/* Sample reload timer initialization */ /* Sample reload timer initialization */
OCR0A = (F_CPU / AUDIO_SAMPLE_FREQUENCY); OCR0A = (F_CPU / AUDIO_SAMPLE_FREQUENCY) - ((F_CPU % AUDIO_SAMPLE_FREQUENCY) == 0 ? 1 : 0);
TCCR0A = (1 << WGM01); // CTC mode TCCR0A = (1 << WGM01); // CTC mode
TCCR0B = (1 << CS00); // Fcpu speed TCCR0B = (1 << CS00); // Fcpu speed
......
...@@ -29,6 +29,8 @@ ...@@ -29,6 +29,8 @@
* - Fixed GenericHID demo not starting USB and HID management tasks when not using interrupt driven modes (thanks to Carl Kjeldsen) * - Fixed GenericHID demo not starting USB and HID management tasks when not using interrupt driven modes (thanks to Carl Kjeldsen)
* - Fixed RNDISEthenet demo checking the incorrect message field for packet size constraints (thanks to Jonathan) * - Fixed RNDISEthenet demo checking the incorrect message field for packet size constraints (thanks to Jonathan)
* - Fixed WriteNextReport code in the GenericHIDHost demo using incorrect parameter types and not selecting the correct endpoint * - Fixed WriteNextReport code in the GenericHIDHost demo using incorrect parameter types and not selecting the correct endpoint
* - Adjusted sample CTC timer calculations in the AudioOutput and AudioInput demos to account for situations where the division results
* in a value with no remainder, requiring one to be subtracted from the result (thanks to Robin Theunis)
* *
* \section Sec_ChangeLog090401 Version 090401 * \section Sec_ChangeLog090401 Version 090401
* *
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment