USB Host Shield 2.0
|
#include <XBOXUSB.h>
Public Member Functions | |
XBOXUSB (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 () |
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 | setAllOff () |
void | setRumbleOff () |
void | setRumbleOn (uint8_t lValue, uint8_t rValue) |
void | setLedRaw (uint8_t value) |
void | setLedOff () |
void | setLedOn (LEDEnum l) |
void | setLedBlink (LEDEnum l) |
void | setLedMode (LEDModeEnum lm) |
void | attachOnInit (void(*funcOnInit)(void)) |
![]() | |
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 | Xbox360Connected |
Protected Attributes | |
USB * | pUsb |
uint8_t | bAddress |
EpInfo | epInfo [XBOX_MAX_ENDPOINTS] |
This class implements support for a Xbox wired controller via USB.
XBOXUSB::XBOXUSB | ( | USB * | pUsb | ) |
Constructor for the XBOXUSB class.
pUsb | Pointer to USB class instance. |
Definition at line 23 of file XBOXUSB.cpp.
Initialize the Xbox Controller.
parent | Hub number. |
port | Port number on the hub. |
lowspeed | Speed of the device. |
Reimplemented from USBDeviceConfig.
Definition at line 39 of file XBOXUSB.cpp.
|
virtual |
Release the USB device.
Reimplemented from USBDeviceConfig.
Definition at line 224 of file XBOXUSB.cpp.
|
virtual |
Poll the USB Input endpoins and run the state machines.
Reimplemented from USBDeviceConfig.
Definition at line 232 of file XBOXUSB.cpp.
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 XBOXUSB::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 283 of file XBOXUSB.cpp.
bool XBOXUSB::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 292 of file XBOXUSB.cpp.
int16_t XBOXUSB::getAnalogHat | ( | AnalogHatEnum | a | ) |
|
inline |
|
inline |
Turn rumble on.
lValue | Left motor (big weight) inside the controller. |
rValue | Right motor (small weight) inside the controller. |
Definition at line 346 of file XBOXUSB.cpp.
Set LED value. Without using the LEDEnum or LEDModeEnum.
value | See: setLedOff(), setLedOn(LEDEnum l), setLedBlink(LEDEnum l), and setLedMode(LEDModeEnum lm). |
Definition at line 323 of file XBOXUSB.cpp.
|
inline |
void XBOXUSB::setLedMode | ( | LEDModeEnum | lm | ) |
Used to set special LED modes supported by the Xbox controller.
lm | See LEDModeEnum. |
Definition at line 342 of file XBOXUSB.cpp.
bool XBOXUSB::Xbox360Connected |
|
protected |
|
protected |