diff options
author | Dean Camera <dean@fourwalledcubicle.com> | 2011-06-09 04:08:03 +0000 |
---|---|---|
committer | Dean Camera <dean@fourwalledcubicle.com> | 2011-06-09 04:08:03 +0000 |
commit | 1f1d0710f379a8b08ef646cbadb63d92c35e47fb (patch) | |
tree | 886a528a8ba721733735c1cded2462e6992e11f6 /LUFA/Drivers/USB/Class | |
parent | 0bf5064aec5ac43ba2b25d44528bebb27db2f117 (diff) | |
download | lufa-1f1d0710f379a8b08ef646cbadb63d92c35e47fb.tar.gz lufa-1f1d0710f379a8b08ef646cbadb63d92c35e47fb.tar.bz2 lufa-1f1d0710f379a8b08ef646cbadb63d92c35e47fb.zip |
Add new Audio Class Driver Host demos.
Fix errors in the new Audio Host mode Class Driver, which would have prevented data from being sent or received properly by the device.
Add microphone/square wave generation compile time switch to the Low Level AudioOutput Host demo.
Diffstat (limited to 'LUFA/Drivers/USB/Class')
-rw-r--r-- | LUFA/Drivers/USB/Class/Host/Audio.c | 2 | ||||
-rw-r--r-- | LUFA/Drivers/USB/Class/Host/Audio.h | 47 |
2 files changed, 39 insertions, 10 deletions
diff --git a/LUFA/Drivers/USB/Class/Host/Audio.c b/LUFA/Drivers/USB/Class/Host/Audio.c index 0da1eb664..80ab2d1e5 100644 --- a/LUFA/Drivers/USB/Class/Host/Audio.c +++ b/LUFA/Drivers/USB/Class/Host/Audio.c @@ -209,7 +209,7 @@ uint8_t Audio_GetSetEndpointProperty(USB_ClassInfo_Audio_Host_t* const AudioInte const uint8_t EndpointProperty,
const uint8_t EndpointControl,
uint16_t const DataLength,
- uint8_t* Data)
+ void* const Data)
{
uint8_t RequestType;
uint8_t EndpointAddress;
diff --git a/LUFA/Drivers/USB/Class/Host/Audio.h b/LUFA/Drivers/USB/Class/Host/Audio.h index 7e9a48d89..1cac3e7ac 100644 --- a/LUFA/Drivers/USB/Class/Host/Audio.h +++ b/LUFA/Drivers/USB/Class/Host/Audio.h @@ -159,8 +159,8 @@ const uint8_t DataPipeIndex,
const uint8_t EndpointProperty,
const uint8_t EndpointControl,
- uint16_t* const DataLength,
- uint8_t* Data);
+ uint16_t const DataLength,
+ void* const Data);
/* Inline Functions: */
/** General management task for a given Audio host class interface, required for the correct operation of
@@ -192,8 +192,13 @@ if ((USB_HostState != HOST_STATE_Configured) || !(AudioInterfaceInfo->State.IsActive))
return false;
+ bool SampleReceived = false;
+
Pipe_SelectPipe(AudioInterfaceInfo->Config.DataOUTPipeNumber);
- return Pipe_IsINReceived();
+ Pipe_Unfreeze();
+ SampleReceived = Pipe_IsINReceived();
+ Pipe_Freeze();
+ return SampleReceived;
}
/** Determines if the given audio interface is ready to accept the next sample to be written to it, and selects
@@ -237,7 +242,11 @@ Sample = Pipe_Read_8();
if (!(Pipe_BytesInPipe()))
- Pipe_ClearIN();
+ {
+ Pipe_Unfreeze();
+ Pipe_ClearIN();
+ Pipe_Freeze();
+ }
return Sample;
}
@@ -262,7 +271,11 @@ Sample = (int16_t)Pipe_Read_16_LE();
if (!(Pipe_BytesInPipe()))
- Pipe_ClearIN();
+ {
+ Pipe_Unfreeze();
+ Pipe_ClearIN();
+ Pipe_Freeze();
+ }
return Sample;
}
@@ -287,7 +300,11 @@ Sample = (((uint32_t)Pipe_Read_8() << 16) | Pipe_Read_16_LE());
if (!(Pipe_BytesInPipe()))
- Pipe_ClearIN();
+ {
+ Pipe_Unfreeze();
+ Pipe_ClearIN();
+ Pipe_Freeze();
+ }
return Sample;
}
@@ -308,7 +325,11 @@ Pipe_Write_8(Sample);
if (Pipe_BytesInPipe() == AudioInterfaceInfo->State.DataINPipeSize)
- Pipe_ClearOUT();
+ {
+ Pipe_Unfreeze();
+ Pipe_ClearOUT();
+ Pipe_Freeze();
+ }
}
/** Writes the next 16-bit audio sample to the current audio interface.
@@ -327,7 +348,11 @@ Pipe_Write_16_LE(Sample);
if (Pipe_BytesInPipe() == AudioInterfaceInfo->State.DataINPipeSize)
- Pipe_ClearOUT();
+ {
+ Pipe_Unfreeze();
+ Pipe_ClearOUT();
+ Pipe_Freeze();
+ }
}
/** Writes the next 24-bit audio sample to the current audio interface.
@@ -347,7 +372,11 @@ Pipe_Write_8(Sample >> 16);
if (Pipe_BytesInPipe() == AudioInterfaceInfo->State.DataINPipeSize)
- Pipe_ClearOUT();
+ {
+ Pipe_Unfreeze();
+ Pipe_ClearOUT();
+ Pipe_Freeze();
+ }
}
/* Private Interface - For use in library only: */
|