Simple USBHost library for Nucleo F446RE/F411RE/F401RE FRDM-KL46Z/KL25Z/F64F LPC4088/LPC1768

Dependencies:   FATFileSystem

Dependents:   F401RE-BTstack_example F401RE-USBHostMSD_HelloWorld

Fork of KL46Z-USBHost by Norimasa Okamoto

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 isochronousRead (USBDeviceConnected *dev, USBEndpoint *ep, uint8_t *buf, uint32_t len, bool blocking=true)
 Isochronous read.
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.
static void poll ()
 non-blocking processing

Detailed Description

USBHost class This class is a singleton.

All drivers have a reference on the static USBHost instance

Definition at line 30 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 249 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 265 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 195 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 221 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 92 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 148 of file USBHost.h.

USBHost * getHostInst (  ) [static]

Static method to create or retrieve the single USBHost instance.

Definition at line 26 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

Definition at line 292 of file USBHost.cpp.

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

Isochronous read.

Parameters:
devthe isochronous 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 303 of file USBHost.cpp.

void poll (  ) [static]

non-blocking processing

Definition at line 34 of file USBHost.cpp.

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 161 of file USBHost.h.