aboutsummaryrefslogtreecommitdiff
path: root/libraries/HID/HID.cpp
diff options
context:
space:
mode:
authorCristian Maglie <c.maglie@arduino.cc>2015-09-29 17:10:48 +0200
committerCristian Maglie <c.maglie@arduino.cc>2015-10-02 11:59:22 +0200
commit7811c2ceed8827cd79811f90bc82781326de957f (patch)
tree185c1284f5ce3edfea3a4037664cf632af8a75e7 /libraries/HID/HID.cpp
parentc07f988609cf24ccdd94451eb73cc20c99f09795 (diff)
[HID] Now HID extends directly PluggableUSBListNode
This avoid duplicate instatiation of callback and save a considerable amount of flash.
Diffstat (limited to 'libraries/HID/HID.cpp')
-rw-r--r--libraries/HID/HID.cpp22
1 files changed, 10 insertions, 12 deletions
diff --git a/libraries/HID/HID.cpp b/libraries/HID/HID.cpp
index ec28424..0658711 100644
--- a/libraries/HID/HID.cpp
+++ b/libraries/HID/HID.cpp
@@ -36,6 +36,8 @@ HIDDescriptor _hidInterface;
static HIDDescriptorListNode* rootNode = NULL;
static uint16_t sizeof_hidReportDescriptor = 0;
static uint8_t modules_count = 0;
+static uint8_t epType[] = { EP_TYPE_INTERRUPT_IN };
+
//================================================================================
//================================================================================
// Driver
@@ -132,18 +134,14 @@ bool HID_Setup(USBSetup& setup, uint8_t i)
HID_::HID_(void)
{
- static uint8_t endpointType[1];
- endpointType[0] = EP_TYPE_INTERRUPT_IN;
-
- static PUSBListNode node;
- node.setup = &HID_Setup,
- node.getInterface = &HID_GetInterface,
- node.getDescriptor = &HID_GetDescriptor,
- node.numEndpoints = 1,
- node.numInterfaces = 1,
- node.endpointType = endpointType,
-
- HID_ENDPOINT_INT = PluggableUSB.addFunction(&node, &HID_INTERFACE);
+ setup = &HID_Setup;
+ getInterface = &HID_GetInterface;
+ getDescriptor = &HID_GetDescriptor;
+ numEndpoints = 1;
+ numInterfaces = 1;
+ endpointType = epType;
+
+ HID_ENDPOINT_INT = PluggableUSB.addFunction(this, &HID_INTERFACE);
}
int HID_::begin(void)