1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-02-20 10:54:14 +01:00

Flight/HID: NAK instead of stall USB bus (former was mistake) and change

polling time to 4 ms

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1996 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
peabody124 2010-10-20 05:21:25 +00:00 committed by peabody124
parent f618e6fffc
commit cd04845c3d
2 changed files with 6 additions and 6 deletions

View File

@ -280,7 +280,7 @@ int32_t PIOS_USB_HID_RxBufferGet(uint8_t id)
{
uint8_t read = bufferGetFromFront(&rxBuffer);
// If endpoint was stalled and there is now space make it valid
if ((GetEPRxStatus(ENDP1) == EP_RX_STALL) && (bufferRemainingSpace(&rxBuffer) > 62)) {
if ((GetEPRxStatus(ENDP1) != EP_RX_VALID) && (bufferRemainingSpace(&rxBuffer) > 62)) {
SetEPRxStatus(ENDP1, EP_RX_VALID);
}
return read;
@ -319,19 +319,19 @@ void PIOS_USB_HID_EP1_OUT_Callback(void)
/* Use the memory interface function to write to the selected endpoint */
PMAToUserBufferCopy((uint8_t *) rx_buffer, GetEPRxAddr(ENDP1 & 0x7F), DataLength);
/* The first byte is report ID (not checked), the second byte is the valid data length */
#ifdef USB_HID
bufferAddChunkToEnd(&rxBuffer, &rx_buffer[1], PIOS_USB_HID_DATA_LENGTH + 1);
#else
bufferAddChunkToEnd(&rxBuffer, &rx_buffer[2], rx_buffer[1]);
#endif
// Only reactivate endpoint if available space in buffer
if (bufferRemainingSpace(&rxBuffer) > 62) {
SetEPRxStatus(ENDP1, EP_RX_VALID);
} else {
SetEPRxStatus(ENDP1, EP_RX_STALL);
SetEPRxStatus(ENDP1, EP_RX_NAK);
}
}

View File

@ -100,7 +100,7 @@ const uint8_t PIOS_HID_ConfigDescriptor[PIOS_HID_SIZ_CONFIG_DESC] = {
0x03, /* bmAttributes: Interrupt endpoint */
0x40, /* wMaxPacketSize: 2 Bytes max */
0x00,
0x01, /* bInterval: Polling Interval (32 ms) */
0x04, /* bInterval: Polling Interval (32 ms) */
/* 34 */
0x07, /* bLength: Endpoint Descriptor size */
@ -111,7 +111,7 @@ const uint8_t PIOS_HID_ConfigDescriptor[PIOS_HID_SIZ_CONFIG_DESC] = {
0x03, /* bmAttributes: Interrupt endpoint */
0x40, /* wMaxPacketSize: 2 Bytes max */
0x00,
0x01, /* bInterval: Polling Interval (20 ms) */
0x04, /* bInterval: Polling Interval (20 ms) */
/* 41 */
}