USB Host Shield 2.0
|
#include <XBOXRECV.h>
Public Attributes | |
bool | XboxReceiverConnected |
uint8_t | Xbox360Connected [4] |
Protected Attributes | |
USB * | pUsb |
uint8_t | bAddress |
EpInfo | epInfo [XBOX_MAX_ENDPOINTS] |
This class implements support for a Xbox Wireless receiver.
Up to four controllers can connect to one receiver, if more is needed one can use a second receiver via the USBHub class.
Definition at line 56 of file XBOXRECV.h.
XBOXRECV::XBOXRECV | ( | USB * | pUsb | ) |
Constructor for the XBOXRECV class.
pUsb | Pointer to USB class instance. |
Definition at line 25 of file XBOXRECV.cpp.
Address assignment and basic initilization is done here.
parent | Hub number. |
port | Port number on the hub. |
lowspeed | Speed of the device. |
Reimplemented from USBDeviceConfig.
Definition at line 41 of file XBOXRECV.cpp.
Initialize the Xbox wireless receiver.
parent | Hub number. |
port | Port number on the hub. |
lowspeed | Speed of the device. |
Reimplemented from USBDeviceConfig.
Definition at line 138 of file XBOXRECV.cpp.
|
virtual |
Release the USB device.
Reimplemented from USBDeviceConfig.
Definition at line 283 of file XBOXRECV.cpp.
|
virtual |
Poll the USB Input endpoins and run the state machines.
Reimplemented from USBDeviceConfig.
Definition at line 293 of file XBOXRECV.cpp.
Get the device address.
Reimplemented from USBDeviceConfig.
Definition at line 96 of file XBOXRECV.h.
Used to check if the controller has been initialized.
Definition at line 104 of file XBOXRECV.h.
Used by the USB core to check what this driver support.
vid | The device's VID. |
pid | The device's PID. |
Reimplemented from USBDeviceConfig.
Definition at line 114 of file XBOXRECV.h.
uint8_t XBOXRECV::getButtonPress | ( | ButtonEnum | b, |
uint8_t | controller = 0 |
||
) |
getButtonPress(uint8_t controller, ButtonEnum b) will return true as long as the button is held down.
While getButtonClick(uint8_t controller, ButtonEnum b) will only return it once.
So you instance if you need to increase a variable once you would use getButtonClick(uint8_t controller, ButtonEnum b), but if you need to drive a robot forward you would use getButtonPress(uint8_t controller, ButtonEnum b).
b | ButtonEnum to read. |
controller | The controller to read from. Default to 0. |
Definition at line 410 of file XBOXRECV.cpp.
bool XBOXRECV::getButtonClick | ( | ButtonEnum | b, |
uint8_t | controller = 0 |
||
) |
getButtonPress(uint8_t controller, ButtonEnum b) will return true as long as the button is held down.
While getButtonClick(uint8_t controller, ButtonEnum b) will only return it once.
So you instance if you need to increase a variable once you would use getButtonClick(uint8_t controller, ButtonEnum b), but if you need to drive a robot forward you would use getButtonPress(uint8_t controller, ButtonEnum b).
b | ButtonEnum to read. |
controller | The controller to read from. Default to 0. |
Definition at line 419 of file XBOXRECV.cpp.
int16_t XBOXRECV::getAnalogHat | ( | AnalogHatEnum | a, |
uint8_t | controller = 0 |
||
) |
Used to disconnect any of the controllers.
controller | The controller to disconnect. Default to 0. |
Definition at line 500 of file XBOXRECV.cpp.
Turn rumble off and all the LEDs on the specific controller.
controller | The controller to write to. Default to 0. |
Definition at line 154 of file XBOXRECV.h.
Turn rumble off the specific controller.
controller | The controller to write to. Default to 0. |
Definition at line 163 of file XBOXRECV.h.
Turn rumble on.
lValue | Left motor (big weight) inside the controller. |
rValue | Right motor (small weight) inside the controller. |
controller | The controller to write to. Default to 0. |
Definition at line 559 of file XBOXRECV.cpp.
Set LED value. Without using the LEDEnum or LEDModeEnum.
value | See: setLedOff(uint8_t controller), setLedOn(uint8_t controller, LED l), setLedBlink(uint8_t controller, LED l), and setLedMode(uint8_t controller, LEDMode lm). |
controller | The controller to write to. Default to 0. |
Definition at line 509 of file XBOXRECV.cpp.
Turn all LEDs off the specific controller.
controller | The controller to write to. Default to 0. |
Definition at line 186 of file XBOXRECV.h.
void XBOXRECV::setLedMode | ( | LEDModeEnum | lm, |
uint8_t | controller = 0 |
||
) |
Used to set special LED modes supported by the Xbox controller.
lm | See LEDModeEnum. |
controller | The controller to write to. Default to 0. |
Definition at line 529 of file XBOXRECV.cpp.
Used to get the battery level from the controller.
controller | The controller to read from. Default to 0. |
Definition at line 469 of file XBOXRECV.cpp.
Used to check if a button has changed.
controller | The controller to read from. Default to 0. |
Definition at line 444 of file XBOXRECV.cpp.
Used to call your own function when the controller is successfully initialized.
funcOnInit | Function to call. |
Definition at line 224 of file XBOXRECV.h.
bool XBOXRECV::XboxReceiverConnected |
True if a wireless receiver is connected.
Definition at line 230 of file XBOXRECV.h.
uint8_t XBOXRECV::Xbox360Connected[4] |
Variable used to indicate if the XBOX 360 controller is successfully connected.
Definition at line 232 of file XBOXRECV.h.
|
protected |
Pointer to USB class instance.
Definition at line 236 of file XBOXRECV.h.
|
protected |
Device address.
Definition at line 238 of file XBOXRECV.h.
|
protected |
Endpoint info structure.
Definition at line 240 of file XBOXRECV.h.