projects
/
pub
/
USBasp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fixed inability to enumerate any devices while in host mode (broken in a previous...
[pub/USBasp.git]
/
Demos
/
Device
/
AudioOutput
/
AudioOutput.c
diff --git
a/Demos/Device/AudioOutput/AudioOutput.c
b/Demos/Device/AudioOutput/AudioOutput.c
index
0f390f0
..
640462d
100644
(file)
--- a/
Demos/Device/AudioOutput/AudioOutput.c
+++ b/
Demos/Device/AudioOutput/AudioOutput.c
@@
-36,17
+36,11
@@
\r
#include "AudioOutput.h"
\r
\r
\r
#include "AudioOutput.h"
\r
\r
-/* Project Tags, for reading out using the ButtLoad project */
\r
-BUTTLOADTAG(ProjName, "LUFA AudioOut App");
\r
-BUTTLOADTAG(BuildTime, __TIME__);
\r
-BUTTLOADTAG(BuildDate, __DATE__);
\r
-BUTTLOADTAG(LUFAVersion, "LUFA V" LUFA_VERSION_STRING);
\r
-
\r
/* Scheduler Task List */
\r
TASK_LIST
\r
{
\r
/* Scheduler Task List */
\r
TASK_LIST
\r
{
\r
- {
Task: USB_USBTask , TaskStatus:
TASK_STOP },
\r
- {
Task: USB_Audio_Task , TaskStatus:
TASK_STOP },
\r
+ {
.Task = USB_USBTask , .TaskStatus =
TASK_STOP },
\r
+ {
.Task = USB_Audio_Task , .TaskStatus =
TASK_STOP },
\r
};
\r
\r
\r
};
\r
\r
\r
@@
-90,7
+84,7
@@
EVENT_HANDLER(USB_Connect)
UpdateStatus(Status_USBEnumerating);
\r
\r
/* Sample reload timer initialization */
\r
UpdateStatus(Status_USBEnumerating);
\r
\r
/* Sample reload timer initialization */
\r
- OCR0A = (F_CPU / AUDIO_SAMPLE_FREQUENCY);
\r
+ OCR0A = (F_CPU / AUDIO_SAMPLE_FREQUENCY)
- 1
;
\r
TCCR0A = (1 << WGM01); // CTC mode
\r
TCCR0B = (1 << CS00); // Fcpu speed
\r
\r
TCCR0A = (1 << WGM01); // CTC mode
\r
TCCR0B = (1 << CS00); // Fcpu speed
\r
\r
@@
-164,18
+158,16
@@
EVENT_HANDLER(USB_ConfigurationChanged)
EVENT_HANDLER(USB_UnhandledControlPacket)
\r
{
\r
/* Process General and Audio specific control requests */
\r
EVENT_HANDLER(USB_UnhandledControlPacket)
\r
{
\r
/* Process General and Audio specific control requests */
\r
- switch (bRequest)
\r
+ switch (
USB_ControlRequest.
bRequest)
\r
{
\r
case REQ_SetInterface:
\r
/* Set Interface is not handled by the library, as its function is application-specific */
\r
{
\r
case REQ_SetInterface:
\r
/* Set Interface is not handled by the library, as its function is application-specific */
\r
- if (bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_STANDARD | REQREC_INTERFACE))
\r
+ if (
USB_ControlRequest.
bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_STANDARD | REQREC_INTERFACE))
\r
{
\r
{
\r
- uint16_t wValue = Endpoint_Read_Word_LE();
\r
-
\r
- Endpoint_ClearSetupReceived();
\r
+ Endpoint_ClearSETUP();
\r
\r
/* Check if the host is enabling the audio interface (setting AlternateSetting to 1) */
\r
\r
/* Check if the host is enabling the audio interface (setting AlternateSetting to 1) */
\r
- if (wValue)
\r
+ if (
USB_ControlRequest.
wValue)
\r
{
\r
/* Start audio task */
\r
Scheduler_SetTaskMode(USB_Audio_Task, TASK_RUN);
\r
{
\r
/* Start audio task */
\r
Scheduler_SetTaskMode(USB_Audio_Task, TASK_RUN);
\r
@@
-187,8
+179,8
@@
EVENT_HANDLER(USB_UnhandledControlPacket)
}
\r
\r
/* Acknowledge status stage */
\r
}
\r
\r
/* Acknowledge status stage */
\r
- while (!(Endpoint_Is
Setup
INReady()));
\r
- Endpoint_Clear
Setup
IN();
\r
+ while (!(Endpoint_IsINReady()));
\r
+ Endpoint_ClearIN();
\r
}
\r
\r
break;
\r
}
\r
\r
break;
\r
@@
-231,20
+223,20
@@
TASK(USB_Audio_Task)
Endpoint_SelectEndpoint(AUDIO_STREAM_EPNUM);
\r
\r
/* Check if the current endpoint can be read from (contains a packet) and that the next sample should be read */
\r
Endpoint_SelectEndpoint(AUDIO_STREAM_EPNUM);
\r
\r
/* Check if the current endpoint can be read from (contains a packet) and that the next sample should be read */
\r
- if (Endpoint_
ReadWriteAllow
ed() && (TIFR0 & (1 << OCF0A)))
\r
+ if (Endpoint_
IsOUTReceiv
ed() && (TIFR0 & (1 << OCF0A)))
\r
{
\r
/* Clear the sample reload timer */
\r
TIFR0 |= (1 << OCF0A);
\r
\r
{
\r
/* Clear the sample reload timer */
\r
TIFR0 |= (1 << OCF0A);
\r
\r
- /* Retr
ei
ve the signed 16-bit left and right audio samples */
\r
+ /* Retr
ie
ve the signed 16-bit left and right audio samples */
\r
int16_t LeftSample_16Bit = (int16_t)Endpoint_Read_Word_LE();
\r
int16_t RightSample_16Bit = (int16_t)Endpoint_Read_Word_LE();
\r
\r
/* Check to see if the bank is now empty */
\r
int16_t LeftSample_16Bit = (int16_t)Endpoint_Read_Word_LE();
\r
int16_t RightSample_16Bit = (int16_t)Endpoint_Read_Word_LE();
\r
\r
/* Check to see if the bank is now empty */
\r
- if (!(Endpoint_ReadWriteAllowed()))
\r
+ if (!(Endpoint_
Is
ReadWriteAllowed()))
\r
{
\r
/* Acknowledge the packet, clear the bank ready for the next packet */
\r
{
\r
/* Acknowledge the packet, clear the bank ready for the next packet */
\r
- Endpoint_Clear
CurrentBank
();
\r
+ Endpoint_Clear
OUT
();
\r
}
\r
\r
/* Massage signed 16-bit left and right audio samples into signed 8-bit */
\r
}
\r
\r
/* Massage signed 16-bit left and right audio samples into signed 8-bit */
\r