diff options
| author | 2023-01-29 02:43:14 -0800 | |
|---|---|---|
| committer | 2023-01-29 02:43:14 -0800 | |
| commit | 9170387e71d4295477b74666a843a889af62b2a3 (patch) | |
| tree | ee08cde9257dc4c77943b7566ee678ed8317eec2 /src/input_common/helpers/joycon_protocol/calibration.h | |
| parent | Merge pull request #9691 from ameerj/msaa-texcache (diff) | |
| parent | input_common: joycon: Replace ReadSPI vector with span (diff) | |
| download | yuzu-9170387e71d4295477b74666a843a889af62b2a3.tar.gz yuzu-9170387e71d4295477b74666a843a889af62b2a3.tar.xz yuzu-9170387e71d4295477b74666a843a889af62b2a3.zip | |
Merge pull request #9689 from german77/joycon-calibration
input_common: joycon: Remove magic numbers from calibration protocol
Diffstat (limited to 'src/input_common/helpers/joycon_protocol/calibration.h')
| -rw-r--r-- | src/input_common/helpers/joycon_protocol/calibration.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/input_common/helpers/joycon_protocol/calibration.h b/src/input_common/helpers/joycon_protocol/calibration.h index afb52a36a..c6fd0f729 100644 --- a/src/input_common/helpers/joycon_protocol/calibration.h +++ b/src/input_common/helpers/joycon_protocol/calibration.h | |||
| @@ -53,9 +53,27 @@ public: | |||
| 53 | DriverResult GetRingCalibration(RingCalibration& calibration, s16 current_value); | 53 | DriverResult GetRingCalibration(RingCalibration& calibration, s16 current_value); |
| 54 | 54 | ||
| 55 | private: | 55 | private: |
| 56 | /// Returns true if the specified address corresponds to the magic value of user calibration | ||
| 57 | DriverResult HasUserCalibration(SpiAddress address, bool& has_user_calibration); | ||
| 58 | |||
| 59 | /// Converts a raw calibration block to an u16 value containing the x axis value | ||
| 60 | u16 GetXAxisCalibrationValue(std::span<u8> block) const; | ||
| 61 | |||
| 62 | /// Converts a raw calibration block to an u16 value containing the y axis value | ||
| 63 | u16 GetYAxisCalibrationValue(std::span<u8> block) const; | ||
| 64 | |||
| 65 | /// Ensures that all joystick calibration values are set | ||
| 56 | void ValidateCalibration(JoyStickCalibration& calibration); | 66 | void ValidateCalibration(JoyStickCalibration& calibration); |
| 67 | |||
| 68 | /// Ensures that all motion calibration values are set | ||
| 57 | void ValidateCalibration(MotionCalibration& calibration); | 69 | void ValidateCalibration(MotionCalibration& calibration); |
| 58 | 70 | ||
| 71 | /// Returns the default value if the value is either zero or 0xFFF | ||
| 72 | u16 ValidateValue(u16 value, u16 default_value) const; | ||
| 73 | |||
| 74 | /// Returns the default value if the value is either zero or 0xFFF | ||
| 75 | s16 ValidateValue(s16 value, s16 default_value) const; | ||
| 76 | |||
| 59 | s16 ring_data_max = 0; | 77 | s16 ring_data_max = 0; |
| 60 | s16 ring_data_default = 0; | 78 | s16 ring_data_default = 0; |
| 61 | s16 ring_data_min = 0; | 79 | s16 ring_data_min = 0; |