diff options
Diffstat (limited to 'src/input_common/helpers/joycon_protocol/generic_functions.h')
| -rw-r--r-- | src/input_common/helpers/joycon_protocol/generic_functions.h | 41 |
1 files changed, 23 insertions, 18 deletions
diff --git a/src/input_common/helpers/joycon_protocol/generic_functions.h b/src/input_common/helpers/joycon_protocol/generic_functions.h index 424831e81..90fcd17f6 100644 --- a/src/input_common/helpers/joycon_protocol/generic_functions.h +++ b/src/input_common/helpers/joycon_protocol/generic_functions.h | |||
| @@ -11,6 +11,10 @@ | |||
| 11 | #include "input_common/helpers/joycon_protocol/common_protocol.h" | 11 | #include "input_common/helpers/joycon_protocol/common_protocol.h" |
| 12 | #include "input_common/helpers/joycon_protocol/joycon_types.h" | 12 | #include "input_common/helpers/joycon_protocol/joycon_types.h" |
| 13 | 13 | ||
| 14 | namespace Common::Input { | ||
| 15 | enum class DriverResult; | ||
| 16 | } | ||
| 17 | |||
| 14 | namespace InputCommon::Joycon { | 18 | namespace InputCommon::Joycon { |
| 15 | 19 | ||
| 16 | /// Joycon driver functions that easily implemented | 20 | /// Joycon driver functions that easily implemented |
| @@ -20,34 +24,34 @@ public: | |||
| 20 | 24 | ||
| 21 | /// Enables passive mode. This mode only sends button data on change. Sticks will return digital | 25 | /// Enables passive mode. This mode only sends button data on change. Sticks will return digital |
| 22 | /// data instead of analog. Motion will be disabled | 26 | /// data instead of analog. Motion will be disabled |
| 23 | DriverResult EnablePassiveMode(); | 27 | Common::Input::DriverResult EnablePassiveMode(); |
| 24 | 28 | ||
| 25 | /// Enables active mode. This mode will return the current status every 5-15ms | 29 | /// Enables active mode. This mode will return the current status every 5-15ms |
| 26 | DriverResult EnableActiveMode(); | 30 | Common::Input::DriverResult EnableActiveMode(); |
| 27 | 31 | ||
| 28 | /// Enables or disables the low power mode | 32 | /// Enables or disables the low power mode |
| 29 | DriverResult SetLowPowerMode(bool enable); | 33 | Common::Input::DriverResult SetLowPowerMode(bool enable); |
| 30 | 34 | ||
| 31 | /// Unknown function used by the switch | 35 | /// Unknown function used by the switch |
| 32 | DriverResult TriggersElapsed(); | 36 | Common::Input::DriverResult TriggersElapsed(); |
| 33 | 37 | ||
| 34 | /** | 38 | /** |
| 35 | * Sends a request to obtain the joycon firmware and mac from handle | 39 | * Sends a request to obtain the joycon firmware and mac from handle |
| 36 | * @returns controller device info | 40 | * @returns controller device info |
| 37 | */ | 41 | */ |
| 38 | DriverResult GetDeviceInfo(DeviceInfo& controller_type); | 42 | Common::Input::DriverResult GetDeviceInfo(DeviceInfo& controller_type); |
| 39 | 43 | ||
| 40 | /** | 44 | /** |
| 41 | * Sends a request to obtain the joycon type from handle | 45 | * Sends a request to obtain the joycon type from handle |
| 42 | * @returns controller type of the joycon | 46 | * @returns controller type of the joycon |
| 43 | */ | 47 | */ |
| 44 | DriverResult GetControllerType(ControllerType& controller_type); | 48 | Common::Input::DriverResult GetControllerType(ControllerType& controller_type); |
| 45 | 49 | ||
| 46 | /** | 50 | /** |
| 47 | * Enables motion input | 51 | * Enables motion input |
| 48 | * @param enable if true motion data will be enabled | 52 | * @param enable if true motion data will be enabled |
| 49 | */ | 53 | */ |
| 50 | DriverResult EnableImu(bool enable); | 54 | Common::Input::DriverResult EnableImu(bool enable); |
| 51 | 55 | ||
| 52 | /** | 56 | /** |
| 53 | * Configures the motion sensor with the specified parameters | 57 | * Configures the motion sensor with the specified parameters |
| @@ -56,59 +60,60 @@ public: | |||
| 56 | * @param asen accelerometer sensitivity in G force | 60 | * @param asen accelerometer sensitivity in G force |
| 57 | * @param afrec accelerometer frequency in hertz | 61 | * @param afrec accelerometer frequency in hertz |
| 58 | */ | 62 | */ |
| 59 | DriverResult SetImuConfig(GyroSensitivity gsen, GyroPerformance gfrec, | 63 | Common::Input::DriverResult SetImuConfig(GyroSensitivity gsen, GyroPerformance gfrec, |
| 60 | AccelerometerSensitivity asen, AccelerometerPerformance afrec); | 64 | AccelerometerSensitivity asen, |
| 65 | AccelerometerPerformance afrec); | ||
| 61 | 66 | ||
| 62 | /** | 67 | /** |
| 63 | * Request battery level from the device | 68 | * Request battery level from the device |
| 64 | * @returns battery level | 69 | * @returns battery level |
| 65 | */ | 70 | */ |
| 66 | DriverResult GetBattery(u32& battery_level); | 71 | Common::Input::DriverResult GetBattery(u32& battery_level); |
| 67 | 72 | ||
| 68 | /** | 73 | /** |
| 69 | * Request joycon colors from the device | 74 | * Request joycon colors from the device |
| 70 | * @returns colors of the body and buttons | 75 | * @returns colors of the body and buttons |
| 71 | */ | 76 | */ |
| 72 | DriverResult GetColor(Color& color); | 77 | Common::Input::DriverResult GetColor(Color& color); |
| 73 | 78 | ||
| 74 | /** | 79 | /** |
| 75 | * Request joycon serial number from the device | 80 | * Request joycon serial number from the device |
| 76 | * @returns 16 byte serial number | 81 | * @returns 16 byte serial number |
| 77 | */ | 82 | */ |
| 78 | DriverResult GetSerialNumber(SerialNumber& serial_number); | 83 | Common::Input::DriverResult GetSerialNumber(SerialNumber& serial_number); |
| 79 | 84 | ||
| 80 | /** | 85 | /** |
| 81 | * Request joycon serial number from the device | 86 | * Request joycon serial number from the device |
| 82 | * @returns 16 byte serial number | 87 | * @returns 16 byte serial number |
| 83 | */ | 88 | */ |
| 84 | DriverResult GetTemperature(u32& temperature); | 89 | Common::Input::DriverResult GetTemperature(u32& temperature); |
| 85 | 90 | ||
| 86 | /** | 91 | /** |
| 87 | * Request joycon serial number from the device | 92 | * Request joycon serial number from the device |
| 88 | * @returns 16 byte serial number | 93 | * @returns 16 byte serial number |
| 89 | */ | 94 | */ |
| 90 | DriverResult GetVersionNumber(FirmwareVersion& version); | 95 | Common::Input::DriverResult GetVersionNumber(FirmwareVersion& version); |
| 91 | 96 | ||
| 92 | /** | 97 | /** |
| 93 | * Sets home led behaviour | 98 | * Sets home led behaviour |
| 94 | */ | 99 | */ |
| 95 | DriverResult SetHomeLight(); | 100 | Common::Input::DriverResult SetHomeLight(); |
| 96 | 101 | ||
| 97 | /** | 102 | /** |
| 98 | * Sets home led into a slow breathing state | 103 | * Sets home led into a slow breathing state |
| 99 | */ | 104 | */ |
| 100 | DriverResult SetLedBusy(); | 105 | Common::Input::DriverResult SetLedBusy(); |
| 101 | 106 | ||
| 102 | /** | 107 | /** |
| 103 | * Sets the 4 player leds on the joycon on a solid state | 108 | * Sets the 4 player leds on the joycon on a solid state |
| 104 | * @params bit flag containing the led state | 109 | * @params bit flag containing the led state |
| 105 | */ | 110 | */ |
| 106 | DriverResult SetLedPattern(u8 leds); | 111 | Common::Input::DriverResult SetLedPattern(u8 leds); |
| 107 | 112 | ||
| 108 | /** | 113 | /** |
| 109 | * Sets the 4 player leds on the joycon on a blinking state | 114 | * Sets the 4 player leds on the joycon on a blinking state |
| 110 | * @returns bit flag containing the led state | 115 | * @returns bit flag containing the led state |
| 111 | */ | 116 | */ |
| 112 | DriverResult SetLedBlinkPattern(u8 leds); | 117 | Common::Input::DriverResult SetLedBlinkPattern(u8 leds); |
| 113 | }; | 118 | }; |
| 114 | } // namespace InputCommon::Joycon | 119 | } // namespace InputCommon::Joycon |