diff options
Diffstat (limited to 'cores/arduino/PluggableUSB.cpp')
-rw-r--r-- | cores/arduino/PluggableUSB.cpp | 8 |
1 files changed, 5 insertions, 3 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; |