forked from mfulz_github/qmk_firmware
Rename new Audio class driver functions, callbacks and events to ensure that they contain the USB mode (Device or Host) in the function names.
This commit is contained in:
parent
57eedebd19
commit
d8fe01f19a
|
@ -188,7 +188,7 @@ void EVENT_USB_Device_ControlRequest(void)
|
||||||
*
|
*
|
||||||
* \return Boolean true if the property get/set was successful, false otherwise
|
* \return Boolean true if the property get/set was successful, false otherwise
|
||||||
*/
|
*/
|
||||||
bool CALLBACK_Audio_GetSetEndpointProperty(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo,
|
bool CALLBACK_Audio_Device_GetSetEndpointProperty(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo,
|
||||||
const uint8_t EndpointProperty,
|
const uint8_t EndpointProperty,
|
||||||
const uint8_t EndpointAddress,
|
const uint8_t EndpointAddress,
|
||||||
const uint8_t EndpointControl,
|
const uint8_t EndpointControl,
|
||||||
|
|
|
@ -225,7 +225,7 @@ void EVENT_USB_Device_ControlRequest(void)
|
||||||
*
|
*
|
||||||
* \return Boolean true if the property get/set was successful, false otherwise
|
* \return Boolean true if the property get/set was successful, false otherwise
|
||||||
*/
|
*/
|
||||||
bool CALLBACK_Audio_GetSetEndpointProperty(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo,
|
bool CALLBACK_Audio_Device_GetSetEndpointProperty(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo,
|
||||||
const uint8_t EndpointProperty,
|
const uint8_t EndpointProperty,
|
||||||
const uint8_t EndpointAddress,
|
const uint8_t EndpointAddress,
|
||||||
const uint8_t EndpointControl,
|
const uint8_t EndpointControl,
|
||||||
|
|
|
@ -106,7 +106,7 @@ int main(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
USB_Audio_SampleFreq_t SampleRate = AUDIO_SAMPLE_FREQ(48000);
|
USB_Audio_SampleFreq_t SampleRate = AUDIO_SAMPLE_FREQ(48000);
|
||||||
if (Audio_GetSetEndpointProperty(&Microphone_Audio_Interface, Microphone_Audio_Interface.Config.DataINPipeNumber,
|
if (Audio_Host_GetSetEndpointProperty(&Microphone_Audio_Interface, Microphone_Audio_Interface.Config.DataINPipeNumber,
|
||||||
AUDIO_REQ_SetCurrent, AUDIO_EPCONTROL_SamplingFreq,
|
AUDIO_REQ_SetCurrent, AUDIO_EPCONTROL_SamplingFreq,
|
||||||
sizeof(SampleRate), &SampleRate) != HOST_SENDCONTROL_Successful)
|
sizeof(SampleRate), &SampleRate) != HOST_SENDCONTROL_Successful)
|
||||||
{
|
{
|
||||||
|
|
|
@ -106,7 +106,7 @@ int main(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
USB_Audio_SampleFreq_t SampleRate = AUDIO_SAMPLE_FREQ(48000);
|
USB_Audio_SampleFreq_t SampleRate = AUDIO_SAMPLE_FREQ(48000);
|
||||||
if (Audio_GetSetEndpointProperty(&Speaker_Audio_Interface, Speaker_Audio_Interface.Config.DataOUTPipeNumber,
|
if (Audio_Host_GetSetEndpointProperty(&Speaker_Audio_Interface, Speaker_Audio_Interface.Config.DataOUTPipeNumber,
|
||||||
AUDIO_REQ_SetCurrent, AUDIO_EPCONTROL_SamplingFreq,
|
AUDIO_REQ_SetCurrent, AUDIO_EPCONTROL_SamplingFreq,
|
||||||
sizeof(SampleRate), &SampleRate) != HOST_SENDCONTROL_Successful)
|
sizeof(SampleRate), &SampleRate) != HOST_SENDCONTROL_Successful)
|
||||||
{
|
{
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -70,7 +70,7 @@ void Audio_Device_ProcessControlRequest(USB_ClassInfo_Audio_Device_t* const Audi
|
||||||
Endpoint_ClearStatusStage();
|
Endpoint_ClearStatusStage();
|
||||||
|
|
||||||
AudioInterfaceInfo->State.InterfaceEnabled = ((USB_ControlRequest.wValue & 0xFF) != 0);
|
AudioInterfaceInfo->State.InterfaceEnabled = ((USB_ControlRequest.wValue & 0xFF) != 0);
|
||||||
EVENT_Audio_StreamStartStopChange(AudioInterfaceInfo);
|
EVENT_Audio_Device_StreamStartStop(AudioInterfaceInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
@ -93,7 +93,8 @@ void Audio_Device_ProcessControlRequest(USB_ClassInfo_Audio_Device_t* const Audi
|
||||||
uint8_t EndpointAddress = (uint8_t)USB_ControlRequest.wIndex;
|
uint8_t EndpointAddress = (uint8_t)USB_ControlRequest.wIndex;
|
||||||
uint8_t EndpointControl = (USB_ControlRequest.wValue >> 8);
|
uint8_t EndpointControl = (USB_ControlRequest.wValue >> 8);
|
||||||
|
|
||||||
if (CALLBACK_Audio_GetSetEndpointProperty(AudioInterfaceInfo, EndpointProperty, EndpointAddress, EndpointControl, NULL, NULL))
|
if (CALLBACK_Audio_Device_GetSetEndpointProperty(AudioInterfaceInfo, EndpointProperty, EndpointAddress,
|
||||||
|
EndpointControl, NULL, NULL))
|
||||||
{
|
{
|
||||||
uint16_t ValueLength = USB_ControlRequest.wLength;
|
uint16_t ValueLength = USB_ControlRequest.wLength;
|
||||||
uint8_t Value[ValueLength];
|
uint8_t Value[ValueLength];
|
||||||
|
@ -102,7 +103,8 @@ void Audio_Device_ProcessControlRequest(USB_ClassInfo_Audio_Device_t* const Audi
|
||||||
Endpoint_Read_Control_Stream_LE(Value, ValueLength);
|
Endpoint_Read_Control_Stream_LE(Value, ValueLength);
|
||||||
Endpoint_ClearIN();
|
Endpoint_ClearIN();
|
||||||
|
|
||||||
CALLBACK_Audio_GetSetEndpointProperty(AudioInterfaceInfo, EndpointProperty, EndpointAddress, EndpointControl, &ValueLength, Value);
|
CALLBACK_Audio_Device_GetSetEndpointProperty(AudioInterfaceInfo, EndpointProperty, EndpointAddress,
|
||||||
|
EndpointControl, &ValueLength, Value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -119,7 +121,8 @@ void Audio_Device_ProcessControlRequest(USB_ClassInfo_Audio_Device_t* const Audi
|
||||||
uint16_t ValueLength = USB_ControlRequest.wLength;
|
uint16_t ValueLength = USB_ControlRequest.wLength;
|
||||||
uint8_t Value[ValueLength];
|
uint8_t Value[ValueLength];
|
||||||
|
|
||||||
if (CALLBACK_Audio_GetSetEndpointProperty(AudioInterfaceInfo, EndpointProperty, EndpointAddress, EndpointControl, &ValueLength, Value))
|
if (CALLBACK_Audio_Device_GetSetEndpointProperty(AudioInterfaceInfo, EndpointProperty, EndpointAddress,
|
||||||
|
EndpointControl, &ValueLength, Value))
|
||||||
{
|
{
|
||||||
Endpoint_ClearSETUP();
|
Endpoint_ClearSETUP();
|
||||||
Endpoint_Write_Control_Stream_LE(Value, ValueLength);
|
Endpoint_Write_Control_Stream_LE(Value, ValueLength);
|
||||||
|
|
|
@ -149,7 +149,7 @@
|
||||||
*
|
*
|
||||||
* \return Boolean true if the property get/set was successful, false otherwise
|
* \return Boolean true if the property get/set was successful, false otherwise
|
||||||
*/
|
*/
|
||||||
bool CALLBACK_Audio_GetSetEndpointProperty(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo,
|
bool CALLBACK_Audio_Device_GetSetEndpointProperty(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo,
|
||||||
const uint8_t EndpointProperty,
|
const uint8_t EndpointProperty,
|
||||||
const uint8_t EndpointAddress,
|
const uint8_t EndpointAddress,
|
||||||
const uint8_t EndpointControl,
|
const uint8_t EndpointControl,
|
||||||
|
@ -162,7 +162,7 @@
|
||||||
*
|
*
|
||||||
* \param[in,out] AudioInterfaceInfo Pointer to a structure containing an Audio Class configuration and state.
|
* \param[in,out] AudioInterfaceInfo Pointer to a structure containing an Audio Class configuration and state.
|
||||||
*/
|
*/
|
||||||
void EVENT_Audio_StreamStartStopChange(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo);
|
void EVENT_Audio_Device_StreamStartStop(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo);
|
||||||
|
|
||||||
/* Inline Functions: */
|
/* Inline Functions: */
|
||||||
/** General management task for a given Audio class interface, required for the correct operation of the interface. This should
|
/** General management task for a given Audio class interface, required for the correct operation of the interface. This should
|
||||||
|
@ -358,7 +358,7 @@
|
||||||
#if defined(__INCLUDE_FROM_AUDIO_DEVICE_C)
|
#if defined(__INCLUDE_FROM_AUDIO_DEVICE_C)
|
||||||
void Audio_Device_Event_Stub(void) ATTR_CONST;
|
void Audio_Device_Event_Stub(void) ATTR_CONST;
|
||||||
|
|
||||||
void EVENT_Audio_StreamStartStopChange(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo)
|
void EVENT_Audio_Device_StreamStartStop(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo)
|
||||||
ATTR_WEAK ATTR_NON_NULL_PTR_ARG(1) ATTR_ALIAS(Audio_Device_Event_Stub);
|
ATTR_WEAK ATTR_NON_NULL_PTR_ARG(1) ATTR_ALIAS(Audio_Device_Event_Stub);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -208,7 +208,7 @@ uint8_t Audio_Host_StartStopStreaming(USB_ClassInfo_Audio_Host_t* const AudioInt
|
||||||
EnableStreaming ? AudioInterfaceInfo->State.EnabledStreamingAltIndex : 0);
|
EnableStreaming ? AudioInterfaceInfo->State.EnabledStreamingAltIndex : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t Audio_GetSetEndpointProperty(USB_ClassInfo_Audio_Host_t* const AudioInterfaceInfo,
|
uint8_t Audio_Host_GetSetEndpointProperty(USB_ClassInfo_Audio_Host_t* const AudioInterfaceInfo,
|
||||||
const uint8_t DataPipeIndex,
|
const uint8_t DataPipeIndex,
|
||||||
const uint8_t EndpointProperty,
|
const uint8_t EndpointProperty,
|
||||||
const uint8_t EndpointControl,
|
const uint8_t EndpointControl,
|
||||||
|
|
|
@ -161,7 +161,7 @@
|
||||||
*
|
*
|
||||||
* \return A value from the \ref USB_Host_SendControlErrorCodes_t enum.
|
* \return A value from the \ref USB_Host_SendControlErrorCodes_t enum.
|
||||||
*/
|
*/
|
||||||
uint8_t Audio_GetSetEndpointProperty(USB_ClassInfo_Audio_Host_t* const AudioInterfaceInfo,
|
uint8_t Audio_Host_GetSetEndpointProperty(USB_ClassInfo_Audio_Host_t* const AudioInterfaceInfo,
|
||||||
const uint8_t DataPipeIndex,
|
const uint8_t DataPipeIndex,
|
||||||
const uint8_t EndpointProperty,
|
const uint8_t EndpointProperty,
|
||||||
const uint8_t EndpointControl,
|
const uint8_t EndpointControl,
|
||||||
|
|
|
@ -13,9 +13,9 @@
|
||||||
* tokens as an alternative to tokens defined in the project makefile
|
* tokens as an alternative to tokens defined in the project makefile
|
||||||
* - Added new USB_Host_SetInterfaceAltSetting() convenience function for the selection of an interface's alternative setting
|
* - Added new USB_Host_SetInterfaceAltSetting() convenience function for the selection of an interface's alternative setting
|
||||||
* - Added Audio class control request definitions
|
* - Added Audio class control request definitions
|
||||||
* - Added new CALLBACK_Audio_GetSetEndpointProperty() callback to the Audio Device Class driver to allow for endpoint control manipulations
|
* - Added new CALLBACK_Audio_Device_GetSetEndpointProperty() callback to the Audio Device Class driver to allow for endpoint control manipulations
|
||||||
* such as data sample rates
|
* such as data sample rates
|
||||||
* - Added new EVENT_Audio_StreamStartStopChange() event to the Audio Device Class driver to detect stream start/stop events
|
* - Added new EVENT_Audio_Device_StreamStartStop() event to the Audio Device Class driver to detect stream start/stop events
|
||||||
* - Added board driver support for the Busware TUL board
|
* - Added board driver support for the Busware TUL board
|
||||||
* - Added new Host mode Audio Class driver
|
* - Added new Host mode Audio Class driver
|
||||||
* - Library Applications:
|
* - Library Applications:
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
* -# Add a LUFA_YIELD macro for integration into a third-party RTOS
|
* -# Add a LUFA_YIELD macro for integration into a third-party RTOS
|
||||||
* -# Abstract out Mass Storage byte send/receive to prevent low level API use in projects
|
* -# Abstract out Mass Storage byte send/receive to prevent low level API use in projects
|
||||||
* -# Consider switch from endpoint numbers to full endpoint addresses to ease future architecture expansion
|
* -# Consider switch from endpoint numbers to full endpoint addresses to ease future architecture expansion
|
||||||
|
* -# Add architecture sanity guards to arch-specific files so that entire tree can be built from an IDE
|
||||||
* - Documentation/Support
|
* - Documentation/Support
|
||||||
* -# Add detailed overviews of how each demo works
|
* -# Add detailed overviews of how each demo works
|
||||||
* -# Add board overviews
|
* -# Add board overviews
|
||||||
|
|
|
@ -43,6 +43,7 @@
|
||||||
* - CAMTRIG, a remote Camera Trigger device: http://code.astraw.com/projects/motmot/camtrig
|
* - CAMTRIG, a remote Camera Trigger device: http://code.astraw.com/projects/motmot/camtrig
|
||||||
* - CD Driver Emulator Dongle for ISO Files: http://cdemu.blogspot.com/
|
* - CD Driver Emulator Dongle for ISO Files: http://cdemu.blogspot.com/
|
||||||
* - ClockTamer, a configurable clock generator: http://code.google.com/p/clock-tamer/
|
* - ClockTamer, a configurable clock generator: http://code.google.com/p/clock-tamer/
|
||||||
|
* - CULFW, a 868MHz RF packet encoder/decoder: http://www.koeniglich.de/culfw/culfw.html
|
||||||
* - DIY PS3 controller emulator: https://code.google.com/p/diyps3controller/
|
* - DIY PS3 controller emulator: https://code.google.com/p/diyps3controller/
|
||||||
* - EMuSer, a USB-RS422 adapter for E-Mu samplers: http://www.emxp.net/EMuSer.htm
|
* - EMuSer, a USB-RS422 adapter for E-Mu samplers: http://www.emxp.net/EMuSer.htm
|
||||||
* - Estick JTAG, an ARM JTAG debugger: http://code.google.com/p/estick-jtag/
|
* - Estick JTAG, an ARM JTAG debugger: http://code.google.com/p/estick-jtag/
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
* \c TotalDiscreteSampleRates. Existing applications will need to add an array of \ref USB_Audio_SampleFreq_t elements
|
* \c TotalDiscreteSampleRates. Existing applications will need to add an array of \ref USB_Audio_SampleFreq_t elements
|
||||||
* immediately following any \ref USB_Audio_Descriptor_Format_t descriptors, and insert the appropriate sampling rates
|
* immediately following any \ref USB_Audio_Descriptor_Format_t descriptors, and insert the appropriate sampling rates
|
||||||
* supported by the device, as well as rename the descriptor elements to match the updated element names.
|
* supported by the device, as well as rename the descriptor elements to match the updated element names.
|
||||||
* - The device mode Audio class driver now requires a new user application callback, \ref CALLBACK_Audio_GetSetEndpointProperty().
|
* - The device mode Audio class driver now requires a new user application callback, \ref CALLBACK_Audio_Device_GetSetEndpointProperty().
|
||||||
* Existing applications must implement this new callback, however if multiple sample rates or pitch control is not used,
|
* Existing applications must implement this new callback, however if multiple sample rates or pitch control is not used,
|
||||||
* this function may be hard-coded to always return false for previous behaviour to be retained.
|
* this function may be hard-coded to always return false for previous behaviour to be retained.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue