-
Notifications
You must be signed in to change notification settings - Fork 31
feat(hid-rp): add 3Dconnexion SpaceMouse HID report descriptor #790
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
892511b
feat(hid-rp): add 3Dconnexion SpaceMouse HID report descriptor
finger563 e87a465
fix(hid-rp): address PR review feedback on 3Dconnexion SpaceMouse report
finger563 621ba67
fix(hid-rp): address second Copilot review round on 3Dconnexion Space…
finger563 83fd24f
test(hid-rp): assert the SpaceMouse descriptor's hardware-quirk flag …
finger563 1bc493e
fix(hid-rp): address 3Dconnexion SpaceMouse PR review feedback
finger563 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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
58 changes: 58 additions & 0 deletions
58
components/hid-rp/include/hid-rp-3dconnexion-formatters.hpp
This file contains hidden or 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,58 @@ | ||
| #pragma once | ||
|
|
||
| #include <bitset> | ||
| #include <cstddef> | ||
| #include <cstdint> | ||
|
|
||
| #include "format.hpp" | ||
| #include "hid-rp-3dconnexion.hpp" | ||
|
|
||
| template <std::int16_t LOGICAL_MIN, std::int16_t LOGICAL_MAX, uint8_t REPORT_ID> | ||
| struct fmt::formatter<espp::SpaceMouseTranslationInputReport<LOGICAL_MIN, LOGICAL_MAX, REPORT_ID>> { | ||
| template <typename ParseContext> constexpr auto parse(ParseContext &ctx) const { | ||
| return ctx.begin(); | ||
| } | ||
|
|
||
| template <typename FormatContext> | ||
| auto | ||
| format(const espp::SpaceMouseTranslationInputReport<LOGICAL_MIN, LOGICAL_MAX, REPORT_ID> &report, | ||
| FormatContext &ctx) const { | ||
| return fmt::format_to(ctx.out(), "SpaceMouseTranslationInputReport {{x: {}, y: {}, z: {}}}", | ||
| report.axes[0], report.axes[1], report.axes[2]); | ||
| } | ||
| }; | ||
|
|
||
| template <std::int16_t LOGICAL_MIN, std::int16_t LOGICAL_MAX, uint8_t REPORT_ID> | ||
| struct fmt::formatter<espp::SpaceMouseRotationInputReport<LOGICAL_MIN, LOGICAL_MAX, REPORT_ID>> { | ||
| template <typename ParseContext> constexpr auto parse(ParseContext &ctx) const { | ||
| return ctx.begin(); | ||
| } | ||
|
|
||
| template <typename FormatContext> | ||
| auto | ||
| format(const espp::SpaceMouseRotationInputReport<LOGICAL_MIN, LOGICAL_MAX, REPORT_ID> &report, | ||
| FormatContext &ctx) const { | ||
| return fmt::format_to(ctx.out(), "SpaceMouseRotationInputReport {{rx: {}, ry: {}, rz: {}}}", | ||
| report.axes[0], report.axes[1], report.axes[2]); | ||
| } | ||
| }; | ||
|
|
||
| template <std::size_t BUTTON_COUNT, uint8_t REPORT_ID> | ||
| struct fmt::formatter<espp::SpaceMouseButtonsInputReport<BUTTON_COUNT, REPORT_ID>> { | ||
| template <typename ParseContext> constexpr auto parse(ParseContext &ctx) const { | ||
| return ctx.begin(); | ||
| } | ||
|
|
||
| template <typename FormatContext> | ||
| auto format(const espp::SpaceMouseButtonsInputReport<BUTTON_COUNT, REPORT_ID> &report, | ||
| FormatContext &ctx) const { | ||
| auto out = ctx.out(); | ||
| out = fmt::format_to(out, "SpaceMouseButtonsInputReport<{}> {{buttons: [", BUTTON_COUNT); | ||
| std::bitset<BUTTON_COUNT> buttons; | ||
| for (size_t i = 1; i <= BUTTON_COUNT; i++) { | ||
| buttons.set(i - 1, report.buttons.test(hid::page::button(i))); | ||
| } | ||
| out = fmt::format_to(out, "{}", buttons); | ||
| return fmt::format_to(out, "]}}"); | ||
| } | ||
| }; | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.