input_common: joycon: Move vibrations to a queue

This commit is contained in:
german77
2023-10-22 10:14:08 -06:00
parent db37e583ff
commit e4dfd51337
2 changed files with 19 additions and 2 deletions

View File

@ -9,6 +9,7 @@
#include <span>
#include <thread>
#include "common/threadsafe_queue.h"
#include "input_common/helpers/joycon_protocol/joycon_types.h"
namespace Common::Input {
@ -152,6 +153,10 @@ private:
SerialNumber handle_serial_number{}; // Serial number type reported by hidapi
SupportedFeatures supported_features{};
/// Queue of vibration request to controllers
Common::Input::DriverResult last_vibration_result{Common::Input::DriverResult::Success};
Common::SPSCQueue<VibrationValue> vibration_queue;
// Thread related
mutable std::mutex mutex;
std::jthread input_thread;