1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-18 03:52:11 +01:00

Getting closer for HID. Now a well behaved HID device. Just need to update GCS plugin for new data format and make PJRC wrappre work properly on Mac

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1165 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
peabody124 2010-07-27 19:09:55 +00:00 committed by peabody124
parent 27d429fe18
commit dac82b3c17
2 changed files with 7 additions and 7 deletions

View File

@ -49,7 +49,7 @@ const struct pios_com_driver pios_usb_com_driver = {
static volatile uint8_t rx_buffer_new_data_ctr = 0;
static volatile uint8_t rx_buffer_ix;
static uint8_t transfer_possible = 0;
static uint8_t rx_buffer[PIOS_USB_HID_DATA_LENGTH] = {0};
static uint8_t rx_buffer[PIOS_USB_HID_DATA_LENGTH+2] = {0};
static uint8_t transmit_remaining;
static uint8_t *p_tx_buffer;
@ -164,7 +164,7 @@ int32_t PIOS_USB_HID_TxBufferPutMoreNonBlocking(uint8_t id, const uint8_t *buffe
tx_buffer[0] = 1; /* report ID */
tx_buffer[1] = len; /* valid data length */
UserToPMABufferCopy((uint8_t*) tx_buffer, GetEPTxAddr(EP1_IN & 0x7F), len+2);
// SetEPTxCount((EP1_IN & 0x7F), 10);
SetEPTxCount((EP1_IN & 0x7F), PIOS_USB_HID_DATA_LENGTH+2);
/* Send Buffer */
SetEPTxValid(ENDP1);
@ -206,7 +206,7 @@ int32_t PIOS_USB_HID_RxBufferGet(uint8_t id)
/* There is still data in the buffer */
uint8_t b = rx_buffer[rx_buffer_ix++];
if(--rx_buffer_new_data_ctr == 0) {
rx_buffer_ix = 0;
rx_buffer_ix = 2; //the two bytes are report ID and valid data length respectively
}
/* Return received byte */
@ -239,7 +239,7 @@ void PIOS_USB_HID_EP1_OUT_Callback(void)
PMAToUserBufferCopy((uint8_t *) rx_buffer, GetEPRxAddr(ENDP1 & 0x7F), DataLength);
/* We now have data waiting */
rx_buffer_new_data_ctr = DataLength;
rx_buffer_new_data_ctr = rx_buffer[1];
SetEPRxStatus(ENDP1, EP_RX_VALID);
PIOS_LED_Toggle(LED2);
}

View File

@ -100,7 +100,7 @@ const uint8_t PIOS_HID_ConfigDescriptor[PIOS_HID_SIZ_CONFIG_DESC] =
0x81, /* bEndpointAddress: Endpoint Address (IN) */
0x03, /* bmAttributes: Interrupt endpoint */
0x02, /* wMaxPacketSize: 2 Bytes max */
0x40, /* wMaxPacketSize: 2 Bytes max */
0x00,
0x20, /* bInterval: Polling Interval (32 ms) */
/* 34 */
@ -111,7 +111,7 @@ const uint8_t PIOS_HID_ConfigDescriptor[PIOS_HID_SIZ_CONFIG_DESC] =
0x01, /* bEndpointAddress: */
/* Endpoint Address (OUT) */
0x03, /* bmAttributes: Interrupt endpoint */
0x02, /* wMaxPacketSize: 2 Bytes max */
0x40, /* wMaxPacketSize: 2 Bytes max */
0x00,
0x20, /* bInterval: Polling Interval (20 ms) */
/* 41 */
@ -140,7 +140,7 @@ const uint8_t PIOS_HID_ReportDescriptor[PIOS_HID_SIZ_REPORT_DESC] =
0x15, 0x00, /* LOGICAL_MINIMUM (0) */
0x25, 0xff, /* LOGICAL_MAXIMUM (255) */
0x75, 0x08, /* REPORT_SIZE (8) */
0x95, 0x01, /* REPORT_COUNT (1) */
0x95, PIOS_USB_HID_DATA_LENGTH+1, /* REPORT_COUNT (1) */
0x91, 0x82, /* OUTPUT (Data,Var,Abs,Vol) */
/* 34 */