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 | |
parent | 862febf3e28b313b9571605e0ed29cf4e79514af (diff) |
fix pluggableUSB linked list
Diffstat (limited to 'cores/arduino')
-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); |