aboutsummaryrefslogtreecommitdiff
path: root/cores/arduino/PluggableUSB.h
diff options
context:
space:
mode:
authorCristian Maglie <c.maglie@arduino.cc>2015-09-30 16:35:43 +0200
committerCristian Maglie <c.maglie@arduino.cc>2015-10-02 11:59:23 +0200
commit90652295956b6f4bcccb740aeb4f7c546327e499 (patch)
treed46ac6c9029afcebce9ced39a5ab7963b62dde13 /cores/arduino/PluggableUSB.h
parentab19daef2878e6fdbbe29f69dd0006bdb2508cc3 (diff)
[PUSB] callbacks are now pure virtual methods
This change allows the compiler to handle callbacks resolution. Callbacks now must be implemented on the class that extends PUSBListNode and this is forced by compiler by means of pure virtual methods. Also the calls to HID.interface() and HID.endpoint() can now be simplified to interface() and endpoint() respectively since the methods are no more static.
Diffstat (limited to 'cores/arduino/PluggableUSB.h')
-rw-r--r--cores/arduino/PluggableUSB.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/cores/arduino/PluggableUSB.h b/cores/arduino/PluggableUSB.h
index d4a1096..c08bc99 100644
--- a/cores/arduino/PluggableUSB.h
+++ b/cores/arduino/PluggableUSB.h
@@ -28,9 +28,6 @@
class PUSBListNode {
public:
PUSBListNode() { }
- bool (*setup)(USBSetup& setup, uint8_t i);
- int (*getInterface)(uint8_t* interfaceNum);
- int (*getDescriptor)(int8_t t);
int8_t numEndpoints;
int8_t numInterfaces;
uint8_t *endpointType;
@@ -39,6 +36,10 @@ public:
inline int8_t endpoint() const { return pluggedEndpoint; }
protected:
+ virtual bool setup(USBSetup& setup, uint8_t i) = 0;
+ virtual int getInterface(uint8_t* interfaceNum) = 0;
+ virtual int getDescriptor(int8_t t) = 0;
+
uint8_t pluggedInterface;
int8_t pluggedEndpoint;