Skip to content
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

Merged
merged 7 commits into from Nov 26, 2017

Conversation

SjB
Copy link
Contributor

@SjB SjB commented Nov 8, 2017

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

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
@obra
Copy link
Member

obra commented Nov 13, 2017

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
@obra
Copy link
Member

obra commented Nov 16, 2017

(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.
Copy link
Contributor

@algernon algernon left a 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!

@algernon algernon mentioned this pull request Nov 24, 2017
@obra obra merged commit 8c250fe into keyboardio:master Nov 26, 2017
@obra
Copy link
Member

obra commented Nov 26, 2017

Thanks! Applied.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants