From 0369b8ec333482b63b16ba47608f5cca75ac974f Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Wed, 30 Sep 2015 16:48:11 +0200 Subject: [PATCH] [PUSB] The latest fields are now set via constructor --- hardware/arduino/avr/cores/arduino/PluggableUSB.h | 11 +++++++---- hardware/arduino/avr/libraries/HID/HID.cpp | 7 ++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/hardware/arduino/avr/cores/arduino/PluggableUSB.h b/hardware/arduino/avr/cores/arduino/PluggableUSB.h index c08bc9992..0f776c080 100644 --- a/hardware/arduino/avr/cores/arduino/PluggableUSB.h +++ b/hardware/arduino/avr/cores/arduino/PluggableUSB.h @@ -27,10 +27,9 @@ class PUSBListNode { public: - PUSBListNode() { } - int8_t numEndpoints; - int8_t numInterfaces; - uint8_t *endpointType; + PUSBListNode(int8_t numEps, int8_t numIfs, uint8_t *epType) : + numEndpoints(numEps), numInterfaces(numIfs), endpointType(epType) + { } inline uint8_t interface() const { return pluggedInterface; } inline int8_t endpoint() const { return pluggedEndpoint; } @@ -43,6 +42,10 @@ protected: uint8_t pluggedInterface; int8_t pluggedEndpoint; + const int8_t numEndpoints; + const int8_t numInterfaces; + const uint8_t *endpointType; + public: PUSBListNode *next = NULL; diff --git a/hardware/arduino/avr/libraries/HID/HID.cpp b/hardware/arduino/avr/libraries/HID/HID.cpp index 568595726..d358f4512 100644 --- a/hardware/arduino/avr/libraries/HID/HID.cpp +++ b/hardware/arduino/avr/libraries/HID/HID.cpp @@ -128,12 +128,9 @@ bool HID_::setup(USBSetup& setup, uint8_t i) } } -HID_::HID_(void) +HID_::HID_(void) : PUSBListNode(1, 1, epType) { - numEndpoints = 1; - numInterfaces = 1; - endpointType = epType; - + // XXX: Shall this be done in PUSBListNode(...) constructor? PluggableUSB.plug(this); }