USB Host Shield 2.0
Public Member Functions | Protected Member Functions | List of all members
XBOXONESParser Class Referenceabstract

#include <XBOXONESParser.h>

Inheritance diagram for XBOXONESParser:
Inheritance graph
[legend]

Public Member Functions

 XBOXONESParser ()
 
int16_t getAnalogHat (AnalogHatEnum a)
 
void setRumbleOff ()
 
void setRumbleOn (uint8_t leftTrigger, uint8_t rightTrigger, uint8_t leftMotor, uint8_t rightMotor)
 
Xbox One S Controller functions
uint16_t getButtonPress (ButtonEnum b)
 
bool getButtonClick (ButtonEnum b)
 

Protected Member Functions

void Parse (uint8_t len, uint8_t *buf)
 
void Reset ()
 
virtual void sendOutputReport (uint8_t *data, uint8_t nbytes)=0
 

Detailed Description

This class parses all the data sent by the Xbox One S controller

Definition at line 54 of file XBOXONESParser.h.

Constructor & Destructor Documentation

◆ XBOXONESParser()

XBOXONESParser::XBOXONESParser ( )
inline

Constructor for the XBOXONESParser class.

Definition at line 57 of file XBOXONESParser.h.

Member Function Documentation

◆ getButtonPress()

uint16_t XBOXONESParser::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).

Parameters
bButtonEnum to read.
Returns
getButtonPress(ButtonEnum b) will return a true as long as a button is held down, while getButtonClick(ButtonEnum b) will return true once for each button press.

Definition at line 79 of file XBOXONESParser.cpp.

◆ getButtonClick()

bool XBOXONESParser::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).

Parameters
bButtonEnum to read.
Returns
getButtonPress(ButtonEnum b) will return a true as long as a button is held down, while getButtonClick(ButtonEnum b) will return true once for each button press.

Definition at line 92 of file XBOXONESParser.cpp.

◆ getAnalogHat()

int16_t XBOXONESParser::getAnalogHat ( AnalogHatEnum  a)

Used to read the analog joystick.

Parameters
aLeftHatX, LeftHatY, RightHatX, and RightHatY.
Returns
Return the analog value as a 16-bit signed integer.

Definition at line 117 of file XBOXONESParser.cpp.

◆ setRumbleOff()

void XBOXONESParser::setRumbleOff ( )

Used to set the rumble off.

Definition at line 195 of file XBOXONESParser.cpp.

◆ setRumbleOn()

void XBOXONESParser::setRumbleOn ( uint8_t  leftTrigger,
uint8_t  rightTrigger,
uint8_t  leftMotor,
uint8_t  rightMotor 
)

Used to turn on rumble continuously.

Parameters
leftTriggerLeft trigger force.
rightTriggerRight trigger force.
leftMotorLeft motor force.
rightMotorRight motor force.

Definition at line 209 of file XBOXONESParser.cpp.

◆ Parse()

void XBOXONESParser::Parse ( uint8_t  len,
uint8_t *  buf 
)
protected

Used to parse data sent from the Xbox One S controller.

Parameters
lenLength of the data.
bufPointer to the data buffer.

Definition at line 121 of file XBOXONESParser.cpp.

◆ Reset()

void XBOXONESParser::Reset ( )
protected

Used to reset the different buffers to their default values

Definition at line 180 of file XBOXONESParser.cpp.

◆ sendOutputReport()

virtual void XBOXONESParser::sendOutputReport ( uint8_t *  data,
uint8_t  nbytes 
)
protectedpure virtual

Send the output to the Xbox One S controller. This is implemented in XBOXONESBT.h.

Parameters
outputPointer to data buffer.
nbytesBytes to send.

Implemented in XBOXONESBT.


The documentation for this class was generated from the following files: