Skip to content

Commit 7499bc3

Browse files
committed
more clean up
1 parent fe9e880 commit 7499bc3

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

src/arduino/hid/Adafruit_USBD_HID.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ static uint16_t hid_load_descriptor(uint8_t * dst, uint8_t * itf)
4747

4848
uint8_t ep_in = tinyusb_get_free_in_endpoint();
4949
TU_VERIFY (ep_in != 0);
50+
ep_in |= 0x80;
5051

5152
uint8_t ep_out = 0;
5253
if (_hid_dev->isOutEndpointEnabled())
@@ -55,7 +56,7 @@ static uint16_t hid_load_descriptor(uint8_t * dst, uint8_t * itf)
5556
TU_VERIFY (ep_out != 0);
5657
}
5758

58-
uint16_t const desc_len = _hid_dev->makeItfDesc(*itf, dst, TUD_HID_INOUT_DESC_LEN, 0x80 | ep_in, ep_out);
59+
uint16_t const desc_len = _hid_dev->makeItfDesc(*itf, dst, TUD_HID_INOUT_DESC_LEN, ep_in, ep_out);
5960

6061
*itf+=1;
6162
return desc_len;

src/arduino/msc/Adafruit_USBD_MSC.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,15 @@ static uint16_t msc_load_descriptor(uint8_t * dst, uint8_t * itf)
3939
{
4040
// uint8_t str_index = tinyusb_add_string_descriptor("TinyUSB MSC");
4141
uint8_t str_index = 0;
42-
uint8_t ep_num = tinyusb_get_free_duplex_endpoint();
43-
TU_VERIFY (ep_num != 0);
42+
43+
uint8_t ep_in = tinyusb_get_free_in_endpoint();
44+
uint8_t ep_out = tinyusb_get_free_out_endpoint();
45+
TU_VERIFY (ep_in && ep_out);
46+
ep_in |= 0x80;
4447

4548
uint8_t const descriptor[TUD_MSC_DESC_LEN] = {
4649
// Interface number, string index, EP Out & EP In address, EP size
47-
TUD_MSC_DESCRIPTOR(*itf, str_index, ep_num, (uint8_t)(0x80 | ep_num), EPSIZE)
50+
TUD_MSC_DESCRIPTOR(*itf, str_index, ep_out, ep_in, EPSIZE)
4851
};
4952

5053
*itf+=1;

0 commit comments

Comments
 (0)