USB Host Shield 2.0
|
#include <XBOXOLD.h>
Public Member Functions | |
XBOXOLD (USB *pUsb) | |
USBDeviceConfig implementation | |
uint8_t | Init (uint8_t parent, uint8_t port, bool lowspeed) |
uint8_t | Release () |
uint8_t | Poll () |
virtual uint8_t | GetAddress () |
virtual bool | isReady () |
uint8_t | readPollInterval () |
virtual bool | VIDPIDOK (uint16_t vid, uint16_t pid) |
Xbox Controller functions | |
uint8_t | getButtonPress (ButtonEnum b) |
bool | getButtonClick (ButtonEnum b) |
int16_t | getAnalogHat (AnalogHatEnum a) |
void | setRumbleOff () |
void | setRumbleOn (uint8_t lValue, uint8_t rValue) |
void | attachOnInit (void(*funcOnInit)(void)) |
Public Member Functions inherited from USBDeviceConfig | |
virtual uint8_t | ConfigureDevice (uint8_t parent, uint8_t port, bool lowspeed) |
virtual void | ResetHubPort (uint8_t port) |
virtual bool | DEVCLASSOK (uint8_t klass) |
virtual bool | DEVSUBCLASSOK (uint8_t subklass) |
Public Attributes | |
bool | XboxConnected |
Protected Member Functions | |
void | PrintEndpointDescriptor (const USB_ENDPOINT_DESCRIPTOR *ep_ptr) |
UsbConfigXtracter implementation | |
void | EndpointXtract (uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_ENDPOINT_DESCRIPTOR *ep) |
Protected Attributes | |
USB * | pUsb |
uint8_t | bAddress |
EpInfo | epInfo [XBOX_MAX_ENDPOINTS] |
uint8_t | bConfNum |
uint8_t | bNumEP |
uint32_t | qNextPollTime |
This class implements support for a the original Xbox controller via USB.
XBOXOLD::XBOXOLD | ( | USB * | pUsb | ) |
Constructor for the XBOXOLD class.
pUsb | Pointer to USB class instance. |
Definition at line 47 of file XBOXOLD.cpp.
|
virtual |
Initialize the Xbox Controller.
parent | Hub number. |
port | Port number on the hub. |
lowspeed | Speed of the device. |
Reimplemented from USBDeviceConfig.
Definition at line 66 of file XBOXOLD.cpp.
|
virtual |
Release the USB device.
Reimplemented from USBDeviceConfig.
Definition at line 300 of file XBOXOLD.cpp.
|
virtual |
Poll the USB Input endpoins and run the state machines.
Reimplemented from USBDeviceConfig.
Definition at line 314 of file XBOXOLD.cpp.
|
inlinevirtual |
|
inlinevirtual |
|
inline |
|
inlinevirtual |
Used by the USB core to check what this driver support.
vid | The device's VID. |
pid | The device's PID. |
Reimplemented from USBDeviceConfig.
uint8_t XBOXOLD::getButtonPress | ( | ButtonEnum | b | ) |
getButtonPress(ButtonEnum b) will return true as long as the button is held down.
While getButtonClick(ButtonEnum b) will only return it once.
So you instance if you need to increase a variable once you would use getButtonClick(ButtonEnum b), but if you need to drive a robot forward you would use getButtonPress(ButtonEnum b).
b | ButtonEnum to read. |
Definition at line 431 of file XBOXOLD.cpp.
bool XBOXOLD::getButtonClick | ( | ButtonEnum | b | ) |
getButtonPress(ButtonEnum b) will return true as long as the button is held down.
While getButtonClick(ButtonEnum b) will only return it once.
So you instance if you need to increase a variable once you would use getButtonClick(ButtonEnum b), but if you need to drive a robot forward you would use getButtonPress(ButtonEnum b).
b | ButtonEnum to read. |
Definition at line 445 of file XBOXOLD.cpp.
int16_t XBOXOLD::getAnalogHat | ( | AnalogHatEnum | a | ) |
|
inline |
void XBOXOLD::setRumbleOn | ( | uint8_t | lValue, |
uint8_t | rValue | ||
) |
Turn rumble on.
lValue | Left motor (big weight) inside the controller. |
rValue | Right motor (small weight) inside the controller. |
Definition at line 475 of file XBOXOLD.cpp.
|
inline |
|
protectedvirtual |
UsbConfigXtracter implementation, used to extract endpoint information.
conf | Configuration value. |
iface | Interface number. |
alt | Alternate setting. |
proto | Interface Protocol. |
ep | Endpoint Descriptor. |
Reimplemented from UsbConfigXtracter.
Definition at line 254 of file XBOXOLD.cpp.
|
protected |
Used to print the USB Endpoint Descriptor.
ep_ptr | Pointer to USB Endpoint Descriptor. |
Definition at line 279 of file XBOXOLD.cpp.
bool XBOXOLD::XboxConnected |
|
protected |
|
protected |
|
protected |
|
protected |