aboutsummaryrefslogtreecommitdiffstats
path: root/Demos/Device/ClassDriver/AudioOutput/AudioOutput.c
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2009-10-03 07:59:32 +0000
committerDean Camera <dean@fourwalledcubicle.com>2009-10-03 07:59:32 +0000
commit433399b05db8d4a8a3989e90614f7206d49568fc (patch)
tree7f69f5ea95c68005221caab40a9bb1e11ae5b80a /Demos/Device/ClassDriver/AudioOutput/AudioOutput.c
parent3ebfb998ec4eef73543a8e8bde0019a3057b72dc (diff)
downloadlufa-433399b05db8d4a8a3989e90614f7206d49568fc.tar.gz
lufa-433399b05db8d4a8a3989e90614f7206d49568fc.tar.bz2
lufa-433399b05db8d4a8a3989e90614f7206d49568fc.zip
Changed Audio Class driver sample read/write functions to be inline, to reduce the number of cycles needed to transfer samples to and from the device (allowing more time for processing and output).
Fixed ClassDriver AudioOutput demo not selecting an audio output mode.
Diffstat (limited to 'Demos/Device/ClassDriver/AudioOutput/AudioOutput.c')
-rw-r--r--Demos/Device/ClassDriver/AudioOutput/AudioOutput.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/Demos/Device/ClassDriver/AudioOutput/AudioOutput.c b/Demos/Device/ClassDriver/AudioOutput/AudioOutput.c
index d7de7d5b0..a73f1c96e 100644
--- a/Demos/Device/ClassDriver/AudioOutput/AudioOutput.c
+++ b/Demos/Device/ClassDriver/AudioOutput/AudioOutput.c
@@ -123,17 +123,15 @@ void ProcessNextSample(void)
uint8_t LEDMask = LEDS_NO_LEDS;
- if (MixedSample_8Bit_Abs > 2)
- LEDMask |= LEDS_LED1;
-
- if (MixedSample_8Bit_Abs > 4)
- LEDMask |= LEDS_LED2;
-
- if (MixedSample_8Bit_Abs > 8)
- LEDMask |= LEDS_LED3;
-
+ /* Turn on LEDs as the sample amplitude increases */
if (MixedSample_8Bit_Abs > 16)
- LEDMask |= LEDS_LED4;
+ LEDMask = (LEDS_LED1 | LEDS_LED2 | LEDS_LED3 | LEDS_LED4);
+ else if (MixedSample_8Bit_Abs > 8)
+ LEDMask = (LEDS_LED1 | LEDS_LED2 | LEDS_LED3);
+ else if (MixedSample_8Bit_Abs > 4)
+ LEDMask = (LEDS_LED1 | LEDS_LED2);
+ else if (MixedSample_8Bit_Abs > 2)
+ LEDMask = (LEDS_LED1);
LEDs_SetAllLEDs(LEDMask);
}