From c07f988609cf24ccdd94451eb73cc20c99f09795 Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Tue, 29 Sep 2015 16:46:11 +0200 Subject: [PUSB] Global functions PUSB_* are now methods of PluggableUSB class --- cores/arduino/PluggableUSB.cpp | 8 ++++---- cores/arduino/PluggableUSB.h | 14 ++++++++------ cores/arduino/USBCore.cpp | 6 +++--- 3 files changed, 15 insertions(+), 13 deletions(-) (limited to 'cores/arduino') diff --git a/cores/arduino/PluggableUSB.cpp b/cores/arduino/PluggableUSB.cpp index 9597adc..9dc334e 100644 --- a/cores/arduino/PluggableUSB.cpp +++ b/cores/arduino/PluggableUSB.cpp @@ -35,7 +35,7 @@ static u8 modules_count = 0; static PUSBListNode* rootNode = NULL; -int PUSB_GetInterface(u8* interfaceNum) +int PluggableUSB_::getInterface(u8* interfaceNum) { int ret = 0; PUSBListNode* node = rootNode; @@ -46,7 +46,7 @@ int PUSB_GetInterface(u8* interfaceNum) return ret; } -int PUSB_GetDescriptor(int8_t t) +int PluggableUSB_::getDescriptor(int8_t t) { int ret = 0; PUSBListNode* node = rootNode; @@ -57,7 +57,7 @@ int PUSB_GetDescriptor(int8_t t) return ret; } -bool PUSB_Setup(USBSetup& setup, u8 j) +bool PluggableUSB_::setup(USBSetup& setup, u8 j) { bool ret = false; PUSBListNode* node = rootNode; @@ -68,7 +68,7 @@ bool PUSB_Setup(USBSetup& setup, u8 j) return ret; } -int8_t PUSB_AddFunction(PUSBListNode *node, u8* interface) +int8_t PluggableUSB_::addFunction(PUSBListNode *node, u8* interface) { if (modules_count >= MAX_MODULES) { return 0; diff --git a/cores/arduino/PluggableUSB.h b/cores/arduino/PluggableUSB.h index 9210d7c..dcd9e25 100644 --- a/cores/arduino/PluggableUSB.h +++ b/cores/arduino/PluggableUSB.h @@ -39,13 +39,15 @@ public: PUSBListNode *next = NULL; }; -int8_t PUSB_AddFunction(PUSBListNode *node, u8 *interface); - -int PUSB_GetInterface(u8* interfaceNum); - -int PUSB_GetDescriptor(int8_t t); +class PluggableUSB_ { +public: + static int8_t addFunction(PUSBListNode *node, u8 *interface); + static int getInterface(u8* interfaceNum); + static int getDescriptor(int8_t t); + static bool setup(USBSetup& setup, u8 i); +}; -bool PUSB_Setup(USBSetup& setup, u8 i); +extern PluggableUSB_ PluggableUSB; #endif diff --git a/cores/arduino/USBCore.cpp b/cores/arduino/USBCore.cpp index 733a178..f96ff27 100644 --- a/cores/arduino/USBCore.cpp +++ b/cores/arduino/USBCore.cpp @@ -367,7 +367,7 @@ bool ClassInterfaceRequest(USBSetup& setup) return CDC_Setup(setup); #ifdef PLUGGABLE_USB_ENABLED - return PUSB_Setup(setup, i); + return PluggableUSB.setup(setup, i); #endif return false; } @@ -445,7 +445,7 @@ static u8 SendInterfaces() CDC_GetInterface(&interfaces); #ifdef PLUGGABLE_USB_ENABLED - PUSB_GetInterface(&interfaces); + PluggableUSB.getInterface(&interfaces); #endif return interfaces; @@ -481,7 +481,7 @@ bool SendDescriptor(USBSetup& setup) InitControl(setup.wLength); #ifdef PLUGGABLE_USB_ENABLED - ret = PUSB_GetDescriptor(t); + ret = PluggableUSB.getDescriptor(t); if (ret != 0) { return (ret > 0 ? true : false); } -- cgit v1.2.3-18-g5258