Skip to content

Commit

Permalink
Added new Pluggable USB structure
Browse files Browse the repository at this point in the history
This commit was required to test an IDE bug
  • Loading branch information
NicoHood committed Sep 26, 2015
1 parent 435fc32 commit ed03da4
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 1 deletion.
12 changes: 11 additions & 1 deletion hardware/arduino/avr/cores/arduino/PluggableUSB.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,16 @@

#define MAX_MODULES 6

#include "PluggableUSB.h"
#include "USBDevice.h"

PUSB_ PUSB;

PUSB_::PUSB_(void)
{

}

static u8 lastIf = CDC_ACM_INTERFACE + CDC_INTERFACE_COUNT;
static u8 lastEp = CDC_FIRST_ENDPOINT + CDC_ENPOINT_COUNT;

Expand Down Expand Up @@ -97,4 +107,4 @@ int8_t PUSB_AddFunction(PUSBListNode *node, u8* interface)

#endif

#endif /* if defined(USBCON) */
#endif /* if defined(USBCON) */
15 changes: 15 additions & 0 deletions hardware/arduino/avr/cores/arduino/PluggableUSB.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,21 @@ class PUSBListNode {
PUSBListNode(PUSBCallbacks *ncb) {cb = ncb;}
};

class USBDevice;

class PUSB_
{
public:
PUSB_(void);

// Only access this class via the USBDevice
private:
friend USBDevice;
void AppendDescriptor(USBDevice* device);

// TODO add root device, search functions etc
};

int8_t PUSB_AddFunction(PUSBListNode *node, u8 *interface);

int PUSB_GetInterface(u8* interfaceNum);
Expand Down
16 changes: 16 additions & 0 deletions hardware/arduino/avr/cores/arduino/USBDevice.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@

#include "USBDevice.h"
#include "PluggableUSB.h"

#if defined(USBCON)
#ifdef PLUGGABLE_USB_ENABLED

USBDevice::USBDevice(void)
{
//PUSB.AppendDescriptor(this);
}


#endif

#endif /* if defined(USBCON) */
27 changes: 27 additions & 0 deletions hardware/arduino/avr/cores/arduino/USBDevice.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// Include guard
#pragma once

#define HID_h

#include <stdint.h>
#include <Arduino.h>

//http://stackoverflow.com/questions/1837165/can-two-classes-see-each-other-using-c

class PUSB_;
extern PUSB_ PUSB;

class USBDevice
{
public:
USBDevice(void);

// Needs to be public for static PUSB_ function access
// Inherit this device private and everything should be fine
//private:
USBDevice* next = NULL;


protected:

};

0 comments on commit ed03da4

Please sign in to comment.