add interface

This commit is contained in:
2021-01-24 15:13:05 +09:00
parent 852a0a7be4
commit 4f2486cddc
2 changed files with 16 additions and 0 deletions

View File

@@ -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;

View File

@@ -61,6 +61,9 @@ class SwitchControlLibrary_
public:
SwitchControlLibrary_();
void PressButton(Button b);
void ReleaseButton(Button b);
void PressButtonY();
void ReleaseButtonY();
void PressButtonB();