|
|
|
|
|
|
|
|
/* Data Types */ |
|
|
/* Data Types */ |
|
|
/************************************************/ |
|
|
/************************************************/ |
|
|
|
|
|
|
|
|
These 6 types are the key to understanding how this USB Host |
|
|
|
|
|
library really works. |
|
|
|
|
|
|
|
|
// These 6 types are the key to understanding how this USB Host |
|
|
|
|
|
// library really works. |
|
|
|
|
|
|
|
|
// USBHost is a static class controlling the hardware. |
|
|
// USBHost is a static class controlling the hardware. |
|
|
// All common USB functionality is implemented here. |
|
|
// All common USB functionality is implemented here. |
|
|
|
|
|
|
|
|
class USBHost { |
|
|
class USBHost { |
|
|
public: |
|
|
public: |
|
|
static void begin(); |
|
|
static void begin(); |
|
|
|
|
|
static void Task(); |
|
|
protected: |
|
|
protected: |
|
|
static Pipe_t * new_Pipe(Device_t *dev, uint32_t type, uint32_t endpoint, |
|
|
static Pipe_t * new_Pipe(Device_t *dev, uint32_t type, uint32_t endpoint, |
|
|
uint32_t direction, uint32_t maxlen, uint32_t interval=0); |
|
|
uint32_t direction, uint32_t maxlen, uint32_t interval=0); |
|
|
|
|
|
|
|
|
// a timer event, this function is called. |
|
|
// a timer event, this function is called. |
|
|
virtual void timer_event(USBDriverTimer *whichTimer) { } |
|
|
virtual void timer_event(USBDriverTimer *whichTimer) { } |
|
|
|
|
|
|
|
|
|
|
|
// When the user calls USBHost::Task, this Task function for all |
|
|
|
|
|
// active drivers is called, so they may update state and/or call |
|
|
|
|
|
// any attached user callback functions. |
|
|
|
|
|
virtual void Task() { } |
|
|
|
|
|
|
|
|
// When a device disconnects from the USB, this function is called. |
|
|
// When a device disconnects from the USB, this function is called. |
|
|
// The driver must free all resources it allocated and update any |
|
|
// The driver must free all resources it allocated and update any |
|
|
// internal state necessary to deal with the possibility of user |
|
|
// internal state necessary to deal with the possibility of user |