#include <SwitchProParser.h>
This class parses all the data sent by the Switch Pro controller
Definition at line 141 of file SwitchProParser.h.
◆ SwitchProParser()
SwitchProParser::SwitchProParser |
( |
| ) |
|
|
inline |
◆ getButtonPress()
bool SwitchProParser::getButtonPress |
( |
ButtonEnum |
b | ) |
|
◆ getButtonClick()
bool SwitchProParser::getButtonClick |
( |
ButtonEnum |
b | ) |
|
◆ getAnalogHat()
Used to read the analog joystick.
- Parameters
-
- Returns
- Return the analog value as a signed 16-bit value.
Definition at line 42 of file SwitchProParser.cpp.
◆ enableImu()
void SwitchProParser::enableImu |
( |
bool |
enable | ) |
|
|
inline |
Used to enable/disable the IMU. By default it is disabled.
- Parameters
-
enable | Enable/disable the IMU. |
Definition at line 174 of file SwitchProParser.h.
◆ getAngle()
float SwitchProParser::getAngle |
( |
AngleEnum |
a | ) |
|
|
inline |
Get the angle of the controller calculated using the accelerometer.
- Parameters
-
- Returns
- Return the angle in the range of 0-360.
Definition at line 184 of file SwitchProParser.h.
◆ getSensor()
int16_t SwitchProParser::getSensor |
( |
SensorEnum |
s | ) |
|
|
inline |
Used to get the raw values from the 3-axis gyroscope and 3-axis accelerometer inside the PS5 controller.
- Parameters
-
- Returns
- Returns the raw sensor reading.
Definition at line 196 of file SwitchProParser.h.
◆ setAllOff()
void SwitchProParser::setAllOff |
( |
| ) |
|
|
inline |
◆ setRumbleOff()
void SwitchProParser::setRumbleOff |
( |
| ) |
|
|
inline |
◆ setRumbleToggle()
void SwitchProParser::setRumbleToggle |
( |
| ) |
|
|
inline |
◆ setRumble()
void SwitchProParser::setRumble |
( |
bool |
leftRumbleOn, |
|
|
bool |
rightRumbleOn |
|
) |
| |
|
inline |
Turn on/off rumble.
- Parameters
-
leftRumbleOn | Turn on/off left rumble motor. |
rightRumbleOn | Turn on/off right rumble motor. |
Definition at line 237 of file SwitchProParser.h.
◆ setRumbleLeft()
void SwitchProParser::setRumbleLeft |
( |
bool |
on | ) |
|
|
inline |
Turn on/off the left rumble.
- Parameters
-
on | Turn on/off left rumble motor. |
Definition at line 247 of file SwitchProParser.h.
◆ setRumbleRight()
void SwitchProParser::setRumbleRight |
( |
bool |
on | ) |
|
|
inline |
Turn on/off the right rumble.
- Parameters
-
on | Turn on/off right rumble motor. |
Definition at line 256 of file SwitchProParser.h.
◆ setLedRaw()
void SwitchProParser::setLedRaw |
( |
uint8_t |
mask | ) |
|
|
inline |
Set LED value without using the LEDEnum. This can also be used to flash the LEDs by setting the high 4-bits of the mask.
- Parameters
-
Definition at line 266 of file SwitchProParser.h.
◆ setLedOff() [1/2]
void SwitchProParser::setLedOff |
( |
| ) |
|
|
inline |
◆ setLedOff() [2/2]
void SwitchProParser::setLedOff |
( |
LEDEnum |
a | ) |
|
|
inline |
◆ setLedOn()
void SwitchProParser::setLedOn |
( |
LEDEnum |
a | ) |
|
|
inline |
◆ setLedToggle()
void SwitchProParser::setLedToggle |
( |
LEDEnum |
a | ) |
|
|
inline |
◆ setLedHomeOff()
void SwitchProParser::setLedHomeOff |
( |
| ) |
|
|
inline |
◆ setLedHomeOn()
void SwitchProParser::setLedHomeOn |
( |
| ) |
|
|
inline |
◆ setLedHomeToggle()
void SwitchProParser::setLedHomeToggle |
( |
| ) |
|
|
inline |
◆ getMessageCounter()
uint16_t SwitchProParser::getMessageCounter |
( |
| ) |
|
|
inline |
◆ getBatteryLevel()
uint8_t SwitchProParser::getBatteryLevel |
( |
| ) |
|
|
inline |
Return the battery level of the Switch Pro Controller.
- Returns
- The battery level as a bit mask according to ::SwitchProBatteryLevel: 4=full, 3=medium, 2=low, 1=critical, 0=empty.
Definition at line 331 of file SwitchProParser.h.
◆ isCharging()
bool SwitchProParser::isCharging |
( |
| ) |
|
|
inline |
Returns whenever the controller is plugged in and charging.
- Returns
- Returns True if the controller is charging.
Definition at line 339 of file SwitchProParser.h.
◆ Parse()
void SwitchProParser::Parse |
( |
uint8_t |
len, |
|
|
uint8_t * |
buf |
|
) |
| |
|
protected |
Used to parse data sent from the Switch Pro controller.
- Parameters
-
len | Length of the data. |
buf | Pointer to the data buffer. |
Definition at line 55 of file SwitchProParser.cpp.
◆ Reset()
void SwitchProParser::Reset |
( |
| ) |
|
|
protected |
Used to reset the different buffers to their default values
Definition at line 231 of file SwitchProParser.cpp.
◆ sendOutputReport()
virtual void SwitchProParser::sendOutputReport |
( |
uint8_t * |
data, |
|
|
uint8_t |
len |
|
) |
| |
|
protectedpure virtual |
◆ sendHandshake()
virtual void SwitchProParser::sendHandshake |
( |
| ) |
|
|
inlineprotectedvirtual |
◆ disableTimeout()
virtual void SwitchProParser::disableTimeout |
( |
| ) |
|
|
inlineprotectedvirtual |
Needed to disable USB timeout for the controller, so it sends out data without the host having to send data continuously.
Reimplemented in SwitchProUSB.
Definition at line 368 of file SwitchProParser.h.
◆ switchProOutput
Allow derived classes to access the output variables.
Definition at line 371 of file SwitchProParser.h.
The documentation for this class was generated from the following files: