summaryrefslogtreecommitdiffstats
path: root/src/input_common/helpers/joycon_protocol/ringcon.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/input_common/helpers/joycon_protocol/ringcon.h38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/input_common/helpers/joycon_protocol/ringcon.h b/src/input_common/helpers/joycon_protocol/ringcon.h
new file mode 100644
index 000000000..6e858f3fc
--- /dev/null
+++ b/src/input_common/helpers/joycon_protocol/ringcon.h
@@ -0,0 +1,38 @@
+// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+// Based on dkms-hid-nintendo implementation, CTCaer joycon toolkit and dekuNukem reverse
+// engineering https://github.com/nicman23/dkms-hid-nintendo/blob/master/src/hid-nintendo.c
+// https://github.com/CTCaer/jc_toolkit
+// https://github.com/dekuNukem/Nintendo_Switch_Reverse_Engineering
+
+#pragma once
+
+#include <vector>
+
+#include "input_common/helpers/joycon_protocol/common_protocol.h"
+#include "input_common/helpers/joycon_protocol/joycon_types.h"
+
+namespace InputCommon::Joycon {
+
+class RingConProtocol final : private JoyconCommonProtocol {
+public:
+ explicit RingConProtocol(std::shared_ptr<JoyconHandle> handle);
+
+ DriverResult EnableRingCon();
+
+ DriverResult DisableRingCon();
+
+ DriverResult StartRingconPolling();
+
+ bool IsEnabled() const;
+
+private:
+ DriverResult IsRingConnected(bool& is_connected);
+
+ DriverResult ConfigureRing();
+
+ bool is_enabled{};
+};
+
+} // namespace InputCommon::Joycon