-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ HID++: Implement DPI range parsing for the non-extended DPI feature…
…. (2201) The documentation for the format is actually present in the documentation for feature 2202 (Extended Adjustable DPI), which I guess is used for more complex mouses. (It would be necessary to implement X-Y DPI, which is not supported by the basic feature)
- Loading branch information
Showing
6 changed files
with
150 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
using System.Diagnostics; | ||
|
||
namespace DeviceTools.Logitech.HidPlusPlus; | ||
|
||
[DebuggerDisplay("{Minimum,d} - {Maximum,d} ({Step,d})")] | ||
public readonly struct DpiRange : IEquatable<DpiRange> | ||
{ | ||
public readonly ushort Minimum; | ||
public readonly ushort Maximum; | ||
public readonly ushort Step; | ||
|
||
public DpiRange(ushort value) : this(value, value, 0) { } | ||
|
||
public DpiRange(ushort minimum, ushort maximum) : this(minimum, maximum, 1) { } | ||
|
||
public DpiRange(ushort minimum, ushort maximum, ushort step) | ||
=> (Minimum, Maximum, Step) = (minimum, maximum, step); | ||
|
||
public override bool Equals(object? obj) => obj is DpiRange range && Equals(range); | ||
public bool Equals(DpiRange other) => Minimum == other.Minimum && Maximum == other.Maximum && Step == other.Step; | ||
public override int GetHashCode() => HashCode.Combine(Minimum, Maximum, Step); | ||
|
||
public static bool operator ==(DpiRange left, DpiRange right) => left.Equals(right); | ||
public static bool operator !=(DpiRange left, DpiRange right) => !(left == right); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters