Skip to content

Commit ab0534e

Browse files
committed
tinyusb clean up
1 parent 228b5ea commit ab0534e

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/class/cdc/cdc_device.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ typedef struct
7373
//--------------------------------------------------------------------+
7474
CFG_TUSB_MEM_SECTION static cdcd_interface_t _cdcd_itf[CFG_TUD_CDC];
7575

76-
//bool pending_read_from_host;
76+
//bool pending_read_from_host; TODO remove
7777
static void _prep_out_transaction (uint8_t itf)
7878
{
7979
cdcd_interface_t* p_cdc = &_cdcd_itf[itf];

cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/class/hid/hid_device.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,19 +78,22 @@ bool tud_hid_ready(void)
7878

7979
bool tud_hid_report(uint8_t report_id, void const* report, uint8_t len)
8080
{
81-
TU_VERIFY( tud_hid_ready() && (len <= CFG_TUD_HID_BUFSIZE) );
81+
TU_VERIFY( tud_hid_ready() );
8282

8383
uint8_t itf = 0;
8484
hidd_interface_t * p_hid = &_hidd_itf[itf];
8585

86-
// If report id = 0, skip ID field
8786
if (report_id)
8887
{
88+
len = tu_min8(len, CFG_TUD_HID_BUFSIZE-1);
89+
8990
p_hid->epin_buf[0] = report_id;
9091
memcpy(p_hid->epin_buf+1, report, len);
9192
len++;
9293
}else
9394
{
95+
// If report id = 0, skip ID field
96+
len = tu_min8(len, CFG_TUD_HID_BUFSIZE);
9497
memcpy(p_hid->epin_buf, report, len);
9598
}
9699

cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/device/usbd_pvt.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,10 @@ bool usbd_control_xfer(uint8_t rhport, tusb_control_request_t const * request, v
4747
// Send STATUS (zero length) packet
4848
bool usbd_control_status(uint8_t rhport, tusb_control_request_t const * request);
4949

50-
// Submit a transfer, When complete dcd_event_xfer_complete() is invoked to notify the stack
50+
// Submit a usb transfer
5151
bool usbd_edpt_xfer (uint8_t rhport, uint8_t ep_addr, uint8_t * buffer, uint16_t total_bytes);
5252

53-
// Check if endpoint transferring is complete (TODO remove)
53+
// Check if endpoint transferring is complete
5454
bool usbd_edpt_busy (uint8_t rhport, uint8_t ep_addr);
5555

5656
void usbd_edpt_stall(uint8_t rhport, uint8_t ep_addr);

0 commit comments

Comments
 (0)