diff options
| author | 2023-01-13 23:29:05 -0600 | |
|---|---|---|
| committer | 2023-01-20 00:51:45 -0600 | |
| commit | 340f15d1fa79594dbe12a6e19140ba012751b533 (patch) | |
| tree | 7a9ef54a17f927e4b8cf98dd32dd6d41c0d75201 /src/input_common/helpers/joycon_protocol/common_protocol.h | |
| parent | core: hid: Only set the polling mode to the correct side (diff) | |
| download | yuzu-340f15d1fa79594dbe12a6e19140ba012751b533.tar.gz yuzu-340f15d1fa79594dbe12a6e19140ba012751b533.tar.xz yuzu-340f15d1fa79594dbe12a6e19140ba012751b533.zip | |
input_common: Address byte review
Diffstat (limited to 'src/input_common/helpers/joycon_protocol/common_protocol.h')
| -rw-r--r-- | src/input_common/helpers/joycon_protocol/common_protocol.h | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/src/input_common/helpers/joycon_protocol/common_protocol.h b/src/input_common/helpers/joycon_protocol/common_protocol.h index 2a3feaf59..903bcf402 100644 --- a/src/input_common/helpers/joycon_protocol/common_protocol.h +++ b/src/input_common/helpers/joycon_protocol/common_protocol.h | |||
| @@ -75,11 +75,18 @@ public: | |||
| 75 | DriverResult SendSubCommand(SubCommand sc, std::span<const u8> buffer, std::vector<u8>& output); | 75 | DriverResult SendSubCommand(SubCommand sc, std::span<const u8> buffer, std::vector<u8>& output); |
| 76 | 76 | ||
| 77 | /** | 77 | /** |
| 78 | * Sends a sub command to the device and waits for it's reply and ignores the output | ||
| 79 | * @param sc sub command to be send | ||
| 80 | * @param buffer data to be send | ||
| 81 | */ | ||
| 82 | DriverResult SendSubCommand(SubCommand sc, std::span<const u8> buffer); | ||
| 83 | |||
| 84 | /** | ||
| 78 | * Sends a mcu command to the device | 85 | * Sends a mcu command to the device |
| 79 | * @param sc sub command to be send | 86 | * @param sc sub command to be send |
| 80 | * @param buffer data to be send | 87 | * @param buffer data to be send |
| 81 | */ | 88 | */ |
| 82 | DriverResult SendMcuCommand(SubCommand sc, std::span<const u8> buffer); | 89 | DriverResult SendMCUCommand(SubCommand sc, std::span<const u8> buffer); |
| 83 | 90 | ||
| 84 | /** | 91 | /** |
| 85 | * Sends vibration data to the joycon | 92 | * Sends vibration data to the joycon |
| @@ -150,4 +157,17 @@ private: | |||
| 150 | std::shared_ptr<JoyconHandle> hidapi_handle; | 157 | std::shared_ptr<JoyconHandle> hidapi_handle; |
| 151 | }; | 158 | }; |
| 152 | 159 | ||
| 160 | class ScopedSetBlocking { | ||
| 161 | public: | ||
| 162 | explicit ScopedSetBlocking(JoyconCommonProtocol* self) : m_self{self} { | ||
| 163 | m_self->SetBlocking(); | ||
| 164 | } | ||
| 165 | |||
| 166 | ~ScopedSetBlocking() { | ||
| 167 | m_self->SetNonBlocking(); | ||
| 168 | } | ||
| 169 | |||
| 170 | private: | ||
| 171 | JoyconCommonProtocol* m_self{}; | ||
| 172 | }; | ||
| 153 | } // namespace InputCommon::Joycon | 173 | } // namespace InputCommon::Joycon |