USB device stack

Dependents:   mbed-mX-USB-TEST1 USBMSD_SD_HID_HelloWorld HidTest MIDI_usb_bridge ... more

Legacy Warning

This is an mbed 2 library. To learn more about mbed OS 5, visit the docs.

Pull requests against this repository are no longer supported. Please raise against mbed OS 5 as documented above.

Files at this revision

API Documentation at this revision

Comitter:
mbed_official
Date:
Tue Jun 03 11:30:32 2014 +0100
Parent:
24:33920e3786aa
Child:
26:8ef73dd868a0
Commit message:
Synchronized with git revision bcacbb9fbf3432829227430830cca4315b57c1b9

Full URL: https://github.com/mbedmicro/mbed/commit/bcacbb9fbf3432829227430830cca4315b57c1b9/

Changed in this revision

USBAudio/USBAudio.h Show annotated file Show diff for this revision Revisions of this file
USBDevice/USBDescriptor.h Show annotated file Show diff for this revision Revisions of this file
USBDevice/USBDevice.cpp Show annotated file Show diff for this revision Revisions of this file
USBDevice/USBDevice.h Show annotated file Show diff for this revision Revisions of this file
USBDevice/USBEndpoints_KL25Z.h Show annotated file Show diff for this revision Revisions of this file
USBDevice/USBHAL.h Show annotated file Show diff for this revision Revisions of this file
USBDevice/USBHAL_LPC11U.cpp Show annotated file Show diff for this revision Revisions of this file
USBDevice/USBHAL_LPC17.cpp Show annotated file Show diff for this revision Revisions of this file
USBDevice/USBHAL_LPC40.cpp Show annotated file Show diff for this revision Revisions of this file
USBDevice/USBHAL_STM32F4.cpp Show annotated file Show diff for this revision Revisions of this file
USBDevice/USBRegs_STM32.h Show annotated file Show diff for this revision Revisions of this file
USBHID/USBHID.cpp Show annotated file Show diff for this revision Revisions of this file
USBHID/USBHID.h Show annotated file Show diff for this revision Revisions of this file
USBHID/USBKeyboard.cpp Show annotated file Show diff for this revision Revisions of this file
USBHID/USBKeyboard.h Show annotated file Show diff for this revision Revisions of this file
USBHID/USBMouse.h Show annotated file Show diff for this revision Revisions of this file
USBHID/USBMouseKeyboard.cpp Show annotated file Show diff for this revision Revisions of this file
USBHID/USBMouseKeyboard.h Show annotated file Show diff for this revision Revisions of this file
USBMIDI/MIDIMessage.h Show annotated file Show diff for this revision Revisions of this file
USBMIDI/USBMIDI.h Show annotated file Show diff for this revision Revisions of this file
USBMSD/USBMSD.h Show annotated file Show diff for this revision Revisions of this file
USBSerial/USBCDC.cpp Show annotated file Show diff for this revision Revisions of this file
USBSerial/USBCDC.h Show annotated file Show diff for this revision Revisions of this file
USBSerial/USBSerial.h Show annotated file Show diff for this revision Revisions of this file
--- a/USBAudio/USBAudio.h	Fri May 16 09:00:39 2014 +0100
+++ b/USBAudio/USBAudio.h	Tue Jun 03 11:30:32 2014 +0100
@@ -50,7 +50,7 @@
 *
 * int main() {
 *    int16_t buf[AUDIO_LENGTH_PACKET/2];
-*    
+*
 *    while (1) {
 *        // read an audio packet
 *        audio.read((uint8_t *)buf);
@@ -88,7 +88,7 @@
     * @returns volume
     */
     float getVolume();
-    
+
     /**
     * Read an audio packet. During a frame, only a single reading (you can't write and read an audio packet during the same frame)can be done using this method. Warning: Blocking
     *
@@ -97,7 +97,7 @@
     * @returns true if successfull
     */
     bool read(uint8_t * buf);
-    
+
     /**
     * Try to read an audio packet. During a frame, only a single reading (you can't write and read an audio packet during the same frame)can be done using this method. Warning: Non Blocking
     *
@@ -106,7 +106,7 @@
     * @returns true if successfull
     */
     bool readNB(uint8_t * buf);
-    
+
     /**
     * Write an audio packet. During a frame, only a single writing (you can't write and read an audio packet during the same frame)can be done using this method.
     *
@@ -114,7 +114,7 @@
     * @returns true if successful
     */
     bool write(uint8_t * buf);
-    
+
     /**
     * Write and read an audio packet at the same time (on the same frame)
     *
@@ -123,7 +123,7 @@
     * @returns true if successful
     */
     bool readWrite(uint8_t * buf_read, uint8_t * buf_write);
-    
+
 
     /** attach a handler to update the volume
      *
@@ -212,12 +212,12 @@
     * Callback called on each Start of Frame event
     */
     virtual void SOF(int frameNumber);
-    
+
     /*
     * Callback called when a packet is received
     */
     virtual bool EP3_OUT_callback();
-    
+
     /*
     * Callback called when a packet has been sent
     */
@@ -227,13 +227,13 @@
 
     // stream available ?
     volatile bool available;
-    
+
     // interrupt OUT has been received
     volatile bool interruptOUT;
-    
+
     // interrupt IN has been received
     volatile bool interruptIN;
-    
+
     // audio packet has been written
     volatile bool writeIN;
 
@@ -248,7 +248,7 @@
     // mono, stereo,...
     uint8_t channel_nb_in;
     uint8_t channel_nb_out;
-    
+
     // channel config: master, left, right
     uint8_t channel_config_in;
     uint8_t channel_config_out;
@@ -270,16 +270,16 @@
 
     // Buffer containing one audio packet (to be read)
     volatile uint8_t * buf_stream_in;
-    
+
     // Buffer containing one audio packet (to be written)
     volatile uint8_t * buf_stream_out;
-    
+
     // callback to update volume
     FunctionPointer updateVol;
-    
+
     // boolean showing that the SOF handler has been called. Useful for readNB.
     volatile bool SOF_handler;
-    
+
     volatile float volume;
 
 };
--- a/USBDevice/USBDescriptor.h	Fri May 16 09:00:39 2014 +0100
+++ b/USBDevice/USBDescriptor.h	Tue Jun 03 11:30:32 2014 +0100
@@ -32,7 +32,7 @@
 
 
 /*string offset*/
-#define STRING_OFFSET_LANGID            (0) 
+#define STRING_OFFSET_LANGID            (0)
 #define STRING_OFFSET_IMANUFACTURER     (1)
 #define STRING_OFFSET_IPRODUCT          (2)
 #define STRING_OFFSET_ISERIAL           (3)
--- a/USBDevice/USBDevice.cpp	Fri May 16 09:00:39 2014 +0100
+++ b/USBDevice/USBDevice.cpp	Tue Jun 03 11:30:32 2014 +0100
@@ -106,7 +106,7 @@
                                 transfer.ptr = stringImanufacturerDesc();
                                 transfer.direction = DEVICE_TO_HOST;
                                 success = true;
-                                break;       
+                                break;
                             case STRING_OFFSET_IPRODUCT:
 #ifdef DEBUG
                                 printf("3\r\n");
@@ -115,7 +115,7 @@
                                 transfer.ptr = stringIproductDesc();
                                 transfer.direction = DEVICE_TO_HOST;
                                 success = true;
-                                break;            
+                                break;
                             case STRING_OFFSET_ISERIAL:
 #ifdef DEBUG
                                 printf("4\r\n");
@@ -124,7 +124,7 @@
                                 transfer.ptr = stringIserialDesc();
                                 transfer.direction = DEVICE_TO_HOST;
                                 success = true;
-                                break;        
+                                break;
                             case STRING_OFFSET_ICONFIGURATION:
 #ifdef DEBUG
                                 printf("5\r\n");
@@ -133,7 +133,7 @@
                                 transfer.ptr = stringIConfigurationDesc();
                                 transfer.direction = DEVICE_TO_HOST;
                                 success = true;
-                                break; 
+                                break;
                             case STRING_OFFSET_IINTERFACE:
 #ifdef DEBUG
                                 printf("6\r\n");
@@ -142,7 +142,7 @@
                                 transfer.ptr = stringIinterfaceDesc();
                                 transfer.direction = DEVICE_TO_HOST;
                                 success = true;
-                                break; 
+                                break;
             }
             break;
         case INTERFACE_DESCRIPTOR:
@@ -357,7 +357,7 @@
     {
         success = true;
         currentInterface = transfer.setup.wIndex;
-        currentAlternate = transfer.setup.wValue;       
+        currentAlternate = transfer.setup.wValue;
     }
     return success;
 }
@@ -473,12 +473,12 @@
 
     if (success)
     {
-        /* Send the status */ 
+        /* Send the status */
         transfer.ptr = (uint8_t *)&status; /* Assumes little endian */
         transfer.remaining = sizeof(status);
         transfer.direction = DEVICE_TO_HOST;
     }
-    
+
     return success;
 }
 
@@ -546,7 +546,7 @@
     transfer.direction = 0;
     transfer.zlp = false;
     transfer.notify = false;
-    
+
 #ifdef DEBUG
     printf("dataTransferDirection: %d\r\nType: %d\r\nRecipient: %d\r\nbRequest: %d\r\nwValue: %d\r\nwIndex: %d\r\nwLength: %d\r\n",transfer.setup.bmRequestType.dataTransferDirection,
                                                                                                                                    transfer.setup.bmRequestType.Type,
@@ -593,7 +593,7 @@
         }
         else
         {
-            
+
             /* OUT data stage is required */
             if (transfer.direction != HOST_TO_DEVICE)
             {
@@ -707,7 +707,7 @@
 {
     /* Connect device */
     USBHAL::connect();
-    
+
     if (blocking) {
         /* Block if not configured */
         while (!configured());
@@ -793,8 +793,8 @@
 
 
 USBDevice::USBDevice(uint16_t vendor_id, uint16_t product_id, uint16_t product_release){
-    VENDOR_ID = vendor_id; 
-    PRODUCT_ID = product_id; 
+    VENDOR_ID = vendor_id;
+    PRODUCT_ID = product_id;
     PRODUCT_RELEASE = product_release;
 
     /* Set initial device state */
@@ -818,12 +818,12 @@
     {
         return false;
     }
-    
-    
+
+
     if(!configured()) {
         return false;
     }
-    
+
     /* Send report */
     result = endpointWrite(endpoint, buffer, size);
 
@@ -849,7 +849,7 @@
     {
         return false;
     }
-    
+
     if(!configured()) {
         return false;
     }
@@ -872,7 +872,7 @@
 bool USBDevice::readEP(uint8_t endpoint, uint8_t * buffer, uint32_t * size, uint32_t maxSize)
 {
     EP_STATUS result;
-    
+
     if(!configured()) {
         return false;
     }
@@ -889,13 +889,13 @@
 bool USBDevice::readEP_NB(uint8_t endpoint, uint8_t * buffer, uint32_t * size, uint32_t maxSize)
 {
     EP_STATUS result;
-    
+
     if(!configured()) {
         return false;
     }
 
     result = endpointReadResult(endpoint, buffer, size);
-    
+
     return (result == EP_COMPLETED);
 }
 
--- a/USBDevice/USBDevice.h	Fri May 16 09:00:39 2014 +0100
+++ b/USBDevice/USBDevice.h	Tue Jun 03 11:30:32 2014 +0100
@@ -27,26 +27,26 @@
 {
 public:
     USBDevice(uint16_t vendor_id, uint16_t product_id, uint16_t product_release);
-    
+
     /*
     * Check if the device is configured
     *
     * @returns true if configured, false otherwise
     */
     bool configured(void);
-    
+
     /*
     * Connect a device
-    * 
+    *
     * @param blocking: block if not configured
     */
     void connect(bool blocking = true);
-    
+
     /*
     * Disconnect a device
     */
     void disconnect(void);
-    
+
     /*
     * Add an endpoint
     *
@@ -65,7 +65,7 @@
     * @return true if successful
     */
     bool readStart(uint8_t endpoint, uint32_t maxSize);
-    
+
     /*
     * Read a certain endpoint. Before calling this function, USBUSBDevice_readStart
     * must be called.
@@ -79,20 +79,20 @@
     * @returns true if successful
     */
     bool readEP(uint8_t endpoint, uint8_t * buffer, uint32_t * size, uint32_t maxSize);
-    
+
     /*
     * Read a certain endpoint.
     *
     * Warning: non blocking
     *
     * @param endpoint endpoint which will be read
-    * @param buffer buffer will be filled with the data received (if data are available) 
+    * @param buffer buffer will be filled with the data received (if data are available)
     * @param size the number of bytes read will be stored in *size
     * @param maxSize the maximum length that can be read
     * @returns true if successful
     */
     bool readEP_NB(uint8_t endpoint, uint8_t * buffer, uint32_t * size, uint32_t maxSize);
-    
+
     /*
     * Write a certain endpoint.
     *
@@ -104,8 +104,8 @@
     * @param maxSize the maximum length that can be written on this endpoint
     */
     bool write(uint8_t endpoint, uint8_t * buffer, uint32_t size, uint32_t maxSize);
-    
-    
+
+
     /*
     * Write a certain endpoint.
     *
@@ -118,14 +118,14 @@
     */
     bool writeNB(uint8_t endpoint, uint8_t * buffer, uint32_t size, uint32_t maxSize);
 
-    
+
     /*
     * Called by USBDevice layer on bus reset. Warning: Called in ISR context
     *
     * May be used to reset state
     */
     virtual void USBCallback_busReset(void) {};
-    
+
     /*
     * Called by USBDevice on Endpoint0 request. Warning: Called in ISR context
     * This is used to handle extensions to standard requests
@@ -133,8 +133,8 @@
     *
     * @returns true if class handles this request
     */
-    virtual bool USBCallback_request() { return false; };   
-    
+    virtual bool USBCallback_request() { return false; };
+
     /*
     * Called by USBDevice on Endpoint0 request completion
     * if the 'notify' flag has been set to true. Warning: Called in ISR context
@@ -146,7 +146,7 @@
     * @param length length of this buffer
     */
     virtual void USBCallback_requestCompleted(uint8_t * buf, uint32_t length) {};
-    
+
     /*
     * Called by USBDevice layer. Set configuration of the device.
     * For instance, you can add all endpoints that you need on this function.
@@ -154,7 +154,7 @@
     * @param configuration Number of the configuration
     */
     virtual bool USBCallback_setConfiguration(uint8_t configuration) { return false; };
-    
+
     /*
      * Called by USBDevice layer. Set interface/alternate of the device.
      *
@@ -170,63 +170,63 @@
     * @returns pointer to the device descriptor
     */
     virtual uint8_t * deviceDesc();
-    
+
     /*
     * Get configuration descriptor
     *
     * @returns pointer to the configuration descriptor
     */
     virtual uint8_t * configurationDesc(){return NULL;};
-    
+
     /*
     * Get string lang id descriptor
     *
     * @return pointer to the string lang id descriptor
     */
     virtual uint8_t * stringLangidDesc();
-    
+
     /*
     * Get string manufacturer descriptor
     *
     * @returns pointer to the string manufacturer descriptor
     */
     virtual uint8_t * stringImanufacturerDesc();
-    
+
     /*
     * Get string product descriptor
     *
     * @returns pointer to the string product descriptor
     */
     virtual uint8_t * stringIproductDesc();
-    
+
     /*
     * Get string serial descriptor
     *
     * @returns pointer to the string serial descriptor
     */
     virtual uint8_t * stringIserialDesc();
-    
+
     /*
     * Get string configuration descriptor
     *
     * @returns pointer to the string configuration descriptor
     */
     virtual uint8_t * stringIConfigurationDesc();
-    
+
     /*
     * Get string interface descriptor
     *
     * @returns pointer to the string interface descriptor
     */
     virtual uint8_t * stringIinterfaceDesc();
-    
+
     /*
     * Get the length of the report descriptor
     *
     * @returns length of the report descriptor
     */
     virtual uint16_t reportDescLength() { return 0; };
-    
+
 
 
 protected:
@@ -238,7 +238,7 @@
     virtual void suspendStateChanged(unsigned int suspended);
     uint8_t * findDescriptor(uint8_t descriptorType);
     CONTROL_TRANSFER * getTransferPtr(void);
-    
+
     uint16_t VENDOR_ID;
     uint16_t PRODUCT_ID;
     uint16_t PRODUCT_RELEASE;
@@ -262,7 +262,7 @@
 
     CONTROL_TRANSFER transfer;
     USB_DEVICE device;
-    
+
     uint16_t currentInterface;
     uint8_t currentAlternate;
 };
--- a/USBDevice/USBEndpoints_KL25Z.h	Fri May 16 09:00:39 2014 +0100
+++ b/USBDevice/USBEndpoints_KL25Z.h	Tue Jun 03 11:30:32 2014 +0100
@@ -23,38 +23,38 @@
 
 /*      Endpoint    No.   */
 /*      ----------------  */
-#define EP0OUT      (0)  
-#define EP0IN       (1)  
-#define EP1OUT      (2)  
-#define EP1IN       (3)  
-#define EP2OUT      (4)  
-#define EP2IN       (5)  
-#define EP3OUT      (6)  
-#define EP3IN       (7)  
-#define EP4OUT      (8)  
-#define EP4IN       (9)  
-#define EP5OUT      (10) 
-#define EP5IN       (11) 
-#define EP6OUT      (12) 
-#define EP6IN       (13) 
-#define EP7OUT      (14) 
-#define EP7IN       (15) 
-#define EP8OUT      (16) 
-#define EP8IN       (17) 
-#define EP9OUT      (18) 
-#define EP9IN       (19) 
-#define EP10OUT     (20) 
-#define EP10IN      (21) 
-#define EP11OUT     (22) 
-#define EP11IN      (23) 
-#define EP12OUT     (24) 
-#define EP12IN      (25) 
-#define EP13OUT     (26) 
-#define EP13IN      (27) 
-#define EP14OUT     (28) 
-#define EP14IN      (29) 
-#define EP15OUT     (30) 
-#define EP15IN      (31) 
+#define EP0OUT      (0)
+#define EP0IN       (1)
+#define EP1OUT      (2)
+#define EP1IN       (3)
+#define EP2OUT      (4)
+#define EP2IN       (5)
+#define EP3OUT      (6)
+#define EP3IN       (7)
+#define EP4OUT      (8)
+#define EP4IN       (9)
+#define EP5OUT      (10)
+#define EP5IN       (11)
+#define EP6OUT      (12)
+#define EP6IN       (13)
+#define EP7OUT      (14)
+#define EP7IN       (15)
+#define EP8OUT      (16)
+#define EP8IN       (17)
+#define EP9OUT      (18)
+#define EP9IN       (19)
+#define EP10OUT     (20)
+#define EP10IN      (21)
+#define EP11OUT     (22)
+#define EP11IN      (23)
+#define EP12OUT     (24)
+#define EP12IN      (25)
+#define EP13OUT     (26)
+#define EP13IN      (27)
+#define EP14OUT     (28)
+#define EP14IN      (29)
+#define EP15OUT     (30)
+#define EP15IN      (31)
 
 /* Maximum Packet sizes */
 
--- a/USBDevice/USBHAL.h	Fri May 16 09:00:39 2014 +0100
+++ b/USBDevice/USBHAL.h	Tue Jun 03 11:30:32 2014 +0100
@@ -58,7 +58,7 @@
     bool realiseEndpoint(uint8_t endpoint, uint32_t maxPacket, uint32_t options);
     bool getEndpointStallState(unsigned char endpoint);
     uint32_t endpointReadcore(uint8_t endpoint, uint8_t *buffer);
-    
+
 protected:
     virtual void busReset(void){};
     virtual void EP0setupCallback(void){};
@@ -67,7 +67,7 @@
     virtual void connectStateChanged(unsigned int connected){};
     virtual void suspendStateChanged(unsigned int suspended){};
     virtual void SOF(int frameNumber){};
-            
+
     virtual bool EP1_OUT_callback(){return false;};
     virtual bool EP1_IN_callback(){return false;};
     virtual bool EP2_OUT_callback(){return false;};
@@ -102,7 +102,7 @@
     virtual bool EP15_IN_callback(){return false;};
 #endif
 #endif
-    
+
 private:
     void usbisr(void);
     static void _usbisr(void);
@@ -116,6 +116,6 @@
         bool (USBHAL::*epCallback[32 - 2])(void);
 #endif
 
-        
+
 };
 #endif
--- a/USBDevice/USBHAL_LPC11U.cpp	Fri May 16 09:00:39 2014 +0100
+++ b/USBDevice/USBHAL_LPC11U.cpp	Tue Jun 03 11:30:32 2014 +0100
@@ -134,7 +134,7 @@
 
 USBHAL::USBHAL(void) {
     NVIC_DisableIRQ(USB_IRQ);
-    
+
     // fill in callback array
     epCallback[0] = &USBHAL::EP1_OUT_callback;
     epCallback[1] = &USBHAL::EP1_IN_callback;
@@ -149,7 +149,7 @@
     // USB_VBUS input with pull-down
     LPC_IOCON->PIO0_3 = 0x00000009;
     #endif
-    
+
     // nUSB_CONNECT output
     LPC_IOCON->PIO0_6 = 0x00000001;
 
@@ -287,13 +287,13 @@
             bf = 0;
         }
     }
-    
+
     // if isochronous endpoint, T = 1
     if(endpointState[endpoint].options & ISOCHRONOUS)
     {
         flags |= CMDSTS_T;
     }
-        
+
     //Active the endpoint for reading
     ep[PHY_TO_LOG(endpoint)].out[bf] = CMDSTS_A | CMDSTS_NBYTES(maximumSize) \
                                        | CMDSTS_ADDRESS_OFFSET((uint32_t)ct->out) | flags;
@@ -408,7 +408,7 @@
 
 EP_STATUS USBHAL::endpointWriteResult(uint8_t endpoint) {
     uint32_t bf;
-    
+
     // Validate parameters
     if (endpoint > LAST_PHYSICAL_ENDPOINT) {
         return EP_INVALID;
@@ -680,7 +680,7 @@
         // EP0IN ACK event (IN data sent)
         EP0in();
     }
-    
+
     for (uint8_t num = 2; num < 5*2; num++) {
         if (LPC_USB->INTSTAT & EP(num)) {
             LPC_USB->INTSTAT = EP(num);
--- a/USBDevice/USBHAL_LPC17.cpp	Fri May 16 09:00:39 2014 +0100
+++ b/USBDevice/USBHAL_LPC17.cpp	Tue Jun 03 11:30:32 2014 +0100
@@ -279,7 +279,7 @@
         SIEselectEndpoint(endpoint);
         SIEclearBuffer();
     }
-    
+
     return size;
 }
 
@@ -327,7 +327,7 @@
 USBHAL::USBHAL(void) {
     // Disable IRQ
     NVIC_DisableIRQ(USB_IRQn);
-    
+
     // fill in callback array
     epCallback[0] = &USBHAL::EP1_OUT_callback;
     epCallback[1] = &USBHAL::EP1_IN_callback;
@@ -466,7 +466,7 @@
         if (!(epComplete & EP(endpoint)))
             return EP_PENDING;
     }
-    
+
     *bytesRead = endpointReadcore(endpoint, buffer);
     epComplete &= ~EP(endpoint);
     return EP_COMPLETED;
@@ -606,7 +606,7 @@
             LPC_USB->USBDevIntClr = EP_SLOW;
             EP0in();
         }
-        
+
         for (uint8_t num = 2; num < 16*2; num++) {
             if (LPC_USB->USBEpIntSt & EP(num)) {
                 selectEndpointClearInterrupt(num);
--- a/USBDevice/USBHAL_LPC40.cpp	Fri May 16 09:00:39 2014 +0100
+++ b/USBDevice/USBHAL_LPC40.cpp	Tue Jun 03 11:30:32 2014 +0100
@@ -280,7 +280,7 @@
         SIEselectEndpoint(endpoint);
         SIEclearBuffer();
     }
-    
+
     return size;
 }
 
@@ -328,7 +328,7 @@
 USBHAL::USBHAL(void) {
     // Disable IRQ
     NVIC_DisableIRQ(USB_IRQn);
-    
+
     // fill in callback array
     epCallback[0] = &USBHAL::EP1_OUT_callback;
     epCallback[1] = &USBHAL::EP1_IN_callback;
@@ -367,7 +367,7 @@
     // Enable USB clocks
     LPC_USB->USBClkCtrl |= DEV_CLK_EN | AHB_CLK_EN | PORT_CLK_EN;
     while ((LPC_USB->USBClkSt & (DEV_CLK_EN | AHB_CLK_EN | PORT_CLK_EN)) != (DEV_CLK_ON | AHB_CLK_ON | PORT_CLK_EN));
-    
+
     // Select port USB2
     LPC_USB->StCtrl |= 3;
 
@@ -375,13 +375,13 @@
     // Configure pin P0.31 to be USB2
     LPC_IOCON->P0_31 &= ~0x07;
     LPC_IOCON->P0_31 |= 0x01;
-    
+
     // Disconnect USB device
     SIEdisconnect();
 
     // Configure pin P0.14 to be Connect
     LPC_IOCON->P0_14 &= ~0x07;
-    LPC_IOCON->P0_14 |= 0x03;    
+    LPC_IOCON->P0_14 |= 0x03;
 
     // Connect must be low for at least 2.5uS
     wait(0.3);
@@ -471,7 +471,7 @@
         if (!(epComplete & EP(endpoint)))
             return EP_PENDING;
     }
-    
+
     *bytesRead = endpointReadcore(endpoint, buffer);
     epComplete &= ~EP(endpoint);
     return EP_COMPLETED;
@@ -611,7 +611,7 @@
             LPC_USB->DevIntClr = EP_SLOW;
             EP0in();
         }
-        
+
         for (uint8_t num = 2; num < 16*2; num++) {
             if (LPC_USB->EpIntSt & EP(num)) {
                 selectEndpointClearInterrupt(num);
--- a/USBDevice/USBHAL_STM32F4.cpp	Fri May 16 09:00:39 2014 +0100
+++ b/USBDevice/USBHAL_STM32F4.cpp	Tue Jun 03 11:30:32 2014 +0100
@@ -36,7 +36,7 @@
     return 0;
 }
 
-USBHAL::USBHAL(void) {    
+USBHAL::USBHAL(void) {
     NVIC_DisableIRQ(OTG_FS_IRQn);
     epCallback[0] = &USBHAL::EP1_OUT_callback;
     epCallback[1] = &USBHAL::EP1_IN_callback;
@@ -63,7 +63,7 @@
     pin_mode(PA_9, OpenDrain);
 
     RCC->AHB2ENR |= RCC_AHB2ENR_OTGFSEN;
-    
+
     // Enable interrupts
     OTG_FS->GREGS.GAHBCFG |= (1 << 0);
 
@@ -116,21 +116,21 @@
 
     uint32_t type;
     switch (endpoint) {
-        case EP0IN:  
+        case EP0IN:
         case EP0OUT:
             type = 0;
-            break;   
+            break;
         case EPISO_IN:
         case EPISO_OUT:
-            type = 1; 
+            type = 1;
         case EPBULK_IN:
         case EPBULK_OUT:
-            type = 2;  
-            break;   
+            type = 2;
+            break;
         case EPINT_IN:
         case EPINT_OUT:
-            type = 3; 
-            break;   
+            type = 3;
+            break;
     }
 
     // Generic in or out EP controls
@@ -154,7 +154,7 @@
         if (endpoint != EP0IN) {
             control |= (1 << 28); // SD0PID
         }
-        
+
         control |= (epIndex << 22) | // TxFIFO index
                    (1 << 27); // SNAK
         OTG_FS->INEP_REGS[epIndex].DIEPCTL = control;
@@ -166,7 +166,7 @@
         // Set the out EP specific control settings
         control |= (1 << 26); // CNAK
         OTG_FS->OUTEP_REGS[epIndex].DOEPCTL = control;
-        
+
         // Unmask the interrupt
         OTG_FS->DREGS.DAINTMSK |= (1 << (epIndex + 16));
     }
@@ -190,7 +190,7 @@
     for (uint32_t i = 0; i < length; i += 4) {
         buffer32[i >> 2] = OTG_FS->FIFO[0][0];
     }
-                        
+
     rxFifoCount = 0;
     return length;
 }
@@ -266,7 +266,7 @@
         return EP_COMPLETED;
     }
 
-    return EP_PENDING; 
+    return EP_PENDING;
 }
 
 void USBHAL::stallEndpoint(uint8_t endpoint) {
@@ -282,7 +282,7 @@
 }
 
 void USBHAL::unstallEndpoint(uint8_t endpoint) {
-    
+
 }
 
 bool USBHAL::getEndpointStallState(uint8_t endpoint) {
--- a/USBDevice/USBRegs_STM32.h	Fri May 16 09:00:39 2014 +0100
+++ b/USBDevice/USBRegs_STM32.h	Tue Jun 03 11:30:32 2014 +0100
@@ -16,8 +16,8 @@
   *
   *        http://www.st.com/software_license_agreement_liberty_v2
   *
-  * Unless required by applicable law or agreed to in writing, software 
-  * distributed under the License is distributed on an "AS IS" BASIS, 
+  * Unless required by applicable law or agreed to in writing, software
+  * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
@@ -70,7 +70,7 @@
 }
 USB_OTG_DREGS;
 
-typedef struct 
+typedef struct
 {
   __IO uint32_t DIEPCTL; /* dev IN Endpoint Control Reg 900h + (ep_num * 20h) + 00h*/
   uint32_t Reserved04;             /* Reserved                       900h + (ep_num * 20h) + 04h*/
@@ -83,7 +83,7 @@
 }
 USB_OTG_INEPREGS;
 
-typedef struct 
+typedef struct
 {
   __IO uint32_t DOEPCTL;       /* dev OUT Endpoint Control Reg  B00h + (ep_num * 20h) + 00h*/
   uint32_t Reserved04;         /* Reserved                      B00h + (ep_num * 20h) + 04h*/
@@ -117,7 +117,7 @@
 }
 USB_OTG_HC_REGS;
 
-typedef struct 
+typedef struct
 {
     USB_OTG_GREGS         GREGS;
     uint32_t RESERVED0[188];
--- a/USBHID/USBHID.cpp	Fri May 16 09:00:39 2014 +0100
+++ b/USBHID/USBHID.cpp	Tue Jun 03 11:30:32 2014 +0100
@@ -121,7 +121,7 @@
                                 success = true;
                             }
                             break;
-                     
+
                     default:
                         break;
                 }
--- a/USBHID/USBHID.h	Fri May 16 09:00:39 2014 +0100
+++ b/USBHID/USBHID.h	Tue Jun 03 11:30:32 2014 +0100
@@ -70,8 +70,8 @@
     * @returns true if successful
     */
     bool send(HID_REPORT *report);
-    
-    
+
+
     /**
     * Send a Report. warning: non blocking
     *
@@ -79,7 +79,7 @@
     * @returns true if successful
     */
     bool sendNB(HID_REPORT *report);
-    
+
     /**
     * Read a report: blocking
     *
@@ -87,7 +87,7 @@
     * @returns true if successful
     */
     bool read(HID_REPORT * report);
-    
+
     /**
     * Read a report: non blocking
     *
@@ -98,7 +98,7 @@
 
 protected:
     uint16_t reportLength;
-    
+
     /*
     * Get the Report descriptor
     *
@@ -119,14 +119,14 @@
     * @returns pointer to the string product descriptor
     */
     virtual uint8_t * stringIproductDesc();
-    
+
     /*
     * Get string interface descriptor
     *
     * @returns pointer to the string interface descriptor
     */
     virtual uint8_t * stringIinterfaceDesc();
-    
+
     /*
     * Get configuration descriptor
     *
--- a/USBHID/USBKeyboard.cpp	Fri May 16 09:00:39 2014 +0100
+++ b/USBHID/USBKeyboard.cpp	Tue Jun 03 11:30:32 2014 +0100
@@ -183,7 +183,7 @@
     {0x4a, 0},          /* HOME */
     {0x4b, 0},          /* PAGE_UP */
     {0x4e, 0},          /* PAGE_DOWN */
-    
+
     {0x4f, 0},          /* RIGHT_ARROW */
     {0x50, 0},          /* LEFT_ARROW */
     {0x51, 0},          /* DOWN_ARROW */
@@ -344,7 +344,7 @@
     {0x4a, 0},          /* HOME */
     {0x4b, 0},          /* PAGE_UP */
     {0x4e, 0},          /* PAGE_DOWN */
-    
+
     {0x4f, 0},          /* RIGHT_ARROW */
     {0x50, 0},          /* LEFT_ARROW */
     {0x51, 0},          /* DOWN_ARROW */
@@ -424,10 +424,10 @@
     uint32_t bytesRead = 0;
     uint8_t led[65];
     USBDevice::readEP(EPINT_OUT, led, &bytesRead, MAX_HID_REPORT_SIZE);
-    
+
     // we take led[1] because led[0] is the report ID
     lock_status = led[1] & 0x07;
-    
+
     // We activate the endpoint to be able to recceive data
     if (!readStart(EPINT_OUT, MAX_HID_REPORT_SIZE))
         return false;
--- a/USBHID/USBKeyboard.h	Fri May 16 09:00:39 2014 +0100
+++ b/USBHID/USBKeyboard.h	Tue Jun 03 11:30:32 2014 +0100
@@ -53,7 +53,7 @@
     KEY_F10,        /* F10 key */
     KEY_F11,        /* F11 key */
     KEY_F12,        /* F12 key */
-    
+
     KEY_PRINT_SCREEN,   /* Print Screen key */
     KEY_SCROLL_LOCK,    /* Scroll lock */
     KEY_CAPS_LOCK,      /* caps lock */
@@ -62,7 +62,7 @@
     KEY_HOME,           /* Home key */
     KEY_PAGE_UP,        /* Page Up key */
     KEY_PAGE_DOWN,      /* Page Down key */
-    
+
     RIGHT_ARROW,        /* Right arrow */
     LEFT_ARROW,         /* Left arrow */
     DOWN_ARROW,         /* Down arrow */
--- a/USBHID/USBMouse.h	Fri May 16 09:00:39 2014 +0100
+++ b/USBHID/USBMouse.h	Tue Jun 03 11:30:32 2014 +0100
@@ -35,7 +35,7 @@
 /* X and Y limits */
 /* These values do not directly map to screen pixels */
 /* Zero may be interpreted as meaning 'no movement' */
-#define X_MIN_ABS    (1)        /*!< Minimum value on x-axis */  
+#define X_MIN_ABS    (1)        /*!< Minimum value on x-axis */
 #define Y_MIN_ABS    (1)        /*!< Minimum value on y-axis */
 #define X_MAX_ABS    (0x7fff)   /*!< Maximum value on x-axis */
 #define Y_MAX_ABS    (0x7fff)   /*!< Maximum value on y-axis */
@@ -85,7 +85,7 @@
  *   uint16_t y_center = (Y_MAX_ABS - Y_MIN_ABS)/2;
  *   uint16_t x_screen = 0;
  *   uint16_t y_screen = 0;
- *   
+ *
  *   uint32_t x_origin = x_center;
  *   uint32_t y_origin = y_center;
  *   uint32_t radius = 5000;
@@ -95,7 +95,7 @@
  *   {
  *       x_screen = x_origin + cos((double)angle*3.14/180.0)*radius;
  *       y_screen = y_origin + sin((double)angle*3.14/180.0)*radius;
- *       
+ *
  *       mouse.move(x_screen, y_screen);
  *       angle += 3;
  *       wait(0.01);
@@ -107,7 +107,7 @@
 class USBMouse: public USBHID
 {
     public:
-        
+
         /**
         *   Constructor
         *
@@ -117,14 +117,14 @@
         * @param product_release Your preoduct_release (default: 0x0001)
         *
         */
-        USBMouse(MOUSE_TYPE mouse_type = REL_MOUSE, uint16_t vendor_id = 0x1234, uint16_t product_id = 0x0001, uint16_t product_release = 0x0001): 
+        USBMouse(MOUSE_TYPE mouse_type = REL_MOUSE, uint16_t vendor_id = 0x1234, uint16_t product_id = 0x0001, uint16_t product_release = 0x0001):
             USBHID(0, 0, vendor_id, product_id, product_release, false)
-            { 
+            {
                 button = 0;
                 this->mouse_type = mouse_type;
                 connect();
             };
-        
+
         /**
         * Write a state of the mouse
         *
@@ -135,8 +135,8 @@
         * @returns true if there is no error, false otherwise
         */
         bool update(int16_t x, int16_t y, uint8_t buttons, int8_t z);
-        
-        
+
+
         /**
         * Move the cursor to (x, y)
         *
@@ -145,7 +145,7 @@
         * @returns true if there is no error, false otherwise
         */
         bool move(int16_t x, int16_t y);
-        
+
         /**
         * Press one or several buttons
         *
@@ -153,7 +153,7 @@
         * @returns true if there is no error, false otherwise
         */
         bool press(uint8_t button);
-        
+
         /**
         * Release one or several buttons
         *
@@ -161,22 +161,22 @@
         * @returns true if there is no error, false otherwise
         */
         bool release(uint8_t button);
-        
+
         /**
         * Double click (MOUSE_LEFT)
         *
         * @returns true if there is no error, false otherwise
         */
         bool doubleClick();
-        
+
         /**
         * Click
         *
         * @param button state of the buttons ( ex: clic(MOUSE_LEFT))
         * @returns true if there is no error, false otherwise
         */
-        bool click(uint8_t button); 
-        
+        bool click(uint8_t button);
+
         /**
         * Scrolling
         *
@@ -184,7 +184,7 @@
         * @returns true if there is no error, false otherwise
         */
         bool scroll(int8_t z);
-        
+
         /*
         * To define the report descriptor. Warning: this method has to store the length of the report descriptor in reportLength.
         *
@@ -199,7 +199,7 @@
         * @returns pointer to the configuration descriptor
         */
         virtual uint8_t * configurationDesc();
-        
+
     private:
         MOUSE_TYPE mouse_type;
         uint8_t button;
--- a/USBHID/USBMouseKeyboard.cpp	Fri May 16 09:00:39 2014 +0100
+++ b/USBHID/USBMouseKeyboard.cpp	Tue Jun 03 11:30:32 2014 +0100
@@ -178,7 +178,7 @@
     {0x4a, 0},          /* HOME */
     {0x4b, 0},          /* PAGE_UP */
     {0x4e, 0},          /* PAGE_DOWN */
-    
+
     {0x4f, 0},          /* RIGHT_ARROW */
     {0x50, 0},          /* LEFT_ARROW */
     {0x51, 0},          /* DOWN_ARROW */
@@ -339,7 +339,7 @@
     {0x4a, 0},          /* HOME */
     {0x4b, 0},          /* PAGE_UP */
     {0x4e, 0},          /* PAGE_DOWN */
-    
+
     {0x4f, 0},          /* RIGHT_ARROW */
     {0x50, 0},          /* LEFT_ARROW */
     {0x51, 0},          /* DOWN_ARROW */
@@ -552,10 +552,10 @@
     uint32_t bytesRead = 0;
     uint8_t led[65];
     USBDevice::readEP(EPINT_OUT, led, &bytesRead, MAX_HID_REPORT_SIZE);
-    
+
     // we take led[1] because led[0] is the report ID
     lock_status = led[1] & 0x07;
-    
+
     // We activate the endpoint to be able to recceive data
     if (!readStart(EPINT_OUT, MAX_HID_REPORT_SIZE))
         return false;
@@ -696,7 +696,7 @@
     report.length = 2;
 
     send(&report);
-    
+
     report.data[0] = REPORT_ID_VOLUME;
     report.data[1] = 0;
 
--- a/USBHID/USBMouseKeyboard.h	Fri May 16 09:00:39 2014 +0100
+++ b/USBHID/USBMouseKeyboard.h	Tue Jun 03 11:30:32 2014 +0100
@@ -28,7 +28,7 @@
 #include "Stream.h"
 #include "USBHID.h"
 
-/** 
+/**
  * USBMouseKeyboard example
  * @code
  *
@@ -70,7 +70,7 @@
 class USBMouseKeyboard: public USBHID, public Stream
 {
     public:
-    
+
         /**
         *   Constructor
         *
@@ -81,7 +81,7 @@
         * @param product_release Your preoduct_release (default: 0x0001)
         *
         */
-        USBMouseKeyboard(MOUSE_TYPE mouse_type = REL_MOUSE, uint16_t vendor_id = 0x0021, uint16_t product_id = 0x0011, uint16_t product_release = 0x0001): 
+        USBMouseKeyboard(MOUSE_TYPE mouse_type = REL_MOUSE, uint16_t vendor_id = 0x0021, uint16_t product_id = 0x0011, uint16_t product_release = 0x0001):
             USBHID(0, 0, vendor_id, product_id, product_release, false)
             {
                 lock_status = 0;
@@ -89,7 +89,7 @@
                 this->mouse_type = mouse_type;
                 connect();
             };
-            
+
         /**
         * Write a state of the mouse
         *
@@ -100,8 +100,8 @@
         * @returns true if there is no error, false otherwise
         */
         bool update(int16_t x, int16_t y, uint8_t buttons, int8_t z);
-        
-        
+
+
         /**
         * Move the cursor to (x, y)
         *
@@ -110,7 +110,7 @@
         * @returns true if there is no error, false otherwise
         */
         bool move(int16_t x, int16_t y);
-        
+
         /**
         * Press one or several buttons
         *
@@ -118,7 +118,7 @@
         * @returns true if there is no error, false otherwise
         */
         bool press(uint8_t button);
-        
+
         /**
         * Release one or several buttons
         *
@@ -126,22 +126,22 @@
         * @returns true if there is no error, false otherwise
         */
         bool release(uint8_t button);
-        
+
         /**
         * Double click (MOUSE_LEFT)
         *
         * @returns true if there is no error, false otherwise
         */
         bool doubleClick();
-        
+
         /**
         * Click
         *
         * @param button state of the buttons ( ex: clic(MOUSE_LEFT))
         * @returns true if there is no error, false otherwise
         */
-        bool click(uint8_t button); 
-        
+        bool click(uint8_t button);
+
         /**
         * Scrolling
         *
@@ -151,7 +151,7 @@
         bool scroll(int8_t z);
 
         /**
-        * To send a character defined by a modifier(CTRL, SHIFT, ALT) and the key 
+        * To send a character defined by a modifier(CTRL, SHIFT, ALT) and the key
         *
         * @code
         * //To send CTRL + s (save)
@@ -163,7 +163,7 @@
         * @returns true if there is no error, false otherwise
         */
         bool keyCode(uint8_t key, uint8_t modifier = 0);
-        
+
         /**
         * Send a character
         *
@@ -171,7 +171,7 @@
         * @returns true if there is no error, false otherwise
         */
         virtual int _putc(int c);
-        
+
         /**
         * Control media keys
         *
@@ -179,7 +179,7 @@
         * @returns true if there is no error, false otherwise
         */
         bool mediaControl(MEDIA_KEY key);
-        
+
         /**
         * Read status of lock keys. Useful to switch-on/off leds according to key pressed. Only the first three bits of the result is important:
         *   - First bit: NUM_LOCK
@@ -189,30 +189,30 @@
         * @returns status of lock keys
         */
         uint8_t lockStatus();
-        
+
         /*
         * To define the report descriptor. Warning: this method has to store the length of the report descriptor in reportLength.
         *
         * @returns pointer to the report descriptor
         */
         virtual uint8_t * reportDesc();
-        
+
         /*
         * Called when a data is received on the OUT endpoint. Useful to switch on LED of LOCK keys
         *
         * @returns if handle by subclass, return true
         */
         virtual bool EP1_OUT_callback();
-        
-        
+
+
     private:
         bool mouseWrite(int8_t x, int8_t y, uint8_t buttons, int8_t z);
         MOUSE_TYPE mouse_type;
         uint8_t button;
         bool mouseSend(int8_t x, int8_t y, uint8_t buttons, int8_t z);
-        
+
         uint8_t lock_status;
-        
+
         //dummy otherwise it doesn't compile (we must define all methods of an abstract class)
         virtual int _getc() { return -1;}
 };
--- a/USBMIDI/MIDIMessage.h	Fri May 16 09:00:39 2014 +0100
+++ b/USBMIDI/MIDIMessage.h	Tue Jun 03 11:30:32 2014 +0100
@@ -22,7 +22,7 @@
 #include "mbed.h"
 
 // MIDI Message Format
-// 
+//
 // [ msg(4) | channel(4) ] [ 0 | n(7) ] [ 0 | m(7) ]
 //
 // MIDI Data Messages (Channel Specific)
@@ -43,15 +43,15 @@
 class MIDIMessage {
 public:
     MIDIMessage() {}
-    
+
     MIDIMessage(uint8_t *buf) {
         for (int i = 0; i < 4; i++)
             data[i] = buf[i];
     }
-    
+
     // create messages
-    
-    /** Create a NoteOff message 
+
+    /** Create a NoteOff message
      * @param key Key ID
      * @param velocity Key velocity (0-127, default = 127)
      * @param channel Key channel (0-15, default 0)
@@ -62,11 +62,11 @@
         msg.data[0] = CABLE_NUM | 0x08;
         msg.data[1] = 0x80 | (channel & 0x0F);
         msg.data[2] = key & 0x7F;
-        msg.data[3] = velocity & 0x7F; 
+        msg.data[3] = velocity & 0x7F;
         return msg;
     }
-    
-    /** Create a NoteOn message 
+
+    /** Create a NoteOn message
      * @param key Key ID
      * @param velocity Key velocity (0-127, default = 127)
      * @param channel Key channel (0-15, default 0)
@@ -77,26 +77,26 @@
         msg.data[0] = CABLE_NUM | 0x09;
         msg.data[1] = 0x90 | (channel & 0x0F);
         msg.data[2] = key & 0x7F;
-        msg.data[3] = velocity & 0x7F;                 
+        msg.data[3] = velocity & 0x7F;
         return msg;
     }
-    
-    /** Create a PolyPhonic Aftertouch message 
+
+    /** Create a PolyPhonic Aftertouch message
      * @param key Key ID
      * @param pressure Aftertouch pressure (0-127)
      * @param channel Key channel (0-15, default 0)
      * @returns A MIDIMessage
-     */    
+     */
     static MIDIMessage PolyphonicAftertouch(int key, int pressure, int channel = 0) {
         MIDIMessage msg;
         msg.data[0] = CABLE_NUM | 0x0A;
         msg.data[1] = 0xA0 | (channel & 0x0F);
         msg.data[2] = key & 0x7F;
-        msg.data[3] = pressure & 0x7F;         
+        msg.data[3] = pressure & 0x7F;
         return msg;
     }
-    
-    /** Create a Control Change message 
+
+    /** Create a Control Change message
      * @param control Controller ID
      * @param value Controller value (0-127)
      * @param channel Controller channel (0-15, default 0)
@@ -107,63 +107,63 @@
         msg.data[0] = CABLE_NUM | 0x0B;
         msg.data[1] = 0xB0 | (channel & 0x0F);
         msg.data[2] = control & 0x7F;
-        msg.data[3] = value & 0x7F;         
+        msg.data[3] = value & 0x7F;
         return msg;
     }
-    
-    /** Create a Program Change message 
+
+    /** Create a Program Change message
      * @param program Program ID
      * @param channel Channel (0-15, default 0)
      * @returns A MIDIMessage
-     */    
+     */
     static MIDIMessage ProgramChange(int program, int channel = 0) {
         MIDIMessage msg;
         msg.data[0] = CABLE_NUM | 0x0C;
         msg.data[1] = 0xC0 | (channel & 0x0F);
         msg.data[2] = program & 0x7F;
-        msg.data[3] = 0x00;         
+        msg.data[3] = 0x00;
         return msg;
     }
-    
-    /** Create a Channel Aftertouch message 
-     * @param pressure Pressure 
+
+    /** Create a Channel Aftertouch message
+     * @param pressure Pressure
      * @param channel Key channel (0-15, default 0)
      * @returns A MIDIMessage
-     */    
+     */
     static MIDIMessage ChannelAftertouch(int pressure, int channel = 0) {
         MIDIMessage msg;
         msg.data[0] = CABLE_NUM | 0x0D;
         msg.data[1] = 0xD0 | (channel & 0x0F);
         msg.data[2] = pressure & 0x7F;
-        msg.data[3] = 0x00;         
+        msg.data[3] = 0x00;
         return msg;
     }
-    
-    /** Create a Pitch Wheel message 
+
+    /** Create a Pitch Wheel message
      * @param pitch Pitch (-8192 - 8191, default = 0)
      * @param channel Channel (0-15, default 0)
      * @returns A MIDIMessage
-     */    
+     */
     static MIDIMessage PitchWheel(int pitch = 0, int channel = 0) {
         MIDIMessage msg;
         int p = pitch + 8192;    // 0 - 16383, 8192 is center
         msg.data[0] = CABLE_NUM | 0x0E;
         msg.data[1] = 0xE0 | (channel & 0x0F);
         msg.data[2] = p & 0x7F;
-        msg.data[3] = (p >> 7) & 0x7F;                 
+        msg.data[3] = (p >> 7) & 0x7F;
         return msg;
     }
-    
-    /** Create an All Notes Off message 
+
+    /** Create an All Notes Off message
      * @param channel Channel (0-15, default 0)
      * @returns A MIDIMessage
-     */    
+     */
     static MIDIMessage AllNotesOff(int channel = 0) {
         return ControlChange(123, 0, channel);
     }
-    
+
     // decode messages
-    
+
     /** MIDI Message Types */
     enum MIDIMessageType {
         ErrorType,
@@ -176,16 +176,16 @@
         PitchWheelType,
         AllNotesOffType
     };
-    
+
     /** Read the message type
      * @returns MIDIMessageType
-     */    
+     */
     MIDIMessageType type() {
         switch((data[1] >> 4) & 0xF) {
             case 0x8: return NoteOffType;
             case 0x9: return NoteOnType;
             case 0xA: return PolyphonicAftertouchType;
-            case 0xB: 
+            case 0xB:
                 if(controller() < 120) { // standard controllers
                     return ControlChangeType;
                 } else if(controller() == 123) {
@@ -200,51 +200,51 @@
         }
     }
 
-    /** Read the channel number */    
+    /** Read the channel number */
     int channel() {
         return (data[1] & 0x0F);
     }
-    
-    /** Read the key ID */    
+
+    /** Read the key ID */
     int key() {
-        return (data[2] & 0x7F);        
+        return (data[2] & 0x7F);
     }
-        
-    /** Read the velocity */    
+
+    /** Read the velocity */
     int velocity() {
-        return (data[3] & 0x7F);        
+        return (data[3] & 0x7F);
     }
 
-    /** Read the controller value */    
+    /** Read the controller value */
     int value() {
-        return (data[3] & 0x7F);        
+        return (data[3] & 0x7F);
     }
-    
-    /** Read the aftertouch pressure */        
+
+    /** Read the aftertouch pressure */
     int pressure() {
         if(type() == PolyphonicAftertouchType) {
-            return (data[3] & 0x7F);        
+            return (data[3] & 0x7F);
         } else {
-            return (data[2] & 0x7F);        
+            return (data[2] & 0x7F);
         }
     }
 
-    /** Read the controller number */    
+    /** Read the controller number */
     int controller() {
-        return (data[2] & 0x7F);        
+        return (data[2] & 0x7F);
     }
 
-    /** Read the program number */    
+    /** Read the program number */
     int program() {
-        return (data[2] & 0x7F);        
+        return (data[2] & 0x7F);
     }
-    
-    /** Read the pitch value */        
+
+    /** Read the pitch value */
     int pitch() {
         int p = ((data[3] & 0x7F) << 7) | (data[2] & 0x7F);
         return p - 8192; // 0 - 16383, 8192 is center
     }
-    
+
     uint8_t data[4];
 };
 
--- a/USBMIDI/USBMIDI.h	Fri May 16 09:00:39 2014 +0100
+++ b/USBMIDI/USBMIDI.h	Tue Jun 03 11:30:32 2014 +0100
@@ -29,7 +29,7 @@
 
 #define DEFAULT_CONFIGURATION (1)
 
-/** 
+/**
 * USBMIDI example
 *
 * @code
@@ -38,8 +38,8 @@
 *
 * USBMIDI midi;
 *
-* int main() {            
-*    while (1) {    
+* int main() {
+*    while (1) {
 *        for(int i=48; i<83; i++) {     // send some messages!
 *            midi.write(MIDIMessage::NoteOn(i));
 *            wait(0.25);
@@ -61,12 +61,12 @@
     * @param product_release Your preoduct_release
     */
     USBMIDI(uint16_t vendor_id = 0x0700, uint16_t product_id = 0x0101, uint16_t product_release = 0x0001);
-    
+
     /**
      * Send a MIDIMessage
      *
      * @param m The MIDIMessage to send
-     */    
+     */
     void write(MIDIMessage m);
 
     /**
@@ -75,8 +75,8 @@
      * @param fptr function pointer
      */
     void attach(void (*fptr)(MIDIMessage));
-    
-    
+
+
 protected:
     virtual bool EP2_OUT_callback();
     virtual bool USBCallback_setConfiguration(uint8_t configuration);
@@ -86,14 +86,14 @@
     * @returns pointer to the string product descriptor
     */
     virtual uint8_t * stringIproductDesc();
-    
+
     /*
     * Get string interface descriptor
     *
     * @returns pointer to the string interface descriptor
     */
     virtual uint8_t * stringIinterfaceDesc();
-    
+
     /*
     * Get configuration descriptor
     *
--- a/USBMSD/USBMSD.h	Fri May 16 09:00:39 2014 +0100
+++ b/USBMSD/USBMSD.h	Tue Jun 03 11:30:32 2014 +0100
@@ -79,7 +79,7 @@
     * Disconnect the USB MSD device.
     */
     void disconnect();
-    
+
     /**
     * Destructor
     */
--- a/USBSerial/USBCDC.cpp	Fri May 16 09:00:39 2014 +0100
+++ b/USBSerial/USBCDC.cpp	Tue Jun 03 11:30:32 2014 +0100
@@ -73,15 +73,15 @@
     if (length != 7) {
         return;
     }
-    
+
     CONTROL_TRANSFER * transfer = getTransferPtr();
- 
+
     /* Process class-specific requests */
     if (transfer->setup.bmRequestType.Type == CLASS_TYPE) {
         if (transfer->setup.bRequest == CDC_SET_LINE_CODING) {
             if (memcmp(cdc_line_coding, buf, 7)) {
-                memcpy(cdc_line_coding, buf, 7); 
- 
+                memcpy(cdc_line_coding, buf, 7);
+
                 int baud = buf[0] + (buf[1] << 8)
                          + (buf[2] << 16) + (buf[3] << 24);
                 int stop = buf[4];
@@ -186,7 +186,7 @@
         0,                      // iConfiguration
         0x80,                   // bmAttributes
         50,                     // bMaxPower
-        
+
         // IAD to associate the two CDC interfaces
         0x08,                   // bLength
         0x0b,                   // bDescriptorType
--- a/USBSerial/USBCDC.h	Fri May 16 09:00:39 2014 +0100
+++ b/USBSerial/USBCDC.h	Tue Jun 03 11:30:32 2014 +0100
@@ -40,35 +40,35 @@
     USBCDC(uint16_t vendor_id, uint16_t product_id, uint16_t product_release, bool connect_blocking);
 
 protected:
-    
+
     /*
     * Get device descriptor. Warning: this method has to store the length of the report descriptor in reportLength.
     *
     * @returns pointer to the device descriptor
     */
     virtual uint8_t * deviceDesc();
-    
+
     /*
     * Get string product descriptor
     *
     * @returns pointer to the string product descriptor
     */
     virtual uint8_t * stringIproductDesc();
-    
+
     /*
     * Get string interface descriptor
     *
     * @returns pointer to the string interface descriptor
     */
     virtual uint8_t * stringIinterfaceDesc();
-    
+
     /*
     * Get configuration descriptor
     *
     * @returns pointer to the configuration descriptor
     */
     virtual uint8_t * configurationDesc();
-    
+
     /*
     * Send a buffer
     *
@@ -78,7 +78,7 @@
     * @returns true if successful
     */
     bool send(uint8_t * buffer, uint32_t size);
-    
+
     /*
     * Read a buffer from a certain endpoint. Warning: blocking
     *
@@ -89,7 +89,7 @@
     * @returns true if successful
     */
     bool readEP(uint8_t * buffer, uint32_t * size);
-    
+
     /*
     * Read a buffer from a certain endpoint. Warning: non blocking
     *
@@ -111,7 +111,7 @@
     * @param stop The number of stop bits (1 or 2)
     */
     virtual void lineCodingChanged(int baud, int bits, int parity, int stop) {};
-    
+
 protected:
     virtual bool USBCallback_request();
     virtual void USBCallback_requestCompleted(uint8_t *buf, uint32_t length);
--- a/USBSerial/USBSerial.h	Fri May 16 09:00:39 2014 +0100
+++ b/USBSerial/USBSerial.h	Tue Jun 03 11:30:32 2014 +0100
@@ -68,20 +68,20 @@
     * @returns true if there is no error, false otherwise
     */
     virtual int _putc(int c);
-    
+
     /**
     * Read a character: blocking
     *
     * @returns character read
     */
     virtual int _getc();
-    
+
     /**
     * Check the number of bytes available.
     *
     * @returns the number of bytes available
     */
-    uint8_t available(); 
+    uint8_t available();
 
     /** Determine if there is a character available to read
      *
@@ -90,7 +90,7 @@
      *    0 otherwise
      */
     int readable() { return available() ? 1 : 0; }
-    
+
     /** Determine if there is space available to write a character
      *
      *  @returns
@@ -98,9 +98,9 @@
      *    0 otherwise
      */
     int writeable() { return 1; } // always return 1, for write operation is blocking
-    
+
     /**
-    * Write a block of data. 
+    * Write a block of data.
     *
     * For more efficiency, a block of size 64 (maximum size of a bulk endpoint) has to be written.
     *
@@ -112,7 +112,7 @@
     bool writeBlock(uint8_t * buf, uint16_t size);
 
     /**
-     *  Attach a member function to call when a packet is received. 
+     *  Attach a member function to call when a packet is received.
      *
      *  @param tptr pointer to the object to call the member function on
      *  @param mptr pointer to the member function to be called