projects
/
pub
/
USBasp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Commit for the 090810 release.
[pub/USBasp.git]
/
Demos
/
Device
/
ClassDriver
/
AudioOutput
/
AudioOutput.c
diff --git
a/Demos/Device/ClassDriver/AudioOutput/AudioOutput.c
b/Demos/Device/ClassDriver/AudioOutput/AudioOutput.c
index
2caf6fa
..
d7de7d5
100644
(file)
--- a/
Demos/Device/ClassDriver/AudioOutput/AudioOutput.c
+++ b/
Demos/Device/ClassDriver/AudioOutput/AudioOutput.c
@@
-103,10
+103,11
@@
void ProcessNextSample(void)
int8_t LeftSample_8Bit = (LeftSample_16Bit >> 8);
\r
int8_t RightSample_8Bit = (RightSample_16Bit >> 8);
\r
\r
int8_t LeftSample_8Bit = (LeftSample_16Bit >> 8);
\r
int8_t RightSample_8Bit = (RightSample_16Bit >> 8);
\r
\r
-#if !defined(AUDIO_OUT_STEREO)
\r
/* Mix the two channels together to produce a mono, 8-bit sample */
\r
int8_t MixedSample_8Bit = (((int16_t)LeftSample_8Bit + (int16_t)RightSample_8Bit) >> 1);
\r
/* Mix the two channels together to produce a mono, 8-bit sample */
\r
int8_t MixedSample_8Bit = (((int16_t)LeftSample_8Bit + (int16_t)RightSample_8Bit) >> 1);
\r
-#endif
\r
+
\r
+ /* Get absolute value of mixed sample value */
\r
+ uint8_t MixedSample_8Bit_Abs = abs(MixedSample_8Bit);
\r
\r
#if defined(AUDIO_OUT_MONO)
\r
/* Load the sample into the PWM timer channel */
\r
\r
#if defined(AUDIO_OUT_MONO)
\r
/* Load the sample into the PWM timer channel */
\r
@@
-118,31
+119,28
@@
void ProcessNextSample(void)
#elif defined(AUDIO_OUT_PORTC)
\r
/* Load the 8-bit mixed sample into PORTC */
\r
PORTC = MixedSample_8Bit;
\r
#elif defined(AUDIO_OUT_PORTC)
\r
/* Load the 8-bit mixed sample into PORTC */
\r
PORTC = MixedSample_8Bit;
\r
-#else
\r
- uint8_t LEDMask = LEDS_NO_LEDS;
\r
+#endif
\r
\r
\r
- /* Make mixed sample value positive (absolute) */
\r
- MixedSample_8Bit = abs(MixedSample_8Bit);
\r
+ uint8_t LEDMask = LEDS_NO_LEDS;
\r
\r
\r
- if (MixedSample_8Bit > 2)
\r
+ if (MixedSample_8Bit
_Abs
> 2)
\r
LEDMask |= LEDS_LED1;
\r
\r
LEDMask |= LEDS_LED1;
\r
\r
- if (MixedSample_8Bit > 4)
\r
+ if (MixedSample_8Bit
_Abs
> 4)
\r
LEDMask |= LEDS_LED2;
\r
\r
LEDMask |= LEDS_LED2;
\r
\r
- if (MixedSample_8Bit > 8)
\r
+ if (MixedSample_8Bit
_Abs
> 8)
\r
LEDMask |= LEDS_LED3;
\r
\r
LEDMask |= LEDS_LED3;
\r
\r
- if (MixedSample_8Bit > 16)
\r
+ if (MixedSample_8Bit
_Abs
> 16)
\r
LEDMask |= LEDS_LED4;
\r
\r
LEDs_SetAllLEDs(LEDMask);
\r
LEDMask |= LEDS_LED4;
\r
\r
LEDs_SetAllLEDs(LEDMask);
\r
-#endif
\r
}
\r
}
\r
\r
/** Event handler for the library USB Connection event. */
\r
}
\r
}
\r
\r
/** Event handler for the library USB Connection event. */
\r
-void EVENT_USB_Connect(void)
\r
+void EVENT_USB_
Device_
Connect(void)
\r
{
\r
LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
\r
\r
{
\r
LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
\r
\r
@@
-171,7
+169,7
@@
void EVENT_USB_Connect(void)
}
\r
\r
/** Event handler for the library USB Disconnection event. */
\r
}
\r
\r
/** Event handler for the library USB Disconnection event. */
\r
-void EVENT_USB_Disconnect(void)
\r
+void EVENT_USB_D
evice_D
isconnect(void)
\r
{
\r
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
\r
\r
{
\r
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
\r
\r
@@
-196,7
+194,7
@@
void EVENT_USB_Disconnect(void)
}
\r
\r
/** Event handler for the library USB Configuration Changed event. */
\r
}
\r
\r
/** Event handler for the library USB Configuration Changed event. */
\r
-void EVENT_USB_ConfigurationChanged(void)
\r
+void EVENT_USB_
Device_
ConfigurationChanged(void)
\r
{
\r
LEDs_SetAllLEDs(LEDMASK_USB_READY);
\r
\r
{
\r
LEDs_SetAllLEDs(LEDMASK_USB_READY);
\r
\r
@@
-204,8
+202,8
@@
void EVENT_USB_ConfigurationChanged(void)
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
\r
}
\r
\r
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
\r
}
\r
\r
-/** Event handler for the library USB Unhandled Control
Packe
t event. */
\r
-void EVENT_USB_
UnhandledControlPacke
t(void)
\r
+/** Event handler for the library USB Unhandled Control
Reques
t event. */
\r
+void EVENT_USB_
Device_UnhandledControlReques
t(void)
\r
{
\r
{
\r
- Audio_Device_ProcessControl
Packe
t(&Speaker_Audio_Interface);
\r
+ Audio_Device_ProcessControl
Reques
t(&Speaker_Audio_Interface);
\r
}
\r
}
\r