forked from mfulz_github/qmk_firmware
Fixed Endpoint_Write_Control_Stream_* functions not sending a terminating IN when the given data length is zero.
This commit is contained in:
parent
7ef58eef7a
commit
6c38ca2890
|
@ -102,10 +102,10 @@ void ProcessNextSample(void)
|
||||||
/* Audio sample is ADC value scaled to fit the entire range */
|
/* Audio sample is ADC value scaled to fit the entire range */
|
||||||
int16_t AudioSample = ((SAMPLE_MAX_RANGE / ADC_MAX_RANGE) * ADC_GetResult());
|
int16_t AudioSample = ((SAMPLE_MAX_RANGE / ADC_MAX_RANGE) * ADC_GetResult());
|
||||||
|
|
||||||
#if defined(MICROPHONE_BIASED_TO_HALF_RAIL)
|
#if defined(MICROPHONE_BIASED_TO_HALF_RAIL)
|
||||||
/* Microphone is biased to half rail voltage, subtract the bias from the sample value */
|
/* Microphone is biased to half rail voltage, subtract the bias from the sample value */
|
||||||
AudioSample -= (SAMPLE_MAX_RANGE / 2));
|
AudioSample -= (SAMPLE_MAX_RANGE / 2));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Audio_Device_WriteSample16(&Microphone_Audio_Interface, AudioSample);
|
Audio_Device_WriteSample16(&Microphone_Audio_Interface, AudioSample);
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,7 @@
|
||||||
#include <LUFA/Drivers/USB/USB.h>
|
#include <LUFA/Drivers/USB/USB.h>
|
||||||
#include <LUFA/Drivers/USB/Class/HID.h>
|
#include <LUFA/Drivers/USB/Class/HID.h>
|
||||||
|
|
||||||
/** Type Defines: */
|
/* Type Defines: */
|
||||||
/** Type define for the device configuration descriptor structure. This must be defined in the
|
/** Type define for the device configuration descriptor structure. This must be defined in the
|
||||||
* application code, as the configuration descriptor contains several sub-descriptors which
|
* application code, as the configuration descriptor contains several sub-descriptors which
|
||||||
* vary between devices, and which describe the device's usage to the host.
|
* vary between devices, and which describe the device's usage to the host.
|
||||||
|
|
|
@ -42,9 +42,9 @@ uint8_t PrevHIDReportBuffer[GENERIC_REPORT_SIZE];
|
||||||
/** Structure to contain reports from the host, so that they can be echoed back upon request */
|
/** Structure to contain reports from the host, so that they can be echoed back upon request */
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
uint8_t ReportID;
|
uint8_t ReportID;
|
||||||
uint16_t ReportSize;
|
uint16_t ReportSize;
|
||||||
uint8_t ReportData[GENERIC_REPORT_SIZE];
|
uint8_t ReportData[GENERIC_REPORT_SIZE];
|
||||||
} HIDReportEcho;
|
} HIDReportEcho;
|
||||||
|
|
||||||
/** LUFA HID Class driver interface configuration and state information. This structure is
|
/** LUFA HID Class driver interface configuration and state information. This structure is
|
||||||
|
|
|
@ -169,10 +169,10 @@ void USB_Audio_Task(void)
|
||||||
/* Audio sample is ADC value scaled to fit the entire range */
|
/* Audio sample is ADC value scaled to fit the entire range */
|
||||||
int16_t AudioSample = ((SAMPLE_MAX_RANGE / ADC_MAX_RANGE) * ADC_GetResult());
|
int16_t AudioSample = ((SAMPLE_MAX_RANGE / ADC_MAX_RANGE) * ADC_GetResult());
|
||||||
|
|
||||||
#if defined(MICROPHONE_BIASED_TO_HALF_RAIL)
|
#if defined(MICROPHONE_BIASED_TO_HALF_RAIL)
|
||||||
/* Microphone is biased to half rail voltage, subtract the bias from the sample value */
|
/* Microphone is biased to half rail voltage, subtract the bias from the sample value */
|
||||||
AudioSample -= (SAMPLE_MAX_RANGE / 2));
|
AudioSample -= (SAMPLE_MAX_RANGE / 2));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Write the sample to the buffer */
|
/* Write the sample to the buffer */
|
||||||
Endpoint_Write_Word_LE(AudioSample);
|
Endpoint_Write_Word_LE(AudioSample);
|
||||||
|
|
|
@ -2,6 +2,9 @@ uint8_t TEMPLATE_FUNC_NAME (void* Buffer, uint16_t Length)
|
||||||
{
|
{
|
||||||
uint8_t* DataStream = ((uint8_t*)Buffer + TEMPLATE_BUFFER_OFFSET(Length));
|
uint8_t* DataStream = ((uint8_t*)Buffer + TEMPLATE_BUFFER_OFFSET(Length));
|
||||||
|
|
||||||
|
if (!(Length))
|
||||||
|
Endpoint_ClearOUT();
|
||||||
|
|
||||||
while (Length)
|
while (Length)
|
||||||
{
|
{
|
||||||
if (Endpoint_IsSETUPReceived())
|
if (Endpoint_IsSETUPReceived())
|
||||||
|
|
|
@ -5,7 +5,9 @@ uint8_t TEMPLATE_FUNC_NAME (const void* Buffer, uint16_t Length)
|
||||||
|
|
||||||
if (Length > USB_ControlRequest.wLength)
|
if (Length > USB_ControlRequest.wLength)
|
||||||
Length = USB_ControlRequest.wLength;
|
Length = USB_ControlRequest.wLength;
|
||||||
|
else if (!(Length))
|
||||||
|
Endpoint_ClearIN();
|
||||||
|
|
||||||
while (Length || LastPacketFull)
|
while (Length || LastPacketFull)
|
||||||
{
|
{
|
||||||
if (Endpoint_IsSETUPReceived())
|
if (Endpoint_IsSETUPReceived())
|
||||||
|
|
|
@ -51,6 +51,7 @@
|
||||||
* - Fixed HID host Class driver report send/receive report broken when issued through the control pipe
|
* - Fixed HID host Class driver report send/receive report broken when issued through the control pipe
|
||||||
* - Fixed HOST_STATE_AS_GPIOR compile time option being ignored when in host mode (thanks to David Lyons)
|
* - Fixed HOST_STATE_AS_GPIOR compile time option being ignored when in host mode (thanks to David Lyons)
|
||||||
* - Fixed LowLevel Keyboard demo not saving the issues report only after it has been sent to the host
|
* - Fixed LowLevel Keyboard demo not saving the issues report only after it has been sent to the host
|
||||||
|
* - Fixed Endpoint_Write_Control_Stream_* functions not sending a terminating IN when given data Length is zero
|
||||||
*
|
*
|
||||||
* \section Sec_ChangeLog090924 Version 090924
|
* \section Sec_ChangeLog090924 Version 090924
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue