USBHost library. NOTE: This library is only officially supported on the LPC1768 platform. For more information, please see the handbook page.

Dependencies:   FATFileSystem mbed-rtos

Dependents:   BTstack WallbotWii SD to Flash Data Transfer USBHost-MSD_HelloWorld ... more

Embed: (wiki syntax)

« Back to documentation index

USBDeviceConnected Class Reference

USBDeviceConnected Class Reference

USBDeviceConnected class. More...

#include <USBDeviceConnected.h>

Public Member Functions

 USBDeviceConnected ()
 Constructor.
bool addEndpoint (uint8_t intf_nb, USBEndpoint *ep)
 Attach an USBEndpoint to this device.
USBEndpointgetEndpoint (uint8_t intf_nb, ENDPOINT_TYPE type, ENDPOINT_DIRECTION dir, uint8_t index=0)
 Retrieve an USBEndpoint by its TYPE and DIRECTION.
USBEndpointgetEndpoint (uint8_t intf_nb, uint8_t index)
 Retrieve an USBEndpoint by its index.
bool addInterface (uint8_t intf_nb, uint8_t intf_class, uint8_t intf_subclass, uint8_t intf_protocol)
 Add a new interface to this device.
INTERFACE * getInterface (uint8_t index)
 Get a specific interface.
template<typename T >
void onDisconnect (uint8_t intf_nb, T *tptr, void(T::*mptr)(void))
 Attach a member function to call when a the device has been disconnected.
void onDisconnect (uint8_t intf_nb, void(*fn)(void))
 Attach a callback called when the device has been disconnected.
void disconnect ()
 Disconnect the device by calling a callback function registered by a driver.

Detailed Description

USBDeviceConnected class.

Definition at line 42 of file USBDeviceConnected.h.


Constructor & Destructor Documentation

Constructor.

Definition at line 20 of file USBDeviceConnected.cpp.


Member Function Documentation

bool addEndpoint ( uint8_t  intf_nb,
USBEndpoint ep 
)

Attach an USBEndpoint to this device.

Parameters:
intf_nbinterface number
eppointeur on the USBEndpoint which will be attached
Returns:
true if successful, false otherwise

Definition at line 72 of file USBDeviceConnected.cpp.

bool addInterface ( uint8_t  intf_nb,
uint8_t  intf_class,
uint8_t  intf_subclass,
uint8_t  intf_protocol 
)

Add a new interface to this device.

Parameters:
intf_nbinterface number
intf_classinterface class
intf_subclassinterface subclass
intf_protocolinterface protocol
Returns:
true if successful, false otherwise

Definition at line 60 of file USBDeviceConnected.cpp.

void disconnect (  )

Disconnect the device by calling a callback function registered by a driver.

Definition at line 95 of file USBDeviceConnected.cpp.

USBEndpoint * getEndpoint ( uint8_t  intf_nb,
ENDPOINT_TYPE  type,
ENDPOINT_DIRECTION  dir,
uint8_t  index = 0 
)

Retrieve an USBEndpoint by its TYPE and DIRECTION.

Parameters:
intf_nbthe interface on which to lookup the USBEndpoint
typetype of the USBEndpoint looked for
dirdirection of the USBEndpoint looked for
indexthe index of the USBEndpoint whitin the interface
Returns:
pointer on the USBEndpoint if found, NULL otherwise

Definition at line 103 of file USBDeviceConnected.cpp.

USBEndpoint * getEndpoint ( uint8_t  intf_nb,
uint8_t  index 
)

Retrieve an USBEndpoint by its index.

Parameters:
intf_nbinterface number
indexindex of the USBEndpoint
Returns:
pointer on the USBEndpoint if found, NULL otherwise

Definition at line 119 of file USBDeviceConnected.cpp.

INTERFACE * getInterface ( uint8_t  index )

Get a specific interface.

Parameters:
indexindex of the interface to be fetched
Returns:
interface

Definition at line 50 of file USBDeviceConnected.cpp.

void onDisconnect ( uint8_t  intf_nb,
void(*)(void)  fn 
)

Attach a callback called when the device has been disconnected.

Parameters:
intf_nbinterface number
fnfunction pointer

Definition at line 119 of file USBDeviceConnected.h.

void onDisconnect ( uint8_t  intf_nb,
T *  tptr,
void(T::*)(void)  mptr 
)

Attach a member function to call when a the device has been disconnected.

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

Definition at line 107 of file USBDeviceConnected.h.