diff options
-rw-r--r-- | cores/arduino/PluggableUSB.cpp | 8 | ||||
-rw-r--r-- | cores/arduino/PluggableUSB.h | 2 |
2 files changed, 6 insertions, 4 deletions
diff --git a/cores/arduino/PluggableUSB.cpp b/cores/arduino/PluggableUSB.cpp index 68a6c8a..857a27f 100644 --- a/cores/arduino/PluggableUSB.cpp +++ b/cores/arduino/PluggableUSB.cpp @@ -34,7 +34,6 @@ extern u8 _initEndpoints[]; static u8 modules_count = 0; static PUSBListNode* rootNode = NULL; -static PUSBListNode* lastNode = NULL; int PUSB_GetInterface(u8* interfaceNum) { @@ -77,9 +76,12 @@ int8_t PUSB_AddFunction(PUSBListNode *node, u8* interface) if (modules_count == 0) { rootNode = node; - lastNode = node; } else { - lastNode->next = node; + PUSBListNode *current = rootNode; + while(current->next != NULL) { + current = current->next; + } + current->next = node; } *interface = lastIf; diff --git a/cores/arduino/PluggableUSB.h b/cores/arduino/PluggableUSB.h index 647980b..d89040e 100644 --- a/cores/arduino/PluggableUSB.h +++ b/cores/arduino/PluggableUSB.h @@ -25,7 +25,7 @@ #if defined(USBCON) -typedef struct +typedef struct __attribute__((packed)) { bool (*setup)(USBSetup& setup, u8 i); int (*getInterface)(u8* interfaceNum); |