USB Host Shield 2.0
|
#include <SwitchProBT.h>
Public Member Functions | |
SwitchProBT (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") | |
HIDReportParser * | GetReportParser (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 SwitchProParser | |
SwitchProParser () | |
bool | getButtonPress (ButtonEnum b) |
bool | getButtonClick (ButtonEnum b) |
int16_t | getAnalogHat (AnalogHatEnum a) |
void | enableImu (bool enable) |
float | getAngle (AngleEnum a) |
int16_t | getSensor (SensorEnum s) |
void | setAllOff () |
void | setRumbleOff () |
void | setRumbleToggle () |
void | setRumble (bool leftRumbleOn, bool rightRumbleOn) |
void | setRumbleLeft (bool on) |
void | setRumbleRight (bool on) |
void | setLedRaw (uint8_t mask) |
void | setLedOff () |
void | setLedOff (LEDEnum a) |
void | setLedOn (LEDEnum a) |
void | setLedToggle (LEDEnum a) |
void | setLedHomeOff () |
void | setLedHomeOn () |
void | setLedHomeToggle () |
uint16_t | getMessageCounter () |
uint8_t | getBatteryLevel () |
bool | isCharging () |
Protected Member Functions | |
BTHID implementation | |
virtual void | ParseBTHIDData (uint8_t len, uint8_t *buf) |
virtual void | OnInitBTHID () |
virtual void | ResetBTHID () |
SwitchProParser implementation | |
virtual void | sendOutputReport (uint8_t *data, uint8_t len) |
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 SwitchProParser | |
void | Parse (uint8_t len, uint8_t *buf) |
void | Reset () |
virtual void | sendHandshake () |
virtual void | disableTimeout () |
Additional Inherited Members | |
Public Attributes inherited from BTHID | |
bool | connected |
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) |
BTD * | pBtd |
uint16_t | hci_handle |
uint32_t | l2cap_event_flag |
uint8_t | identifier |
Protected Attributes inherited from SwitchProParser | |
SwitchProOutput | switchProOutput |
This class implements support for the Switch Pro controller via Bluetooth. It uses the BTHID class for all the Bluetooth communication.
Definition at line 28 of file SwitchProBT.h.
|
inline |
Constructor for the SwitchProBT class.
p | Pointer to the BTD class instance. |
pair | Set 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. |
pin | Write the pin to BTD::btdPin. If argument is omitted, then "0000" will be used. |
Definition at line 36 of file SwitchProBT.h.
|
inline |
Used to check if a Switch Pro controller is connected.
Definition at line 45 of file SwitchProBT.h.
|
inlineprotectedvirtual |
Used to parse Bluetooth HID data.
len | The length of the incoming data. |
buf | Pointer to the data buffer. |
Reimplemented from BTHID.
Definition at line 56 of file SwitchProBT.h.
|
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 65 of file SwitchProBT.h.
|
inlineprotectedvirtual |
Used to reset the different buffers to there default values
Reimplemented from BTHID.
Definition at line 76 of file SwitchProBT.h.
|
inlineprotectedvirtual |
Send the output to the Switch Pro controller. This is implemented in SwitchProBT.h and SwitchProUSB.h.
data | Pointer to buffer to send by the derived class. |
len | Length of buffer. |
Implements SwitchProParser.
Definition at line 82 of file SwitchProBT.h.