Simple USBHost library for LPC4088. Backward compatibility of official-USBHost.

Dependencies:   FATFileSystem mbed-rtos

Embed: (wiki syntax)

« Back to documentation index

USBHost Class Reference

USBHost class This class is a singleton. More...

#include <USBHost.h>

Inherits USBHALHost.

Public Member Functions

USB_TYPE controlRead (USBDeviceConnected *dev, uint8_t requestType, uint8_t request, uint32_t value, uint32_t index, uint8_t *buf, uint32_t len)
 Control read: setup stage, data stage and status stage.
USB_TYPE controlWrite (USBDeviceConnected *dev, uint8_t requestType, uint8_t request, uint32_t value, uint32_t index, uint8_t *buf, uint32_t len)
 Control write: setup stage, data stage and status stage.
USB_TYPE bulkRead (USBDeviceConnected *dev, USBEndpoint *ep, uint8_t *buf, uint32_t len, bool blocking=true)
 Bulk read.
USB_TYPE bulkWrite (USBDeviceConnected *dev, USBEndpoint *ep, uint8_t *buf, uint32_t len, bool blocking=true)
 Bulk write.
USB_TYPE interruptRead (USBDeviceConnected *dev, USBEndpoint *ep, uint8_t *buf, uint32_t len, bool blocking=true)
 Interrupt read.
USB_TYPE interruptWrite (USBDeviceConnected *dev, USBEndpoint *ep, uint8_t *buf, uint32_t len, bool blocking=true)
 Interrupt write.
USB_TYPE enumerate (USBDeviceConnected *dev, IUSBEnumerator *pEnumerator)
 Enumerate a device.
USBDeviceConnectedgetDevice (uint8_t index)
 Get a device.
template<typename T >
void registerDriver (USBDeviceConnected *dev, uint8_t intf, T *tptr, void(T::*mptr)(void))
 register a driver into the host associated with a callback function called when the device is disconnected

Static Public Member Functions

static USBHostgetHostInst ()
 Static method to create or retrieve the single USBHost instance.

Detailed Description

USBHost class This class is a singleton.

All drivers have a reference on the static USBHost instance

Definition at line 42 of file USBHost.h.


Member Function Documentation

USB_TYPE bulkRead ( USBDeviceConnected dev,
USBEndpoint ep,
uint8_t *  buf,
uint32_t  len,
bool  blocking = true 
)

Bulk read.

Parameters:
devthe bulk transfer will be done for this device
epUSBEndpoint which will be used to read a packet
bufpointer on a buffer where will be store the data received
lenlength of the transfer
blockingif true, the read is blocking (wait for completion)
Returns:
status of the bulk read

Definition at line 251 of file USBHost.cpp.

USB_TYPE bulkWrite ( USBDeviceConnected dev,
USBEndpoint ep,
uint8_t *  buf,
uint32_t  len,
bool  blocking = true 
)

Bulk write.

Parameters:
devthe bulk transfer will be done for this device
epUSBEndpoint which will be used to write a packet
bufpointer on a buffer which will be written
lenlength of the transfer
blockingif true, the write is blocking (wait for completion)
Returns:
status of the bulk write

Definition at line 266 of file USBHost.cpp.

USB_TYPE controlRead ( USBDeviceConnected dev,
uint8_t  requestType,
uint8_t  request,
uint32_t  value,
uint32_t  index,
uint8_t *  buf,
uint32_t  len 
)

Control read: setup stage, data stage and status stage.

Parameters:
devthe control read will be done for this device
requestTyperequest type
requestrequest
valuevalue
indexindex
bufpointer on a buffer where will be store the data received
lenlength of the transfer
Returns:
status of the control read

Definition at line 194 of file USBHost.cpp.

USB_TYPE controlWrite ( USBDeviceConnected dev,
uint8_t  requestType,
uint8_t  request,
uint32_t  value,
uint32_t  index,
uint8_t *  buf,
uint32_t  len 
)

Control write: setup stage, data stage and status stage.

Parameters:
devthe control write will be done for this device
requestTyperequest type
requestrequest
valuevalue
indexindex
bufpointer on a buffer which will be written
lenlength of the transfer
Returns:
status of the control write

Definition at line 199 of file USBHost.cpp.

USB_TYPE enumerate ( USBDeviceConnected dev,
IUSBEnumerator *  pEnumerator 
)

Enumerate a device.

Parameters:
devdevice which will be enumerated
Returns:
status of the enumeration

Definition at line 91 of file USBHost.cpp.

USBDeviceConnected* getDevice ( uint8_t  index )

Get a device.

Parameters:
indexindex of the device which will be returned
Returns:
pointer on the "index" device

Definition at line 147 of file USBHost.h.

USBHost * getHostInst (  ) [static]

Static method to create or retrieve the single USBHost instance.

Definition at line 25 of file USBHost.cpp.

USB_TYPE interruptRead ( USBDeviceConnected dev,
USBEndpoint ep,
uint8_t *  buf,
uint32_t  len,
bool  blocking = true 
)

Interrupt read.

Parameters:
devthe interrupt transfer will be done for this device
epUSBEndpoint which will be used to write a packet
bufpointer on a buffer which will be written
lenlength of the transfer
blockingif true, the read is blocking (wait for completion)
Returns:
status of the interrupt read

Definition at line 276 of file USBHost.cpp.

USB_TYPE interruptWrite ( USBDeviceConnected dev,
USBEndpoint ep,
uint8_t *  buf,
uint32_t  len,
bool  blocking = true 
)

Interrupt write.

Parameters:
devthe interrupt transfer will be done for this device
epUSBEndpoint which will be used to write a packet
bufpointer on a buffer which will be written
lenlength of the transfer
blockingif true, the write is blocking (wait for completion)
Returns:
status of the interrupt write
void registerDriver ( USBDeviceConnected dev,
uint8_t  intf,
T *  tptr,
void(T::*)(void)  mptr 
)

register a driver into the host associated with a callback function called when the device is disconnected

Parameters:
devdevice
intfinterface number
tptrpointer to the object to call the member function on
mptrpointer to the member function to be called

Definition at line 160 of file USBHost.h.