Skip to content

Commit

Permalink
Support all 10bit HID Consumer code.
Browse files Browse the repository at this point in the history
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
  • Loading branch information
SjB committed Nov 8, 2017
1 parent 3f1c803 commit f57aab5
Show file tree
Hide file tree
Showing 3 changed files with 252 additions and 252 deletions.
4 changes: 2 additions & 2 deletions src/kaleidoscope/hid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,11 @@ void initializeConsumerControl() {
}

void pressConsumerControl(Key mappedKey) {
ConsumerControl.press(mappedKey.keyCode);
ConsumerControl.press(mappedKey.raw & 0x03FF);
}

void releaseConsumerControl(Key mappedKey) {
ConsumerControl.release(mappedKey.keyCode);
ConsumerControl.release(mappedKey.raw & 0x03FF);
}


Expand Down
4 changes: 2 additions & 2 deletions src/key_defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,9 @@ typedef union Key_ {

// we assert that synthetic keys can never have keys held, so we reuse the _HELD bits
#define IS_SYSCTL B00000001
#define IS_CONSUMER B00000010
#define IS_INTERNAL B00000010
#define SWITCH_TO_KEYMAP B00000100
#define IS_INTERNAL B00001000
#define IS_CONSUMER B00001000

This comment has been minimized.

Copy link
@gedankenexperimenter

gedankenexperimenter Dec 22, 2017

Collaborator

Is this really compatible with the various HID_TYPE_* values below? The B00001000 bit overlaps the bits used in those values. For example, HID_TYPE_LC | IS_CONSUMER has the same value as HID_TYPE_OOC | IS_CONSUMER. If the different Consumer HID types don't need to be distinguished, why bother with them? If they do, then there's another bit that could be used for IS_CONSUMER that doesn't conflict: B00100000.

This comment has been minimized.

Copy link
@gedankenexperimenter

gedankenexperimenter Dec 22, 2017

Collaborator

[sorry for the multiple comments; difficult to use this UI on a phone]

This comment has been minimized.

Copy link
@gedankenexperimenter

gedankenexperimenter Dec 22, 2017

Collaborator

It looks like the HID_TYPE_* numbers aren't used anywhere (I haven't found any, at any rate).

/* HID types we need to encode in the key flags for system and consumer control hid controls
Each key can only have one, so we don't need to use a bit vector.
Expand Down

0 comments on commit f57aab5

Please sign in to comment.