mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-18 03:52:11 +01:00
some optimizations, use real rx and tx buffer size instead of max buffer leghts
This commit is contained in:
parent
ce2bce353f
commit
901db6f828
@ -218,12 +218,12 @@ static bool PIOS_USB_HID_SendReport(struct pios_usb_hid_dev *usb_hid_dev)
|
||||
#ifdef PIOS_USB_BOARD_BL_HID_HAS_NO_LENGTH_BYTE
|
||||
PIOS_USBHOOK_EndpointTx(usb_hid_dev->cfg->data_tx_ep,
|
||||
usb_hid_dev->tx_packet_buffer,
|
||||
sizeof(usb_hid_dev->tx_packet_buffer));
|
||||
bytes_to_tx + 1);
|
||||
#else
|
||||
usb_hid_dev->tx_packet_buffer[1] = bytes_to_tx;
|
||||
PIOS_USBHOOK_EndpointTx(usb_hid_dev->cfg->data_tx_ep,
|
||||
usb_hid_dev->tx_packet_buffer,
|
||||
sizeof(usb_hid_dev->tx_packet_buffer));
|
||||
bytes_to_tx + 2);
|
||||
#endif
|
||||
|
||||
#if defined(PIOS_INCLUDE_FREERTOS)
|
||||
|
@ -403,7 +403,8 @@ static uint8_t PIOS_USBHOOK_CLASS_DataIn(void *pdev, uint8_t epnum)
|
||||
|
||||
if ((epnum_idx < NELEMENTS(usb_epin_table)) && usb_epin_table[epnum_idx].cb) {
|
||||
struct usb_ep_entry *ep = &(usb_epin_table[epnum_idx]);
|
||||
if (!ep->cb(ep->context, epnum_idx, ep->max_len)) {
|
||||
uint16_t rxcount = USBD_GetRxCount(pdev, epnum);
|
||||
if (!ep->cb(ep->context, epnum_idx, rxcount)) {
|
||||
/* NOTE: use real endpoint number including direction bit */
|
||||
DCD_SetEPStatus(pdev, epnum, USB_OTG_EP_TX_NAK);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user