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
Support all 10bit HID Consumer code. #242
Conversation
By moving the IS_CONSUMER flag to B00001000 instead of B00000010 (swap with IS_INTERNAL) we can detect the if the key is a consumer key and strip out the flags and use the full 10bit to send to the hid report. This enable us to use all the Consumer_* keys
Thanks for the PR! I'm a little bit uncomfortable with the bit shifts and magic constants. Do you have ideas about refactorings that could move them to macros? |
* master: Back out part of 374a3e1 because it breaks our ability to pass -D defines into code Update key_events.cpp (IS_INTERNAL Handling)
created a Key_16Bit to convert the HID 16bit hex code into the Key struct used by Kaleidoscope
(I'm happy to do some of the tweaking.) What would you think about the macro being something more like CONSUMER_KEY() and automatically adding in IS_CONSUMER and SYNTHETIC? I think that'd probably be a bit easier to read and understand. At the same time, is it safe to wrap all consumer key definitions? If so, then we can make the macro naming simpler and more obvious. I'd also probably change the 'mappedKey.raw & 0x03FF' to use a macro rather than a magic constant. A couple lines of comments about the why of the macro would also not be wrong to help folks trying to understand this code in the future. Thanks! |
replacing the Key_16bit macro with CONSUMER_KEY macro allowed us to add the IS_CONSUMER and SYNTHETIC flags within the CONSUMER_KEY macro and simplify the Consumer key definitions.
The CONSUMER(key) macro will extra the consumer keycode from the Key. this will return a 16bit keycode as some consumer key are 10bit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With the most recent changes, the PR looks good to me. Found it easy to follow, too. Good work!
Thanks! Applied. |
By moving the IS_CONSUMER flag to B00001000 instead of
B00000010 (swap with IS_INTERNAL) we can detect if the key is a
consumer key and strip out the flags and use the full 10bit to send to
the hid report. This enable us to use all the Consumer_* keys