diff options
author | Martino Facchin <m.facchin@arduino.cc> | 2015-07-02 12:08:53 +0200 |
---|---|---|
committer | Cristian Maglie <c.maglie@arduino.cc> | 2015-07-16 13:13:52 +0200 |
commit | b0bdb476942ea105463fd8fdbc076d2b104a7176 (patch) | |
tree | 546e8c6f2cdfee4554660551dd97ecce7993c839 /cores/arduino/PluggableUSB.cpp | |
parent | 862febf3e28b313b9571605e0ed29cf4e79514af (diff) |
fix pluggableUSB linked list
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; |