Zoltan Hudak / UsbHostMAX3421E

Dependents:   UsbHostMAX3421E_Hello

Files at this revision

API Documentation at this revision

Comitter:
hudakz
Date:
Mon Jul 13 07:03:06 2020 +0000
Parent:
0:84353c479782
Commit message:
MAX3421E-based USB Host Shield Library

Changed in this revision

BTD.cpp Show annotated file Show diff for this revision Revisions of this file
BTD.h Show annotated file Show diff for this revision Revisions of this file
PS3BT.cpp Show annotated file Show diff for this revision Revisions of this file
PS3USB.cpp Show annotated file Show diff for this revision Revisions of this file
PS3USB.h Show annotated file Show diff for this revision Revisions of this file
PS4USB.h Show annotated file Show diff for this revision Revisions of this file
PSBuzz.h Show annotated file Show diff for this revision Revisions of this file
UHS2_gpio.cpp Show annotated file Show diff for this revision Revisions of this file
UHS2_gpio.h Show annotated file Show diff for this revision Revisions of this file
Usb.cpp Show annotated file Show diff for this revision Revisions of this file
Usb.h Show annotated file Show diff for this revision Revisions of this file
UsbCore.h Show annotated file Show diff for this revision Revisions of this file
XBOXOLD.cpp Show annotated file Show diff for this revision Revisions of this file
XBOXOLD.h Show annotated file Show diff for this revision Revisions of this file
XBOXONE.cpp Show annotated file Show diff for this revision Revisions of this file
XBOXONE.h Show annotated file Show diff for this revision Revisions of this file
XBOXRECV.cpp Show annotated file Show diff for this revision Revisions of this file
XBOXRECV.h Show annotated file Show diff for this revision Revisions of this file
XBOXUSB.cpp Show annotated file Show diff for this revision Revisions of this file
XBOXUSB.h Show annotated file Show diff for this revision Revisions of this file
adk.cpp Show annotated file Show diff for this revision Revisions of this file
adk.h Show annotated file Show diff for this revision Revisions of this file
cdc_XR21B1411.cpp Show annotated file Show diff for this revision Revisions of this file
cdc_XR21B1411.h Show annotated file Show diff for this revision Revisions of this file
cdcacm.cpp Show annotated file Show diff for this revision Revisions of this file
cdcacm.h Show annotated file Show diff for this revision Revisions of this file
cdcftdi.cpp Show annotated file Show diff for this revision Revisions of this file
cdcftdi.h Show annotated file Show diff for this revision Revisions of this file
cdcprolific.cpp Show annotated file Show diff for this revision Revisions of this file
cdcprolific.h Show annotated file Show diff for this revision Revisions of this file
controllerEnums.h Show annotated file Show diff for this revision Revisions of this file
hidboot.h Show annotated file Show diff for this revision Revisions of this file
hidcomposite.cpp Show annotated file Show diff for this revision Revisions of this file
hidcomposite.h Show annotated file Show diff for this revision Revisions of this file
hiduniversal.cpp Show annotated file Show diff for this revision Revisions of this file
hiduniversal.h Show annotated file Show diff for this revision Revisions of this file
masstorage.cpp Show annotated file Show diff for this revision Revisions of this file
masstorage.h Show annotated file Show diff for this revision Revisions of this file
usbh_midi.cpp Show annotated file Show diff for this revision Revisions of this file
usbh_midi.h Show annotated file Show diff for this revision Revisions of this file
usbhid.h Show annotated file Show diff for this revision Revisions of this file
usbhub.cpp Show annotated file Show diff for this revision Revisions of this file
usbhub.h Show annotated file Show diff for this revision Revisions of this file
--- a/BTD.cpp	Sun Jul 12 20:39:26 2020 +0000
+++ b/BTD.cpp	Mon Jul 13 07:03:06 2020 +0000
@@ -24,7 +24,7 @@
 const uint8_t BTD::BTD_DATAIN_PIPE = 2;
 const uint8_t BTD::BTD_DATAOUT_PIPE = 3;
 
-BTD::BTD(USB *p) :
+BTD::BTD(Usb *p) :
 connectToWii(false),
 pairWithWii(false),
 connectToHIDDevice(false),
--- a/BTD.h	Sun Jul 12 20:39:26 2020 +0000
+++ b/BTD.h	Mon Jul 13 07:03:06 2020 +0000
@@ -205,7 +205,7 @@
          * Constructor for the BTD class.
          * @param  p   Pointer to USB class instance.
          */
-        BTD(USB *p);
+        BTD(Usb *p);
 
         /** @name USBDeviceConfig implementation */
         /**
@@ -503,7 +503,7 @@
 
 protected:
         /** Pointer to USB class instance. */
-        USB *pUsb;
+        Usb *pUsb;
         /** Device address. */
         uint8_t bAddress;
         /** Endpoint info structure. */
--- a/PS3BT.cpp	Sun Jul 12 20:39:26 2020 +0000
+++ b/PS3BT.cpp	Mon Jul 13 07:03:06 2020 +0000
@@ -16,7 +16,6 @@
  */
 
 #include "PS3BT.h"
-
 // To enable serial debugging see "settings.h"
 //#define EXTRADEBUG // Uncomment to get even more debugging data
 //#define PRINTREPORT // Uncomment to print the report send by the PS3 Controllers
--- a/PS3USB.cpp	Sun Jul 12 20:39:26 2020 +0000
+++ b/PS3USB.cpp	Mon Jul 13 07:03:06 2020 +0000
@@ -20,7 +20,7 @@
 //#define EXTRADEBUG // Uncomment to get even more debugging data
 //#define PRINTREPORT // Uncomment to print the report send by the PS3 Controllers
 
-PS3USB::PS3USB(USB *p, uint8_t btadr5, uint8_t btadr4, uint8_t btadr3, uint8_t btadr2, uint8_t btadr1, uint8_t btadr0) :
+PS3USB::PS3USB(Usb *p, uint8_t btadr5, uint8_t btadr4, uint8_t btadr3, uint8_t btadr2, uint8_t btadr1, uint8_t btadr0) :
 pUsb(p), // pointer to USB class instance - mandatory
 bAddress(0), // device address - mandatory
 bPollEnable(false) // don't start polling before dongle is connected
--- a/PS3USB.h	Sun Jul 12 20:39:26 2020 +0000
+++ b/PS3USB.h	Mon Jul 13 07:03:06 2020 +0000
@@ -55,7 +55,7 @@
          * Pass your dongles Bluetooth address into the constructor,
          * so you are able to pair the controller with a Bluetooth dongle.
          */
-        PS3USB(USB *pUsb, uint8_t btadr5 = 0, uint8_t btadr4 = 0, uint8_t btadr3 = 0, uint8_t btadr2 = 0, uint8_t btadr1 = 0, uint8_t btadr0 = 0);
+        PS3USB(Usb *pUsb, uint8_t btadr5 = 0, uint8_t btadr4 = 0, uint8_t btadr3 = 0, uint8_t btadr2 = 0, uint8_t btadr1 = 0, uint8_t btadr0 = 0);
 
         /** @name USBDeviceConfig implementation */
         /**
@@ -265,7 +265,7 @@
 
 protected:
         /** Pointer to USB class instance. */
-        USB *pUsb;
+        Usb *pUsb;
         /** Device address. */
         uint8_t bAddress;
         /** Endpoint info structure. */
--- a/PS4USB.h	Sun Jul 12 20:39:26 2020 +0000
+++ b/PS4USB.h	Mon Jul 13 07:03:06 2020 +0000
@@ -35,7 +35,7 @@
          * Constructor for the PS4USB class.
          * @param  p   Pointer to the USB class instance.
          */
-        PS4USB(USB *p) :
+        PS4USB(Usb *p) :
         HIDUniversal(p) {
                 PS4Parser::Reset();
         };
--- a/PSBuzz.h	Sun Jul 12 20:39:26 2020 +0000
+++ b/PSBuzz.h	Mon Jul 13 07:03:06 2020 +0000
@@ -46,7 +46,7 @@
          * Constructor for the PSBuzz class.
          * @param  p   Pointer to the USB class instance.
          */
-        PSBuzz(USB *p) :
+        PSBuzz(Usb *p) :
         HIDUniversal(p) {
                 Reset();
         };
--- a/UHS2_gpio.cpp	Sun Jul 12 20:39:26 2020 +0000
+++ b/UHS2_gpio.cpp	Mon Jul 13 07:03:06 2020 +0000
@@ -29,7 +29,7 @@
 /** @brief  Implement an instance of a UHS2_GPIO object
 *   @param  pUSB Pointer to a UHS2 USB object
 */
-UHS2_GPIO::UHS2_GPIO(USB *pUsb) : m_pUsb(pUsb)
+UHS2_GPIO::UHS2_GPIO(Usb *pUsb) : m_pUsb(pUsb)
 {
 }
 
--- a/UHS2_gpio.h	Sun Jul 12 20:39:26 2020 +0000
+++ b/UHS2_gpio.h	Mon Jul 13 07:03:06 2020 +0000
@@ -31,14 +31,14 @@
 
 class UHS2_GPIO {
 public:
-        UHS2_GPIO(USB *pUsb);
+        UHS2_GPIO(Usb *pUsb);
 
         void digitalWrite(uint8_t pin, uint8_t val);
         int digitalRead(uint8_t pin);
         int digitalReadOutput(uint8_t pin);
 
 private:
-        USB* m_pUsb;
+        Usb* m_pUsb;
 };
 
 #endif // __USB2_GPIO_H__
--- a/Usb.cpp	Sun Jul 12 20:39:26 2020 +0000
+++ b/Usb.cpp	Mon Jul 13 07:03:06 2020 +0000
@@ -21,7 +21,7 @@
 static uint8_t  usb_task_state;
 
 /* constructor */
-USB::USB(PinName mosi, PinName miso, PinName sck, PinName ss, PinName intr) :
+Usb::Usb(PinName mosi, PinName miso, PinName sck, PinName ss, PinName intr) :
     MAX3421E(mosi, miso, sck, ss, intr),
     bmHubPre(0)
 {
@@ -30,7 +30,7 @@
 }
 
 /* Initialize data structures */
-int8_t USB::init()
+int8_t Usb::init()
 {
     //devConfigIndex = 0;
     bmHubPre = 0;
@@ -43,7 +43,7 @@
  * @param
  * @retval
  */
-uint8_t USB::getUsbTaskState(void)
+uint8_t Usb::getUsbTaskState(void)
 {
     return(usb_task_state);
 }
@@ -54,7 +54,7 @@
  * @param
  * @retval
  */
-void USB::setUsbTaskState(uint8_t state)
+void Usb::setUsbTaskState(uint8_t state)
 {
     usb_task_state = state;
 }
@@ -65,7 +65,7 @@
  * @param
  * @retval
  */
-EpInfo* USB::getEpInfoEntry(uint8_t addr, uint8_t ep)
+EpInfo* Usb::getEpInfoEntry(uint8_t addr, uint8_t ep)
 {
     UsbDevice*  p = addrPool.GetUsbDevicePtr(addr);
 
@@ -87,7 +87,7 @@
 /* set device table entry */
 
 /* each device is different and has different number of endpoints. This function plugs endpoint record structure, defined in application, to devtable */
-uint8_t USB::setEpInfoEntry(uint8_t addr, uint8_t epcount, EpInfo* eprecord_ptr)
+uint8_t Usb::setEpInfoEntry(uint8_t addr, uint8_t epcount, EpInfo* eprecord_ptr)
 {
     if (!eprecord_ptr)
         return USB_ERROR_INVALID_ARGUMENT;
@@ -110,7 +110,7 @@
  * @param
  * @retval
  */
-uint8_t USB::setAddress(uint8_t addr, uint8_t ep, EpInfo ** ppep, uint16_t* nak_limit)
+uint8_t Usb::setAddress(uint8_t addr, uint8_t ep, EpInfo ** ppep, uint16_t* nak_limit)
 {
     UsbDevice*  p = addrPool.GetUsbDevicePtr(addr);
 
@@ -155,7 +155,7 @@
 /* 00       =   success         */
 
 /* 01-0f    =   non-zero HRSLT  */
-uint8_t USB::ctrlReq
+uint8_t Usb::ctrlReq
 (
     uint8_t         addr,
     uint8_t         ep,
@@ -257,7 +257,7 @@
 
 /* rcode 0 if no errors. rcode 01-0f is relayed from dispatchPkt(). Rcode f0 means RCVDAVIRQ error,
             fe USB xfer timeout */
-uint8_t USB::inTransfer(uint8_t addr, uint8_t ep, uint16_t* nbytesptr, uint8_t* data, uint8_t bInterval /*= 0*/ )
+uint8_t Usb::inTransfer(uint8_t addr, uint8_t ep, uint16_t* nbytesptr, uint8_t* data, uint8_t bInterval /*= 0*/ )
 {
     EpInfo*     pep = NULL;
     uint16_t    nak_limit = 0;
@@ -280,7 +280,7 @@
  * @param
  * @retval
  */
-uint8_t USB::inTransfer(EpInfo* pep, uint16_t nak_limit, uint16_t* nbytesptr, uint8_t* data, uint8_t bInterval /*= 0*/ )
+uint8_t Usb::inTransfer(EpInfo* pep, uint16_t nak_limit, uint16_t* nbytesptr, uint8_t* data, uint8_t bInterval /*= 0*/ )
 {
     uint8_t     rcode = 0;
     uint8_t     pktsize;
@@ -375,7 +375,7 @@
 /* Handles NAK bug per Maxim Application Note 4000 for single buffer transfer   */
 
 /* rcode 0 if no errors. rcode 01-0f is relayed from HRSL                       */
-uint8_t USB::outTransfer(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t* data)
+uint8_t Usb::outTransfer(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t* data)
 {
     EpInfo*     pep = NULL;
     uint16_t    nak_limit = 0;
@@ -394,7 +394,7 @@
  * @param
  * @retval
  */
-uint8_t USB::outTransfer(EpInfo* pep, uint16_t nak_limit, uint16_t nbytes, uint8_t* data)
+uint8_t Usb::outTransfer(EpInfo* pep, uint16_t nak_limit, uint16_t nbytes, uint8_t* data)
 {
     uint8_t     rcode = hrSUCCESS, retry_count;
     uint8_t*    data_p = data;                                  //local copy of the data pointer
@@ -493,7 +493,7 @@
 /* If bus timeout, re-sends up to USB_RETRY_LIMIT times                                             */
 
 /* return codes 0x00-0x0f are HRSLT( 0x00 being success ), 0xff means timeout                       */
-uint8_t USB::dispatchPkt(uint8_t token, uint8_t ep, uint16_t nak_limit)
+uint8_t Usb::dispatchPkt(uint8_t token, uint8_t ep, uint16_t nak_limit)
 {
     uint32_t    timeout = (uint32_t)millis() + USB_XFER_TIMEOUT;
     uint8_t     tmpdata;
@@ -548,7 +548,7 @@
 }
 
 /* USB main task. Performs enumeration/cleanup */
-void USB::task(void)    //USB state machine
+void Usb::task(void)    //USB state machine
 {
     uint8_t         rcode;
     uint8_t         tmpdata;
@@ -677,7 +677,7 @@
  * @param
  * @retval
  */
-uint8_t USB::defaultAddressing(uint8_t parent, uint8_t port, bool lowspeed)
+uint8_t Usb::defaultAddressing(uint8_t parent, uint8_t port, bool lowspeed)
 {
     //uint8_t                buf[12];
     uint8_t     rcode;
@@ -726,7 +726,7 @@
  * @param
  * @retval
  */
-uint8_t USB::attemptConfig(uint8_t driver, uint8_t parent, uint8_t port, bool lowspeed)
+uint8_t Usb::attemptConfig(uint8_t driver, uint8_t parent, uint8_t port, bool lowspeed)
 {
     //printf("AttemptConfig: parent = %i, port = %i\r\n", parent, port);
     uint8_t retries = 0;
@@ -826,7 +826,7 @@
  * 8: if we get here, no driver likes the device plugged in, so exit failure.
  *
  */
-uint8_t USB::configuring(uint8_t parent, uint8_t port, bool lowspeed)
+uint8_t Usb::configuring(uint8_t parent, uint8_t port, bool lowspeed)
 {
     //uint8_t bAddress = 0;
 
@@ -948,7 +948,7 @@
  * @param
  * @retval
  */
-uint8_t USB::releaseDevice(uint8_t addr)
+uint8_t Usb::releaseDevice(uint8_t addr)
 {
     if (!addr)
         return 0;
@@ -966,7 +966,7 @@
 #if 1   //!defined(USB_METHODS_INLINE)
 
 //get device descriptor
-uint8_t USB::getDevDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t* dataptr)
+uint8_t Usb::getDevDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t* dataptr)
 {
     return
         (
@@ -988,7 +988,7 @@
 }
 
 //get configuration descriptor
-uint8_t USB::getConfDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t conf, uint8_t* dataptr)
+uint8_t Usb::getConfDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t conf, uint8_t* dataptr)
 {
     return
         (
@@ -1011,7 +1011,7 @@
 
 /* Requests Configuration Descriptor. Sends two Get Conf Descr requests. The first one gets the total length of all descriptors, then the second one requests this
  total length. The length of the first request can be shorter ( 4 bytes ), however, there are devices which won't work unless this length is set to 9 */
-uint8_t USB::getConfDescr(uint8_t addr, uint8_t ep, uint8_t conf, USBReadParser* p)
+uint8_t Usb::getConfDescr(uint8_t addr, uint8_t ep, uint8_t conf, USBReadParser* p)
 {
     const uint8_t                   bufSize = 64;
     uint8_t                         buf[bufSize];
@@ -1046,7 +1046,7 @@
 }
 
 //get string descriptor
-uint8_t USB::getStrDescr(uint8_t addr, uint8_t ep, uint16_t ns, uint8_t index, uint16_t langid, uint8_t* dataptr)
+uint8_t Usb::getStrDescr(uint8_t addr, uint8_t ep, uint16_t ns, uint8_t index, uint16_t langid, uint8_t* dataptr)
 {
     return
         (
@@ -1068,7 +1068,7 @@
 }
 
 //set address
-uint8_t USB::setAddr(uint8_t oldaddr, uint8_t ep, uint8_t newaddr)
+uint8_t Usb::setAddr(uint8_t oldaddr, uint8_t ep, uint8_t newaddr)
 {
     uint8_t rcode = ctrlReq
         (
@@ -1093,7 +1093,7 @@
 }
 
 //set configuration
-uint8_t USB::setConf(uint8_t addr, uint8_t ep, uint8_t conf_value)
+uint8_t Usb::setConf(uint8_t addr, uint8_t ep, uint8_t conf_value)
 {
     return
         (
--- a/Usb.h	Sun Jul 12 20:39:26 2020 +0000
+++ b/Usb.h	Mon Jul 13 07:03:06 2020 +0000
@@ -44,6 +44,4 @@
 #include "confdescparser.h"
 #include "millis.h"
 
-#define M_PI        3.14159265358979323846
-
 #endif //_usb_h_
--- a/UsbCore.h	Sun Jul 12 20:39:26 2020 +0000
+++ b/UsbCore.h	Mon Jul 13 07:03:06 2020 +0000
@@ -174,13 +174,13 @@
     virtual void    Parse(const uint16_t len, const uint8_t* pbuf, const uint16_t& offset) = 0;
 };
 
-class USB : public MAX3421E
+class Usb : public MAX3421E
 {
     AddressPoolImpl<USB_NUMDEVICES> addrPool;
     USBDeviceConfig*                devConfig[USB_NUMDEVICES];
     uint8_t                         bmHubPre;
 public:
-    USB(PinName mosi, PinName miso, PinName sck, PinName ss, PinName intr);
+    Usb(PinName mosi, PinName miso, PinName sck, PinName ss, PinName intr);
     int8_t          init();
     void            SetHubPreMask()     { bmHubPre |= bmHUBPRE; }
     void            ResetHubPreMask()   { bmHubPre &= (~bmHUBPRE); }
@@ -258,7 +258,7 @@
 #if 0   //defined(USB_METHODS_INLINE)
 
 //get device descriptor
-inline uint8_t USB::getDevDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t* dataptr)
+inline uint8_t Usb::getDevDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t* dataptr)
 {
     return
         (
@@ -278,7 +278,7 @@
 }
 
 //get configuration descriptor
-inline uint8_t USB::getConfDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t conf, uint8_t* dataptr)
+inline uint8_t Usb::getConfDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t conf, uint8_t* dataptr)
 {
     return
         (
@@ -298,7 +298,7 @@
 }
 
 //get string descriptor
-inline uint8_t USB::getStrDescr
+inline uint8_t Usb::getStrDescr
 (
     uint8_t     addr,
     uint8_t     ep,
@@ -326,13 +326,13 @@
 }
 
 //set address
-inline uint8_t USB::setAddr(uint8_t oldaddr, uint8_t ep, uint8_t newaddr)
+inline uint8_t Usb::setAddr(uint8_t oldaddr, uint8_t ep, uint8_t newaddr)
 {
     return(ctrlReq(oldaddr, ep, bmREQ_SET, USB_REQUEST_SET_ADDRESS, newaddr, 0x00, 0x0000, 0x0000, NULL));
 }
 
 //set configuration
-inline uint8_t USB::setConf(uint8_t addr, uint8_t ep, uint8_t conf_value)
+inline uint8_t Usb::setConf(uint8_t addr, uint8_t ep, uint8_t conf_value)
 {
     return(ctrlReq(addr, ep, bmREQ_SET, USB_REQUEST_SET_CONFIGURATION, conf_value, 0x00, 0x0000, 0x0000, NULL));
 }
--- a/XBOXOLD.cpp	Sun Jul 12 20:39:26 2020 +0000
+++ b/XBOXOLD.cpp	Mon Jul 13 07:03:06 2020 +0000
@@ -44,7 +44,7 @@
         3, // Y
 };
 
-XBOXOLD::XBOXOLD(USB *p) :
+XBOXOLD::XBOXOLD(Usb *p) :
 pUsb(p), // pointer to USB class instance - mandatory
 bAddress(0), // device address - mandatory
 bPollEnable(false) { // don't start polling before dongle is connected
--- a/XBOXOLD.h	Sun Jul 12 20:39:26 2020 +0000
+++ b/XBOXOLD.h	Mon Jul 13 07:03:06 2020 +0000
@@ -49,7 +49,7 @@
          * Constructor for the XBOXOLD class.
          * @param  pUsb   Pointer to USB class instance.
          */
-        XBOXOLD(USB *pUsb);
+        XBOXOLD(Usb *pUsb);
 
         /** @name USBDeviceConfig implementation */
         /**
@@ -146,7 +146,7 @@
 
 protected:
         /** Pointer to USB class instance. */
-        USB *pUsb;
+        Usb *pUsb;
         /** Device address. */
         uint8_t bAddress;
         /** Endpoint info structure. */
--- a/XBOXONE.cpp	Sun Jul 12 20:39:26 2020 +0000
+++ b/XBOXONE.cpp	Mon Jul 13 07:03:06 2020 +0000
@@ -24,7 +24,7 @@
 //#define EXTRADEBUG // Uncomment to get even more debugging data
 //#define PRINTREPORT // Uncomment to print the report send by the Xbox ONE Controller
 
-XBOXONE::XBOXONE(USB *p) :
+XBOXONE::XBOXONE(Usb *p) :
 pUsb(p), // pointer to USB class instance - mandatory
 bAddress(0), // device address - mandatory
 bNumEP(1), // If config descriptor needs to be parsed
--- a/XBOXONE.h	Sun Jul 12 20:39:26 2020 +0000
+++ b/XBOXONE.h	Mon Jul 13 07:03:06 2020 +0000
@@ -69,7 +69,7 @@
          * Constructor for the XBOXONE class.
          * @param  pUsb   Pointer to USB class instance.
          */
-        XBOXONE(USB *pUsb);
+        XBOXONE(Usb *pUsb);
 
         /** @name USBDeviceConfig implementation */
         /**
@@ -176,7 +176,7 @@
 
 protected:
         /** Pointer to USB class instance. */
-        USB *pUsb;
+        Usb *pUsb;
         /** Device address. */
         uint8_t bAddress;
         /** Endpoint info structure. */
--- a/XBOXRECV.cpp	Sun Jul 12 20:39:26 2020 +0000
+++ b/XBOXRECV.cpp	Mon Jul 13 07:03:06 2020 +0000
@@ -22,7 +22,7 @@
 //#define EXTRADEBUG // Uncomment to get even more debugging data
 //#define PRINTREPORT // Uncomment to print the report send by the Xbox 360 Controller
 
-XBOXRECV::XBOXRECV(USB *p) :
+XBOXRECV::XBOXRECV(Usb *p) :
 pUsb(p), // pointer to USB class instance - mandatory
 bAddress(0), // device address - mandatory
 bPollEnable(false) { // don't start polling before dongle is connected
--- a/XBOXRECV.h	Sun Jul 12 20:39:26 2020 +0000
+++ b/XBOXRECV.h	Mon Jul 13 07:03:06 2020 +0000
@@ -58,7 +58,7 @@
          * Constructor for the XBOXRECV class.
          * @param  pUsb   Pointer to USB class instance.
          */
-        XBOXRECV(USB *pUsb);
+        XBOXRECV(Usb *pUsb);
 
         /** @name USBDeviceConfig implementation */
         /**
@@ -232,7 +232,7 @@
 
 protected:
         /** Pointer to USB class instance. */
-        USB *pUsb;
+        Usb *pUsb;
         /** Device address. */
         uint8_t bAddress;
         /** Endpoint info structure. */
--- a/XBOXUSB.cpp	Sun Jul 12 20:39:26 2020 +0000
+++ b/XBOXUSB.cpp	Mon Jul 13 07:03:06 2020 +0000
@@ -20,7 +20,7 @@
 //#define EXTRADEBUG // Uncomment to get even more debugging data
 //#define PRINTREPORT // Uncomment to print the report send by the Xbox 360 Controller
 
-XBOXUSB::XBOXUSB(USB *p) :
+XBOXUSB::XBOXUSB(Usb *p) :
 pUsb(p), // pointer to USB class instance - mandatory
 bAddress(0), // device address - mandatory
 bPollEnable(false) { // don't start polling before dongle is connected
--- a/XBOXUSB.h	Sun Jul 12 20:39:26 2020 +0000
+++ b/XBOXUSB.h	Mon Jul 13 07:03:06 2020 +0000
@@ -56,7 +56,7 @@
          * Constructor for the XBOXUSB class.
          * @param  pUsb   Pointer to USB class instance.
          */
-        XBOXUSB(USB *pUsb);
+        XBOXUSB(Usb *pUsb);
 
         /** @name USBDeviceConfig implementation */
         /**
@@ -186,7 +186,7 @@
 
 protected:
         /** Pointer to USB class instance. */
-        USB *pUsb;
+        Usb *pUsb;
         /** Device address. */
         uint8_t bAddress;
         /** Endpoint info structure. */
--- a/adk.cpp	Sun Jul 12 20:39:26 2020 +0000
+++ b/adk.cpp	Mon Jul 13 07:03:06 2020 +0000
@@ -22,7 +22,7 @@
 const uint8_t ADK::epDataInIndex = 1;
 const uint8_t ADK::epDataOutIndex = 2;
 
-ADK::ADK(USB *p, const char* manufacturer,
+ADK::ADK(Usb *p, const char* manufacturer,
         const char* model,
         const char* description,
         const char* version,
--- a/adk.h	Sun Jul 12 20:39:26 2020 +0000
+++ b/adk.h	Mon Jul 13 07:03:06 2020 +0000
@@ -70,7 +70,7 @@
         static const uint8_t epDataOutIndex; // DataOUT endpoint index
 
         /* mandatory members */
-        USB *pUsb;
+        Usb *pUsb;
         uint8_t bAddress;
         uint8_t bConfNum; // configuration number
 
@@ -83,7 +83,7 @@
         void PrintEndpointDescriptor(const USB_ENDPOINT_DESCRIPTOR* ep_ptr);
 
 public:
-        ADK(USB *pUsb, const char* manufacturer,
+        ADK(Usb *pUsb, const char* manufacturer,
                 const char* model,
                 const char* description,
                 const char* version,
--- a/cdc_XR21B1411.cpp	Sun Jul 12 20:39:26 2020 +0000
+++ b/cdc_XR21B1411.cpp	Mon Jul 13 07:03:06 2020 +0000
@@ -16,7 +16,7 @@
  */
 #include "cdc_XR21B1411.h"
 
-XR21B1411::XR21B1411(USB *p, CDCAsyncOper *pasync) :
+XR21B1411::XR21B1411(Usb *p, CDCAsyncOper *pasync) :
 ACM(p, pasync) {
         // Is this needed??
         _enhanced_status = enhanced_features(); // Set up features
--- a/cdc_XR21B1411.h	Sun Jul 12 20:39:26 2020 +0000
+++ b/cdc_XR21B1411.h	Mon Jul 13 07:03:06 2020 +0000
@@ -104,7 +104,7 @@
 protected:
 
 public:
-        XR21B1411(USB *pusb, CDCAsyncOper *pasync);
+        XR21B1411(Usb *pusb, CDCAsyncOper *pasync);
 
         /**
          * Used by the USB core to check what this driver support.
--- a/cdcacm.cpp	Sun Jul 12 20:39:26 2020 +0000
+++ b/cdcacm.cpp	Mon Jul 13 07:03:06 2020 +0000
@@ -20,7 +20,7 @@
 const uint8_t ACM::epDataOutIndex = 2;
 const uint8_t ACM::epInterruptInIndex = 3;
 
-ACM::ACM(USB *p, CDCAsyncOper *pasync) :
+ACM::ACM(Usb *p, CDCAsyncOper *pasync) :
 pUsb(p),
 pAsync(pasync),
 bAddress(0),
--- a/cdcacm.h	Sun Jul 12 20:39:26 2020 +0000
+++ b/cdcacm.h	Mon Jul 13 07:03:06 2020 +0000
@@ -162,7 +162,7 @@
 
 class ACM : public USBDeviceConfig, public UsbConfigXtracter {
 protected:
-        USB *pUsb;
+        Usb *pUsb;
         CDCAsyncOper *pAsync;
         uint8_t bAddress;
         uint8_t bConfNum; // configuration number
@@ -182,7 +182,7 @@
         static const uint8_t epInterruptInIndex; // InterruptIN  endpoint index
         EpInfo epInfo[ACM_MAX_ENDPOINTS];
 
-        ACM(USB *pusb, CDCAsyncOper *pasync);
+        ACM(Usb *pusb, CDCAsyncOper *pasync);
 
         uint8_t SetCommFeature(uint16_t fid, uint8_t nbytes, uint8_t *dataptr);
         uint8_t GetCommFeature(uint16_t fid, uint8_t nbytes, uint8_t *dataptr);
--- a/cdcftdi.cpp	Sun Jul 12 20:39:26 2020 +0000
+++ b/cdcftdi.cpp	Mon Jul 13 07:03:06 2020 +0000
@@ -20,7 +20,7 @@
 const uint8_t FTDI::epDataOutIndex = 2;
 const uint8_t FTDI::epInterruptInIndex = 3;
 
-FTDI::FTDI(USB *p, FTDIAsyncOper *pasync, uint16_t idProduct) :
+FTDI::FTDI(Usb *p, FTDIAsyncOper *pasync, uint16_t idProduct) :
 pAsync(pasync),
 pUsb(p),
 bAddress(0),
--- a/cdcftdi.h	Sun Jul 12 20:39:26 2020 +0000
+++ b/cdcftdi.h	Mon Jul 13 07:03:06 2020 +0000
@@ -101,7 +101,7 @@
         static const uint8_t epInterruptInIndex; // InterruptIN  endpoint index
 
         FTDIAsyncOper *pAsync;
-        USB *pUsb;
+        Usb *pUsb;
         uint8_t bAddress;
         uint8_t bConfNum; // configuration number
         uint8_t bNumIface; // number of interfaces in the configuration
@@ -117,7 +117,7 @@
         void PrintEndpointDescriptor(const USB_ENDPOINT_DESCRIPTOR* ep_ptr);
 
 public:
-        FTDI(USB *pusb, FTDIAsyncOper *pasync, uint16_t idProduct = FTDI_PID);
+        FTDI(Usb *pusb, FTDIAsyncOper *pasync, uint16_t idProduct = FTDI_PID);
 
         uint8_t SetBaudRate(uint32_t baud);
         uint8_t SetModemControl(uint16_t control);
--- a/cdcprolific.cpp	Sun Jul 12 20:39:26 2020 +0000
+++ b/cdcprolific.cpp	Mon Jul 13 07:03:06 2020 +0000
@@ -16,7 +16,7 @@
  */
 #include "cdcprolific.h"
 
-PL2303::PL2303(USB *p, CDCAsyncOper *pasync) :
+PL2303::PL2303(Usb *p, CDCAsyncOper *pasync) :
 ACM(p, pasync),
 wPLType(0) {
 }
--- a/cdcprolific.h	Sun Jul 12 20:39:26 2020 +0000
+++ b/cdcprolific.h	Mon Jul 13 07:03:06 2020 +0000
@@ -123,7 +123,7 @@
         uint16_t wPLType; // Type of chip
 
 public:
-        PL2303(USB *pusb, CDCAsyncOper *pasync);
+        PL2303(Usb *pusb, CDCAsyncOper *pasync);
 
         // USBDeviceConfig implementation
         uint8_t Init(uint8_t parent, uint8_t port, bool lowspeed);
--- a/controllerEnums.h	Sun Jul 12 20:39:26 2020 +0000
+++ b/controllerEnums.h	Mon Jul 13 07:03:06 2020 +0000
@@ -18,13 +18,14 @@
 #ifndef _controllerenums_h
 #define _controllerenums_h
 
-#ifdef __MBED__
+#ifdef  TOOLCHAIN_GCC
 #include "math.h"
+#else
+#define M_PI        3.14159265358979323846
+#endif
+
 #define RAD_TO_DEG  180/M_PI
-#define micros  millis
-#else
-#define M_PI PI
-#endif
+#define micros      millis
 
 #if defined(ESP32)
 #undef PS
--- a/hidboot.h	Sun Jul 12 20:39:26 2020 +0000
+++ b/hidboot.h	Mon Jul 13 07:03:06 2020 +0000
@@ -219,7 +219,7 @@
         };
 
 public:
-        HIDBoot(USB *p, bool bRptProtoEnable = false);
+        HIDBoot(Usb *p, bool bRptProtoEnable = false);
 
         virtual bool SetReportParser(uint8_t id, HIDReportParser *prs) {
                 pRptParser[id] = prs;
@@ -253,7 +253,7 @@
 };
 
 template <const uint8_t BOOT_PROTOCOL>
-HIDBoot<BOOT_PROTOCOL>::HIDBoot(USB *p, bool bRptProtoEnable/* = false*/) :
+HIDBoot<BOOT_PROTOCOL>::HIDBoot(Usb *p, bool bRptProtoEnable/* = false*/) :
 USBHID(p),
 qNextPollTime(0),
 bPollEnable(false),
--- a/hidcomposite.cpp	Sun Jul 12 20:39:26 2020 +0000
+++ b/hidcomposite.cpp	Mon Jul 13 07:03:06 2020 +0000
@@ -17,7 +17,7 @@
 
 #include "hidcomposite.h"
 
-HIDComposite::HIDComposite(USB *p) :
+HIDComposite::HIDComposite(Usb *p) :
 USBHID(p),
 qNextPollTime(0),
 pollInterval(0),
--- a/hidcomposite.h	Sun Jul 12 20:39:26 2020 +0000
+++ b/hidcomposite.h	Mon Jul 13 07:03:06 2020 +0000
@@ -77,7 +77,7 @@
         };
 
 public:
-        HIDComposite(USB *p);
+        HIDComposite(Usb *p);
 
         // HID implementation
         bool SetReportParser(uint8_t id, HIDReportParser *prs);
--- a/hiduniversal.cpp	Sun Jul 12 20:39:26 2020 +0000
+++ b/hiduniversal.cpp	Mon Jul 13 07:03:06 2020 +0000
@@ -17,7 +17,7 @@
 
 #include "hiduniversal.h"
 
-HIDUniversal::HIDUniversal(USB *p) :
+HIDUniversal::HIDUniversal(Usb *p) :
 USBHID(p),
 qNextPollTime(0),
 pollInterval(0),
--- a/hiduniversal.h	Sun Jul 12 20:39:26 2020 +0000
+++ b/hiduniversal.h	Mon Jul 13 07:03:06 2020 +0000
@@ -80,7 +80,7 @@
         };
 
 public:
-        HIDUniversal(USB *p);
+        HIDUniversal(Usb *p);
 
         // HID implementation
         bool SetReportParser(uint8_t id, HIDReportParser *prs);
--- a/masstorage.cpp	Sun Jul 12 20:39:26 2020 +0000
+++ b/masstorage.cpp	Mon Jul 13 07:03:06 2020 +0000
@@ -226,7 +226,7 @@
 
 ////////////////////////////////////////////////////////////////////////////////
 
-BulkOnly::BulkOnly(USB *p) :
+BulkOnly::BulkOnly(Usb *p) :
 pUsb(p),
 bAddress(0),
 bIface(0),
--- a/masstorage.h	Sun Jul 12 20:39:26 2020 +0000
+++ b/masstorage.h	Mon Jul 13 07:03:06 2020 +0000
@@ -472,7 +472,7 @@
         static const uint8_t epDataOutIndex; // DataOUT endpoint index
         static const uint8_t epInterruptInIndex; // InterruptIN  endpoint index
 
-        USB *pUsb;
+        Usb *pUsb;
         uint8_t bAddress;
         uint8_t bConfNum; // configuration number
         uint8_t bIface; // interface value
@@ -500,7 +500,7 @@
                 return 0;
         };
 public:
-        BulkOnly(USB *p);
+        BulkOnly(Usb *p);
 
         uint8_t GetLastUsbError() {
                 return bLastUsbError;
--- a/usbh_midi.cpp	Sun Jul 12 20:39:26 2020 +0000
+++ b/usbh_midi.cpp	Mon Jul 13 07:03:06 2020 +0000
@@ -84,7 +84,7 @@
 const uint8_t USBH_MIDI::epDataInIndexVSP  = 3;
 const uint8_t USBH_MIDI::epDataOutIndexVSP = 4;
 
-USBH_MIDI::USBH_MIDI(USB *p) :
+USBH_MIDI::USBH_MIDI(Usb *p) :
 pUsb(p),
 bAddress(0),
 bNumEP(1),
--- a/usbh_midi.h	Sun Jul 12 20:39:26 2020 +0000
+++ b/usbh_midi.h	Mon Jul 13 07:03:06 2020 +0000
@@ -45,7 +45,7 @@
         static const uint8_t    epDataOutIndexVSP;      // DataOUT endpoint index(Vendor Specific Protocl)
 
         /* mandatory members */
-        USB      *pUsb;
+        Usb      *pUsb;
         uint8_t  bAddress;
         uint8_t  bConfNum;    // configuration number
         uint8_t  bNumEP;      // total number of EP in the configuration
@@ -66,7 +66,7 @@
         void PrintEndpointDescriptor( const USB_ENDPOINT_DESCRIPTOR* ep_ptr );
 #endif
 public:
-        USBH_MIDI(USB *p);
+        USBH_MIDI(Usb *p);
         // Misc functions
         operator bool() { return (pUsb->getUsbTaskState()==USB_STATE_RUNNING); }
         uint16_t idVendor() { return vid; }
--- a/usbhid.h	Sun Jul 12 20:39:26 2020 +0000
+++ b/usbhid.h	Mon Jul 13 07:03:06 2020 +0000
@@ -142,7 +142,7 @@
 
 class USBHID : public USBDeviceConfig, public UsbConfigXtracter {
 protected:
-        USB *pUsb; // USB class instance pointer
+        Usb *pUsb; // USB class instance pointer
         uint8_t bAddress; // address
 
 protected:
@@ -162,10 +162,10 @@
 
 public:
 
-        USBHID(USB *pusb) : pUsb(pusb) {
+        USBHID(Usb *pusb) : pUsb(pusb) {
         };
 
-        const USB* GetUsb() {
+        const Usb* GetUsb() {
                 return pUsb;
         };
 
--- a/usbhub.cpp	Sun Jul 12 20:39:26 2020 +0000
+++ b/usbhub.cpp	Mon Jul 13 07:03:06 2020 +0000
@@ -18,7 +18,7 @@
 
 bool USBHub::bResetInitiated = false;
 
-USBHub::USBHub(USB *p) :
+USBHub::USBHub(Usb *p) :
 pUsb(p),
 bAddress(0),
 bNbrPorts(0),
--- a/usbhub.h	Sun Jul 12 20:39:26 2020 +0000
+++ b/usbhub.h	Mon Jul 13 07:03:06 2020 +0000
@@ -164,7 +164,7 @@
 class USBHub : USBDeviceConfig {
         static bool bResetInitiated; // True when reset is triggered
 
-        USB *pUsb; // USB class instance pointer
+        Usb *pUsb; // USB class instance pointer
 
         EpInfo epInfo[2]; // interrupt endpoint info structure
 
@@ -178,7 +178,7 @@
         uint8_t PortStatusChange(uint8_t port, HubEvent &evt);
 
 public:
-        USBHub(USB *p);
+        USBHub(Usb *p);
 
         uint8_t ClearHubFeature(uint8_t fid);
         uint8_t ClearPortFeature(uint8_t fid, uint8_t port, uint8_t sel = 0);
@@ -247,6 +247,6 @@
         return ( pUsb->ctrlReq(bAddress, 0, bmREQ_SET_PORT_FEATURE, USB_REQUEST_SET_FEATURE, fid, 0, (((0x0000 | sel) << 8) | port), 0, 0, NULL, NULL));
 }
 
-void PrintHubPortStatus(USB *usbptr, uint8_t addr, uint8_t port, bool print_changes = false);
+void PrintHubPortStatus(Usb *usbptr, uint8_t addr, uint8_t port, bool print_changes = false);
 
 #endif // __USBHUB_H__