USB Host Shield 2.0
|
#include <XBOXUSB.h>
Public Member Functions | |
XBOXUSB (USB *pUsb) | |
USBDeviceConfig implementation | |
virtual uint8_t | Init (uint8_t parent, uint8_t port, bool lowspeed) |
virtual uint8_t | Release () |
virtual uint8_t | Poll () |
virtual uint8_t | GetAddress () |
virtual bool | isReady () |
Xbox Controller functions | |
uint8_t | getButtonPress (Button b) |
bool | getButtonClick (Button b) |
int16_t | getAnalogHat (AnalogHat a) |
void | setAllOff () |
void | setRumbleOff () |
void | setRumbleOn (uint8_t lValue, uint8_t rValue) |
void | setLedRaw (uint8_t value) |
void | setLedOff () |
void | setLedOn (LED l) |
void | setLedBlink (LED l) |
void | setLedMode (LEDMode lm) |
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.
|
virtual |
Initialize the Xbox Controller.
parent | Hub number. |
port | Port number on the hub. |
lowspeed | Speed of the device. |
Implements USBDeviceConfig.
Definition at line 38 of file XBOXUSB.cpp.
|
virtual |
Release the USB device.
Implements USBDeviceConfig.
Definition at line 220 of file XBOXUSB.cpp.
|
virtual |
Poll the USB Input endpoins and run the state machines.
Implements USBDeviceConfig.
Definition at line 227 of file XBOXUSB.cpp.
|
inlinevirtual |
|
inlinevirtual |
uint8_t XBOXUSB::getButtonPress | ( | Button | b | ) |
getButtonPress(Button b) will return true as long as the button is held down.
While getButtonClick(Button b) will only return it once.
So you instance if you need to increase a variable once you would use getButtonClick(Button b), but if you need to drive a robot forward you would use getButtonPress(Button b).
b | Button to read. |
Definition at line 278 of file XBOXUSB.cpp.
bool XBOXUSB::getButtonClick | ( | Button | b | ) |
getButtonPress(Button b) will return true as long as the button is held down.
While getButtonClick(Button b) will only return it once.
So you instance if you need to increase a variable once you would use getButtonClick(Button b), but if you need to drive a robot forward you would use getButtonPress(Button b).
b | Button to read. |
Definition at line 285 of file XBOXUSB.cpp.
int16_t XBOXUSB::getAnalogHat | ( | AnalogHat | a | ) |
|
inline |
|
inline |
void XBOXUSB::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 331 of file XBOXUSB.cpp.
void XBOXUSB::setLedRaw | ( | uint8_t | value | ) |
Set LED value. Without using the LED or LEDMode enum.
value | See: setLedOff(), setLedOn(LED l), setLedBlink(LED l), and setLedMode(LEDMode lm). |
Definition at line 314 of file XBOXUSB.cpp.
|
inline |
void XBOXUSB::setLedOn | ( | LED | l | ) |
void XBOXUSB::setLedBlink | ( | LED | l | ) |
void XBOXUSB::setLedMode | ( | LEDMode | lm | ) |
Used to set special LED modes supported by the Xbox controller.
controller | The controller to write to. |
lm | See LEDMode. |
Definition at line 328 of file XBOXUSB.cpp.
bool XBOXUSB::Xbox360Connected |
|
protected |
|
protected |