Public Types | Static Public Member Functions

mxusb::USBdevice Class Reference

#include <usb.h>

List of all members.

Public Types

enum  State { DEFAULT, ADDRESS, CONFIGURED }

Static Public Member Functions

static bool enable (const unsigned char *device, const unsigned char *const *configs, const unsigned char *const *strings=0, unsigned char numStrings=0)
static void disable ()
static State getState ()
static State IRQgetState ()
static unsigned char getConfiguration ()
static unsigned char IRQgetConfiguration ()
static void waitUntilConfigured ()
static bool isSuspended ()

Detailed Description

Allows to configure the USB peripheral.


Member Enumeration Documentation

Possible USB states

Enumerator:
DEFAULT 

Reached after an USB reset request.

ADDRESS 

USB host assigned an address to device.

CONFIGURED 

Device is configured.


Member Function Documentation

void mxusb::USBdevice::disable (  )  [static]

Disables the USB peripheral

bool mxusb::USBdevice::enable ( const unsigned char *  device,
const unsigned char *const *  configs,
const unsigned char *const *  strings = 0,
unsigned char  numStrings = 0 
) [static]

Configure the USB peripheral, given the descriptors.

Parameters:
device device descriptor
configs array of configuration descriptor. Its size is inferred by the bNumConfigrations value in the device descriptor
strings array of string descriptors
numStrings size of strings array
Returns:
true if configuration succeeded
unsigned char mxusb::USBdevice::getConfiguration (  )  [static]
Returns:
The configuration that the USB host has selected. Zero means unconfigured.
USBdevice::State mxusb::USBdevice::getState (  )  [static]
Returns:
current device state.
static unsigned char mxusb::USBdevice::IRQgetConfiguration (  )  [inline, static]
Returns:
same as getConfiguration(), but can be called from IRQ or with interrupts disabled.
static State mxusb::USBdevice::IRQgetState (  )  [inline, static]
Returns:
same as getState(), but can be called from IRQ or with interrupts disabled.
bool mxusb::USBdevice::isSuspended (  )  [static]
Returns:
true if device is suspended
void mxusb::USBdevice::waitUntilConfigured (  )  [static]

This function returns as soon as the USB device is in the configured state. If the device is already configured, it returns immediately. If two or more threads call this function, the behaviour is undefined.


The documentation for this class was generated from the following files: