Skip to content

Commit

Permalink
Define a constant for the Consumer keycode 10-bit mask
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Richters <gedankenexperimenter@gmail.com>
  • Loading branch information
gedankenexperimenter committed Sep 14, 2020
1 parent 675b232 commit 4b590e0
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/kaleidoscope/key_defs.h
Expand Up @@ -268,9 +268,11 @@ typedef kaleidoscope::Key Key_;
use the 10 lsb as the HID Consumer code. If you need to get the keycode of a Consumer key
use the CONSUMER(key) macro this will return the 10bit keycode.
*/
#define CONSUMER(key) (key.getRaw() & 0x03FF)
constexpr uint16_t CONSUMER_KEYCODE_MASK = 0x03FF;
#define CONSUMER(key) (key.getRaw() & CONSUMER_KEYCODE_MASK)
#define CONSUMER_KEY(code, hid_type) \
Key((code & 0x03FF) | ((SYNTHETIC | IS_CONSUMER | (hid_type & HID_TYPE_MASK)) << 8))
Key((code & CONSUMER_KEYCODE_MASK) | \
((SYNTHETIC | IS_CONSUMER | (hid_type & HID_TYPE_MASK)) << 8))

namespace kaleidoscope {
constexpr Key bad_keymap_key{0, RESERVED};
Expand Down

0 comments on commit 4b590e0

Please sign in to comment.