diff options
author | Martino Facchin <m.facchin@arduino.cc> | 2015-10-01 17:35:26 +0200 |
---|---|---|
committer | Cristian Maglie <c.maglie@arduino.cc> | 2015-10-02 11:59:24 +0200 |
commit | 8cab209ef91cbda34bae8afa880f152c4f1473b0 (patch) | |
tree | 8dd9e1d4a4ded2f4de3c578d60502e0a3e6fda89 /libraries/HID/HID.cpp | |
parent | 66d3eabe42fa4590b111d3fe8442c0e556acedcd (diff) |
[PUSB] Fix static initialization order fiasco
For details see:
https://isocpp.org/wiki/faq/ctors#static-init-order-on-first-use
Diffstat (limited to 'libraries/HID/HID.cpp')
-rw-r--r-- | libraries/HID/HID.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/libraries/HID/HID.cpp b/libraries/HID/HID.cpp index b7aab6c..ff8e67b 100644 --- a/libraries/HID/HID.cpp +++ b/libraries/HID/HID.cpp @@ -21,7 +21,11 @@ #if defined(USBCON) -HID_ HID; +HID_& HID() +{ + static HID_ obj; + return obj; +} int HID_::getInterface(uint8_t* interfaceNum) { @@ -113,7 +117,7 @@ HID_::HID_(void) : PUSBListNode(1, 1, epType), protocol(1), idle(1) { epType[0] = EP_TYPE_INTERRUPT_IN; - PluggableUSB.plug(this); + PluggableUSB().plug(this); } int HID_::begin(void) |