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 (BTD *p, bool pair=false, const char *pin="0000")
 
bool connected ()
 
void attachOnInit (void(*funcOnInit)(void))
 
- Public Member Functions inherited from BTHID
 BTHID (BTD *p, bool pair=false, const char *pin="0000")
 
HIDReportParserGetReportParser (uint8_t id)
 
bool SetReportParser (uint8_t id, HIDReportParser *prs)
 
void setProtocolMode (uint8_t mode)
 
void setLeds (uint8_t data)
 
void pair (void)
 
void attachOnInit (void(*funcOnInit)(void))
 
virtual void ACLData (uint8_t *ACLData)
 
virtual void Run ()
 
virtual void Reset ()
 
virtual void disconnect ()
 
- Public Member Functions inherited from PS4Parser
 PS4Parser ()
 
bool getButtonPress (ButtonEnum b)
 
bool getButtonClick (ButtonEnum b)
 
uint8_t getAnalogButton (ButtonEnum b)
 
uint8_t getAnalogHat (AnalogHatEnum a)
 
uint16_t getX (uint8_t finger=0, uint8_t xyId=0)
 
uint16_t getY (uint8_t finger=0, uint8_t xyId=0)
 
bool isTouching (uint8_t finger=0, uint8_t xyId=0)
 
uint8_t getTouchCounter (uint8_t finger=0, uint8_t xyId=0)
 
double getAngle (AngleEnum a)
 
int16_t getSensor (SensorEnum s)
 

Protected Member Functions

BTHID implementation
virtual void ParseBTHID (BTHID *bthid, uint8_t len, uint8_t *buf)
 
virtual void OnInitBTHID ()
 
virtual void ResetBTHID ()
 
Overridable functions
- Protected Member Functions inherited from PS4Parser
void Parse (uint8_t len, uint8_t *buf)
 
void Reset ()
 

Additional Inherited Members

- Public Attributes inherited from BTHID
bool connected
 

Detailed Description

This class implements support for the PS4 controller via Bluetooth. It uses the BTHID class for all the Bluetooth communication.

Definition at line 28 of file PS4BT.h.

Constructor & Destructor Documentation

PS4BT::PS4BT ( BTD p,
bool  pair = false,
const char *  pin = "0000" 
)
inline

Constructor for the PS4BT class.

Parameters
pPointer to the BTD class instance.
pairSet this to true in order to pair with the device. If the argument is omitted then it will not pair with it. One can use PAIR to set it to true.
pinWrite the pin to BTD::btdPin. If argument is omitted, then "0000" will be used.

Definition at line 36 of file PS4BT.h.

Member Function Documentation

bool PS4BT::connected ( )
inline

Used to check if a PS4 controller is connected.

Returns
Returns true if it is connected.

Definition at line 45 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 53 of file PS4BT.h.

virtual void PS4BT::ParseBTHID ( BTHID bthid,
uint8_t  len,
uint8_t *  buf 
)
inlineprotectedvirtual

Used to parse Bluetooth HID data.

Parameters
bthidPointer to the BTHID class.
lenThe length of the incoming data.
bufPointer to the data buffer.

Reimplemented from BTHID.

Definition at line 65 of file PS4BT.h.

virtual void PS4BT::OnInitBTHID ( )
inlineprotectedvirtual

Called when a device is successfully initialized. Use attachOnInit(void (*funcOnInit)(void)) to call your own function. This is useful for instance if you want to set the LEDs in a specific way.

Reimplemented from BTHID.

Definition at line 74 of file PS4BT.h.

virtual void PS4BT::ResetBTHID ( )
inlineprotectedvirtual

Used to reset the different buffers to there default values

Reimplemented from BTHID.

Definition at line 80 of file PS4BT.h.


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