USB Namespace Reference

Namespaces

 CDC
 
 DFU
 
 ECM_RNDIS
 
 HID
 
 MIDI
 
 MSC
 
 NCM
 
 VENDOR
 

Classes

struct  Descriptor
 Structure of a USB descriptor. More...
 
struct  DescriptorList
 Buffer containing list of descriptors. More...
 
struct  StringDescriptor
 Template for making a USB string descriptor. More...
 
class  DeviceInterface
 Base class to support a USB device interface implementation. More...
 
class  HostInterface
 Common base class to support Host USB access. More...
 

Typedefs

using GetDeviceDescriptor = Delegate< const tusb_desc_device_t *(const tusb_desc_device_t &desc)>
 Callback to support provision of dynamic device descriptors. More...
 
using GetDescriptorString = Delegate< const Descriptor *(uint8_t index)>
 Application-provided callback to customise string responses. More...
 

Functions

void onGetDeviceDescriptor (GetDeviceDescriptor callback)
 
void onGetDescriptorSting (GetDescriptorString callback)
 
bool begin ()
 

Typedef Documentation

◆ GetDescriptorString

using USB::GetDescriptorString = typedef Delegate<const Descriptor*(uint8_t index)>

Application-provided callback to customise string responses.

Parameters
indexString index to fetch (STRING_INDEX_xxxx)
Return values
constStringDescriptor* Pointer to persistent buffer containing descriptor. Return nullptr to use default value from string table.
Note
Returned descriptor MUST NOT be on the stack! Typically this is statically allocated.

◆ GetDeviceDescriptor

using USB::GetDeviceDescriptor = typedef Delegate<const tusb_desc_device_t*(const tusb_desc_device_t& desc)>

Callback to support provision of dynamic device descriptors.

Parameters
descThe statically configured device descriptor
consttusb_desc_device_t* Application returns a pointer to a statically allocated descriptor to use

Application typically copies the source descriptor to a statically allocated buffer, then amends values as required.

Function Documentation

◆ begin()

bool USB::begin ( )

◆ onGetDescriptorSting()

void USB::onGetDescriptorSting ( GetDescriptorString  callback)

◆ onGetDeviceDescriptor()

void USB::onGetDeviceDescriptor ( GetDeviceDescriptor  callback)