Skip to content

Commit 05477fc

Browse files
committed
[PUSB] Removed unnecessary endpoint and interface function
1 parent c886746 commit 05477fc

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

hardware/arduino/avr/cores/arduino/PluggableUSB.h

-3
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,6 @@ class PUSBListNode {
3131
numEndpoints(numEps), numInterfaces(numIfs), endpointType(epType)
3232
{ }
3333

34-
inline uint8_t interface() const { return pluggedInterface; }
35-
inline uint8_t endpoint() const { return pluggedEndpoint; }
36-
3734
protected:
3835
virtual bool setup(USBSetup& setup) = 0;
3936
virtual int getInterface(uint8_t* interfaceCount) = 0;

hardware/arduino/avr/libraries/HID/HID.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,16 @@ int HID_::getInterface(uint8_t* interfaceCount)
3131
{
3232
*interfaceCount += 1; // uses 1
3333
HIDDescriptor hidInterface = {
34-
D_INTERFACE(interface(), 1, 3, 0, 0),
34+
D_INTERFACE(pluggedInterface, 1, 3, 0, 0),
3535
D_HIDREPORT(descriptorSize),
36-
D_ENDPOINT(USB_ENDPOINT_IN(endpoint()), USB_ENDPOINT_TYPE_INTERRUPT, USB_EP_SIZE, 0x01)
36+
D_ENDPOINT(USB_ENDPOINT_IN(pluggedEndpoint), USB_ENDPOINT_TYPE_INTERRUPT, USB_EP_SIZE, 0x01)
3737
};
3838
return USB_SendControl(0, &hidInterface, sizeof(hidInterface));
3939
}
4040

4141
int HID_::getDescriptor(USBSetup& setup)
4242
{
43-
if (interface() != setup.wIndex) {
43+
if (pluggedInterface != setup.wIndex) {
4444
return 0;
4545
}
4646

@@ -71,13 +71,13 @@ void HID_::AppendDescriptor(HIDDescriptorListNode *node)
7171

7272
void HID_::SendReport(uint8_t id, const void* data, int len)
7373
{
74-
USB_Send(endpoint(), &id, 1);
75-
USB_Send(endpoint() | TRANSFER_RELEASE, data, len);
74+
USB_Send(pluggedEndpoint, &id, 1);
75+
USB_Send(pluggedEndpoint | TRANSFER_RELEASE, data, len);
7676
}
7777

7878
bool HID_::setup(USBSetup& setup)
7979
{
80-
if (interface() != setup.wIndex) {
80+
if (pluggedInterface != setup.wIndex) {
8181
return false;
8282
}
8383

0 commit comments

Comments
 (0)