From 90652295956b6f4bcccb740aeb4f7c546327e499 Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Wed, 30 Sep 2015 16:35:43 +0200 Subject: [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. --- libraries/HID/HID.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'libraries/HID/HID.h') diff --git a/libraries/HID/HID.h b/libraries/HID/HID.h index cb1125e..1c8e2fc 100644 --- a/libraries/HID/HID.h +++ b/libraries/HID/HID.h @@ -80,11 +80,13 @@ public: void SendReport(uint8_t id, const void* data, int len); void AppendDescriptor(HIDDescriptorListNode* node); -private: - static int GetInterface(uint8_t* interfaceNum); - static int GetDescriptor(int8_t t); - static bool Setup(USBSetup& setup, uint8_t i); +protected: + // Implementation of the PUSBListNode + int getInterface(uint8_t* interfaceNum); + int getDescriptor(int8_t t); + bool setup(USBSetup& setup, uint8_t i); +private: static HIDDescriptor hidInterface; static HIDDescriptorListNode* rootNode; -- cgit v1.2.3-18-g5258