You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The most common problem of NUM_ENDPOINTS is that one has to guess what EPs to include in the count. Should I include EP0 (yes), should I include EP1 (no)? An even more serious problem is if the user decides to skip some EPs and say only use EP3 (IN) and EP4 (OUT). They think they have 2 EPs and based on other definitions they set NUM_ENDPOINTS to 3 to include EP0. But they should have set it to 4 because the skipped EP2 although isn't initialized, MUST be allocated endpoint_t queue heads because how the rest of the code is written: using EP2 or EP2+1 to address the queue heads as if all EPs before the EP were present.
Three files use this #define, usb_desc.c, usb_desc_h, and usb.c
The text was updated successfully, but these errors were encountered:
While this could be clearer, as a general rule I usually do not change the names of defines or global scope items after the software has been widely published. Sometimes these changes cause a lot of unexpected pain for people who have modified copies of the code. To make this sort of change requires a compelling need.
@liudr What about instead adding a comment line to where NUM_ENDPOINTS is defined? This would add some info, while at the same time meeting Paul’s requirements.
Here is the relevant line that uses the #define:
cores/teensy4/usb.c
Line 65 in fcece80
The most common problem of NUM_ENDPOINTS is that one has to guess what EPs to include in the count. Should I include EP0 (yes), should I include EP1 (no)? An even more serious problem is if the user decides to skip some EPs and say only use EP3 (IN) and EP4 (OUT). They think they have 2 EPs and based on other definitions they set NUM_ENDPOINTS to 3 to include EP0. But they should have set it to 4 because the skipped EP2 although isn't initialized, MUST be allocated endpoint_t queue heads because how the rest of the code is written: using EP2 or EP2+1 to address the queue heads as if all EPs before the EP were present.
Three files use this #define, usb_desc.c, usb_desc_h, and usb.c
The text was updated successfully, but these errors were encountered: