USB Host Shield 2.0
Public Member Functions | List of all members
PS5BT Class Reference

#include <PS5BT.h>

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

Public Member Functions

 PS5BT (BTD *p, bool pair=false, const char *pin="0000")
 
bool connected ()
 
- 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 pair (void)
 
uint32_t getLastMessageTime ()
 
void setLeds (struct KBDLEDS data)
 
void setLeds (uint8_t data)
 
void disconnect ()
 
- Public Member Functions inherited from BluetoothService
 BluetoothService (BTD *p)
 
void attachOnInit (void(*funcOnInit)(void))
 
- Public Member Functions inherited from PS5Parser
 PS5Parser ()
 
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)
 
uint16_t getY (uint8_t finger=0)
 
bool isTouching (uint8_t finger=0)
 
uint8_t getTouchCounter (uint8_t finger=0)
 
float getAngle (AngleEnum a)
 
int16_t getSensor (SensorEnum s)
 
void setAllOff ()
 
void setRumbleOff ()
 
void setRumbleOn (RumbleEnum mode)
 
void setRumbleOn (uint8_t bigRumble, uint8_t smallRumble)
 
void setLedOff ()
 
void setLed (uint8_t r, uint8_t g, uint8_t b)
 
void setLed (ColorsEnum color)
 
void setPlayerLedOff ()
 
void setPlayerLed (uint8_t mask)
 
void setMicLedOff ()
 
void setMicLed (bool on)
 
uint16_t getMessageCounter ()
 

Protected Member Functions

BTHID implementation
virtual void ParseBTHIDData (uint8_t len, uint8_t *buf)
 
virtual void OnInitBTHID ()
 
virtual void ResetBTHID ()
 
PS5Parser implementation
virtual void sendOutputReport (PS5Output *output)
 
- Protected Member Functions inherited from BTHID
virtual void ParseBTHIDControlData (uint8_t len, uint8_t *buf)
 
void ACLData (uint8_t *ACLData)
 
void Run ()
 
void Reset ()
 
void onInit ()
 
- Protected Member Functions inherited from BluetoothService
bool checkHciHandle (uint8_t *buf, uint16_t handle)
 
- Protected Member Functions inherited from PS5Parser
void Parse (uint8_t len, uint8_t *buf)
 
void Reset ()
 

Additional Inherited Members

- Public Attributes inherited from BTHID
bool connected
 
- Public Attributes inherited from PS5Parser
PS5Trigger leftTrigger
 
PS5Trigger rightTrigger
 
- Protected Attributes inherited from BTHID
uint8_t control_scid [2]
 
uint8_t interrupt_scid [2]
 
uint8_t l2cap_sdp_state
 
uint8_t sdp_scid [2]
 
- Protected Attributes inherited from BluetoothService
void(* pFuncOnInit )(void)
 
BTDpBtd
 
uint16_t hci_handle
 
uint32_t l2cap_event_flag
 
uint8_t identifier
 

Detailed Description

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

Definition at line 109 of file PS5BT.h.

Constructor & Destructor Documentation

◆ PS5BT()

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

Constructor for the PS5BT 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 117 of file PS5BT.h.

Member Function Documentation

◆ connected()

bool PS5BT::connected ( )
inline

Used to check if a PS5 controller is connected.

Returns
Returns true if it is connected.

Definition at line 126 of file PS5BT.h.

◆ ParseBTHIDData()

virtual void PS5BT::ParseBTHIDData ( uint8_t  len,
uint8_t *  buf 
)
inlineprotectedvirtual

Used to parse Bluetooth HID data.

Parameters
lenThe length of the incoming data.
bufPointer to the data buffer.

Reimplemented from BTHID.

Definition at line 137 of file PS5BT.h.

◆ OnInitBTHID()

virtual void PS5BT::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 146 of file PS5BT.h.

◆ ResetBTHID()

virtual void PS5BT::ResetBTHID ( )
inlineprotectedvirtual

Used to reset the different buffers to there default values

Reimplemented from BTHID.

Definition at line 156 of file PS5BT.h.

◆ sendOutputReport()

virtual void PS5BT::sendOutputReport ( PS5Output output)
inlineprotectedvirtual

Send the output to the PS5 controller. This is implemented in PS5BT.h and PS5USB.h.

Parameters
outputPointer to PS5Output buffer;

Implements PS5Parser.

Definition at line 162 of file PS5BT.h.


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