USB Host Shield 2.0
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Public Member Functions | List of all members
PS4BT Class Reference

#include <PS4BT.h>

Inheritance diagram for PS4BT:
Inheritance graph
[legend]
Collaboration diagram for PS4BT:
Collaboration graph
[legend]

Public Member Functions

 PS4BT (BTHID *p)
 
virtual void Parse (HID *hid, bool is_rpt_id, uint8_t len, uint8_t *buf)
 
bool connected ()
 
void disconnect ()
 
void pair (void)
 
void Reset ()
 
void attachOnInit (void(*funcOnInit)(void))
 
PS4 Controller functions
bool getButtonPress (ButtonEnum b)
 
bool getButtonClick (ButtonEnum b)
 
uint8_t getAnalogButton (ButtonEnum a)
 
uint8_t getAnalogHat (AnalogHatEnum a)
 

Detailed Description

This BluetoothService class implements support for the PS4 controller via Bluetooth.

Definition at line 67 of file PS4BT.h.

Constructor & Destructor Documentation

PS4BT::PS4BT ( BTHID p)
inline

Constructor for the PS4BT class.

Parameters
pPointer to the BTD class instance.

Definition at line 73 of file PS4BT.h.

Member Function Documentation

void PS4BT::Parse ( HID hid,
bool  is_rpt_id,
uint8_t  len,
uint8_t *  buf 
)
virtual

Implements HIDReportParser.

Definition at line 97 of file PS4BT.cpp.

bool PS4BT::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 60 of file PS4BT.cpp.

bool PS4BT::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 71 of file PS4BT.cpp.

uint8_t PS4BT::getAnalogButton ( ButtonEnum  a)

Used to get the analog value from button presses.

Parameters
aThe ButtonEnum to read. The supported buttons are: UP, RIGHT, DOWN, LEFT, L1, L2, R1, R2, TRIANGLE, CIRCLE, CROSS, SQUARE, and T.
Returns
Analog value in the range of 0-255.

Definition at line 89 of file PS4BT.cpp.

uint8_t PS4BT::getAnalogHat ( AnalogHatEnum  a)

Used to read the analog joystick.

Parameters
aLeftHatX, LeftHatY, RightHatX, and RightHatY.
Returns
Return the analog value in the range of 0-255.

Definition at line 93 of file PS4BT.cpp.

bool PS4BT::connected ( )
inline

True if a device is connected

Definition at line 115 of file PS4BT.h.

void PS4BT::disconnect ( )
inline

Used this to disconnect the devices.

Definition at line 122 of file PS4BT.h.

void PS4BT::pair ( void  )
inline

Call this to start the paring sequence with a device

Definition at line 128 of file PS4BT.h.

void PS4BT::Reset ( )
inline

Definition at line 133 of file PS4BT.h.

void PS4BT::attachOnInit ( void(*)(void)  funcOnInit)
inline

Used to call your own function when the device is successfully initialized.

Parameters
funcOnInitFunction to call.

Definition at line 153 of file PS4BT.h.


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