diff --git a/src/SwitchControlLibrary.cpp b/src/SwitchControlLibrary.cpp index a705634..f8a53b5 100755 --- a/src/SwitchControlLibrary.cpp +++ b/src/SwitchControlLibrary.cpp @@ -64,6 +64,19 @@ void SwitchControlLibrary_::SendReport() CustomHID().SendReport(&_joystickInputData, sizeof(USB_JoystickReport_Input_t)); } +void SwitchControlLibrary_::PressButton(Button b) +{ + _joystickInputData.Button |= (uint16_t)b; + SendReport(); +} + +void SwitchControlLibrary_::ReleaseButton(Button b) +{ + _joystickInputData.Button &= ((uint16_t)b ^ 0xffff); + SendReport(); +} + + void SwitchControlLibrary_::PressButtonY() { _joystickInputData.Button |= (uint16_t)Button::Y; diff --git a/src/SwitchControlLibrary.h b/src/SwitchControlLibrary.h index 68b98b7..9f8bc22 100755 --- a/src/SwitchControlLibrary.h +++ b/src/SwitchControlLibrary.h @@ -61,6 +61,9 @@ class SwitchControlLibrary_ public: SwitchControlLibrary_(); + void PressButton(Button b); + void ReleaseButton(Button b); + void PressButtonY(); void ReleaseButtonY(); void PressButtonB();