USB Host Shield 2.0
|
#include <XBOXONE.h>
Public Member Functions | |
XBOXONE (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 () |
uint8_t | readPollInterval () |
virtual bool | VIDPIDOK (uint16_t vid, uint16_t pid) |
Xbox Controller functions | |
uint16_t | getButtonPress (ButtonEnum b) |
bool | getButtonClick (ButtonEnum b) |
int16_t | getAnalogHat (AnalogHatEnum a) |
void | attachOnInit (void(*funcOnInit)(void)) |
void | setRumbleOff () |
void | setRumbleOn (uint8_t leftTrigger, uint8_t rightTrigger, uint8_t leftMotor, uint8_t rightMotor) |
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 | XboxOneConnected |
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_ONE_MAX_ENDPOINTS] |
uint8_t | bConfNum |
uint8_t | bNumEP |
uint32_t | qNextPollTime |
This class implements support for a Xbox ONE controller connected via USB.
XBOXONE::XBOXONE | ( | USB * | pUsb | ) |
Constructor for the XBOXONE class.
pUsb | Pointer to USB class instance. |
Definition at line 27 of file XBOXONE.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 46 of file XBOXONE.cpp.
|
virtual |
Release the USB device.
Reimplemented from USBDeviceConfig.
Definition at line 286 of file XBOXONE.cpp.
|
virtual |
Poll the USB Input endpoins and run the state machines.
Reimplemented from USBDeviceConfig.
Definition at line 300 of file XBOXONE.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.
uint16_t XBOXONE::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 385 of file XBOXONE.cpp.
bool XBOXONE::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 399 of file XBOXONE.cpp.
int16_t XBOXONE::getAnalogHat | ( | AnalogHatEnum | a | ) |
|
inline |
void XBOXONE::setRumbleOff | ( | ) |
Used to set the rumble off.
Definition at line 473 of file XBOXONE.cpp.
void XBOXONE::setRumbleOn | ( | uint8_t | leftTrigger, |
uint8_t | rightTrigger, | ||
uint8_t | leftMotor, | ||
uint8_t | rightMotor | ||
) |
Used to turn on rumble continuously.
leftTrigger | Left trigger force. |
rightTrigger | Right trigger force. |
leftMotor | Left motor force. |
rightMotor | Right motor force. |
Definition at line 495 of file XBOXONE.cpp.
|
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 239 of file XBOXONE.cpp.
|
protected |
Used to print the USB Endpoint Descriptor.
ep_ptr | Pointer to USB Endpoint Descriptor. |
Definition at line 265 of file XBOXONE.cpp.
bool XBOXONE::XboxOneConnected |
|
protected |
|
protected |
|
protected |
|
protected |