USB device base class. More...
Public Member Functions | |
virtual void | init () |
virtual UsbEndpoint * | getControlEndpoint ()=0 |
virtual UsbInterface * | getInterface (int index)=0 |
virtual void | setup (SetupData *setupData) |
virtual void | checkDescriptor (DeviceDescriptor *deviceDesriptor) |
virtual const char * | getManufacturer () |
virtual const char * | getProduct () |
virtual const char * | getSerial () |
virtual void | setAddress (int address)=0 |
virtual void | startTx (int epIndex, int length)=0 |
virtual void | stall (int epIndex)=0 |
Public Attributes | |
UsbEndpoint * | endpoints [MAX_ENDPOINTS] |
int | endpointCount |
USB device base class.
This class is not subclassed directly by the application. There must always be chip specific implementation as midclass. This means there is a hierarchy like: UsbDevice <- ChipAbcUsbDevice <- ApplicationXyzUsbDevice.
Typical application subclass of a chip midclass (ATSAMD in this case) looks like:
Chip midclass must overload following methods:
|
inlinevirtual |
Called when generating device descriptor.
Called internally from the library.
May be overloaded by application subclass to modify the default descriptor.
deviceDesriptor |
|
pure virtual |
Gets control endpoint.
Called internally from the library.
Must be overloaded by the application subclass.
|
pure virtual |
Gets interface by index.
Called internally from the library.
Must be overloaded by the application subclass.
index | zero based in scope of device |
|
inlinevirtual |
Get string identifier of the manufacturer.
Called internally from the library.
May be overloaded by application subclass.
|
inlinevirtual |
Get string identifier of the product.
Called internally from the library.
May be overloaded by application subclass.
|
inlinevirtual |
Get string serial number of the device.
Called internally from the library.
May be overloaded by application subclass or chip midclass.
|
inlinevirtual |
Device initialization.
Called from chip midclass init() method.
UsbEndpoint::init() is responsible for collecting of endpoints from interfaces.
|
pure virtual |
Sets device USB address.
Called internally from the library.
Must be overloaded by chip midclass.
address |
|
inlinevirtual |
Handler of device control request.
Called internally from the library.
May be overloaded by application subclass to implement vendor request.
setupData |
|
pure virtual |
Sends stall handshake on the given endpoint.
Called internally from the library.
Must be overloaded by chip midclass.
epIndex |
|
pure virtual |
Starts transmission of the data on the given endpoint.
Called internally from the library.
Must be overloaded by chip midclass.
epIndex | |
length |
int usbd::UsbDevice::endpointCount |
Number of endpoints as collected by the init() method.
UsbEndpoint* usbd::UsbDevice::endpoints[MAX_ENDPOINTS] |
Array of endpoints as collected by the init() method.