From b36936d7491056fe89aa7a00180bd06a03884a05 Mon Sep 17 00:00:00 2001 From: Dean Date: Tue, 28 Jul 2009 10:46:20 +0000 Subject: Changed AudioOutput demos to explicitly use timer 3 - the smaller USB AVRs where timer 1 was needed instead did not have the endpoint size neccesary for good audio throughput anyway. Fix Benito documentation indicating erronously that the project used the HID USB class instead of the CDC class. git-svn-id: http://lufa-lib.googlecode.com/svn/trunk@690 d5102386-fcda-11dd-9fdb-3debd5008f28 --- Demos/Device/ClassDriver/AudioOutput/AudioOutput.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'Demos/Device/ClassDriver/AudioOutput/AudioOutput.c') diff --git a/Demos/Device/ClassDriver/AudioOutput/AudioOutput.c b/Demos/Device/ClassDriver/AudioOutput/AudioOutput.c index 129fca5f..bbcd2fd7 100644 --- a/Demos/Device/ClassDriver/AudioOutput/AudioOutput.c +++ b/Demos/Device/ClassDriver/AudioOutput/AudioOutput.c @@ -108,19 +108,19 @@ void ProcessNextSample(void) #if defined(AUDIO_OUT_MONO) /* Load the sample into the PWM timer channel */ - OCRxA = ((uint8_t)MixedSample_8Bit ^ (1 << 7)); + OCR3A = ((uint8_t)MixedSample_8Bit ^ (1 << 7)); #elif defined(AUDIO_OUT_STEREO) /* Load the dual 8-bit samples into the PWM timer channels */ - OCRxA = ((uint8_t)LeftSample_8Bit ^ (1 << 7)); - OCRxB = ((uint8_t)RightSample_8Bit ^ (1 << 7)); + OCR3A = ((uint8_t)LeftSample_8Bit ^ (1 << 7)); + OCR3B = ((uint8_t)RightSample_8Bit ^ (1 << 7)); #elif defined(AUDIO_OUT_PORTC) + /* Load the 8-bit mixed sample into PORTC */ PORTC = MixedSample_8Bit; #else uint8_t LEDMask = LEDS_NO_LEDS; /* Make mixed sample value positive (absolute) */ - if (MixedSample_8Bit < 0) - MixedSample_8Bit = -MixedSample_8Bit; + MixedSample_8Bit = abs(MixedSample_8Bit); if (MixedSample_8Bit > ((128 / 8) * 1)) LEDMask |= LEDS_LED1; @@ -162,9 +162,9 @@ void EVENT_USB_Connect(void) #if (defined(AUDIO_OUT_MONO) || defined(AUDIO_OUT_STEREO)) /* PWM speaker timer initialization */ - TCCRxA = ((1 << WGMx0) | (1 << COMxA1) | (1 << COMxA0) - | (1 << COMxB1) | (1 << COMxB0)); // Set on match, clear on TOP - TCCRxB = ((1 << WGMx2) | (1 << CSx0)); // Fast 8-Bit PWM, Fcpu speed + TCCR3A = ((1 << WGM30) | (1 << COM3A1) | (1 << COM3A0) + | (1 << COM3B1) | (1 << COM3B0)); // Set on match, clear on TOP + TCCR3B = ((1 << WGM32) | (1 << CS30)); // Fast 8-Bit PWM, Fcpu speed #endif } @@ -178,7 +178,7 @@ void EVENT_USB_Disconnect(void) #if (defined(AUDIO_OUT_MONO) || defined(AUDIO_OUT_STEREO)) /* Stop the PWM generation timer */ - TCCRxB = 0; + TCCR3B = 0; #endif #if defined(AUDIO_OUT_MONO) -- cgit v1.2.3