mirror of
https://github.com/arduino/Arduino.git
synced 2025-02-20 14:54:31 +01:00
[PUSB] Removed unnecessary endpoint and interface function
This commit is contained in:
parent
c8867462a8
commit
05477fc85d
@ -31,9 +31,6 @@ public:
|
|||||||
numEndpoints(numEps), numInterfaces(numIfs), endpointType(epType)
|
numEndpoints(numEps), numInterfaces(numIfs), endpointType(epType)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
inline uint8_t interface() const { return pluggedInterface; }
|
|
||||||
inline uint8_t endpoint() const { return pluggedEndpoint; }
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual bool setup(USBSetup& setup) = 0;
|
virtual bool setup(USBSetup& setup) = 0;
|
||||||
virtual int getInterface(uint8_t* interfaceCount) = 0;
|
virtual int getInterface(uint8_t* interfaceCount) = 0;
|
||||||
|
@ -31,16 +31,16 @@ int HID_::getInterface(uint8_t* interfaceCount)
|
|||||||
{
|
{
|
||||||
*interfaceCount += 1; // uses 1
|
*interfaceCount += 1; // uses 1
|
||||||
HIDDescriptor hidInterface = {
|
HIDDescriptor hidInterface = {
|
||||||
D_INTERFACE(interface(), 1, 3, 0, 0),
|
D_INTERFACE(pluggedInterface, 1, 3, 0, 0),
|
||||||
D_HIDREPORT(descriptorSize),
|
D_HIDREPORT(descriptorSize),
|
||||||
D_ENDPOINT(USB_ENDPOINT_IN(endpoint()), USB_ENDPOINT_TYPE_INTERRUPT, USB_EP_SIZE, 0x01)
|
D_ENDPOINT(USB_ENDPOINT_IN(pluggedEndpoint), USB_ENDPOINT_TYPE_INTERRUPT, USB_EP_SIZE, 0x01)
|
||||||
};
|
};
|
||||||
return USB_SendControl(0, &hidInterface, sizeof(hidInterface));
|
return USB_SendControl(0, &hidInterface, sizeof(hidInterface));
|
||||||
}
|
}
|
||||||
|
|
||||||
int HID_::getDescriptor(USBSetup& setup)
|
int HID_::getDescriptor(USBSetup& setup)
|
||||||
{
|
{
|
||||||
if (interface() != setup.wIndex) {
|
if (pluggedInterface != setup.wIndex) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -71,13 +71,13 @@ void HID_::AppendDescriptor(HIDDescriptorListNode *node)
|
|||||||
|
|
||||||
void HID_::SendReport(uint8_t id, const void* data, int len)
|
void HID_::SendReport(uint8_t id, const void* data, int len)
|
||||||
{
|
{
|
||||||
USB_Send(endpoint(), &id, 1);
|
USB_Send(pluggedEndpoint, &id, 1);
|
||||||
USB_Send(endpoint() | TRANSFER_RELEASE, data, len);
|
USB_Send(pluggedEndpoint | TRANSFER_RELEASE, data, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool HID_::setup(USBSetup& setup)
|
bool HID_::setup(USBSetup& setup)
|
||||||
{
|
{
|
||||||
if (interface() != setup.wIndex) {
|
if (pluggedInterface != setup.wIndex) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user