diff --git a/src/kaleidoscope/hid.cpp b/src/kaleidoscope/hid.cpp index e8b4e188..366e90ef 100644 --- a/src/kaleidoscope/hid.cpp +++ b/src/kaleidoscope/hid.cpp @@ -106,11 +106,11 @@ void initializeConsumerControl() { } void pressConsumerControl(Key mappedKey) { - ConsumerControl.press(mappedKey.raw & 0x03FF); + ConsumerControl.press(CONSUMER(mappedKey)); } void releaseConsumerControl(Key mappedKey) { - ConsumerControl.release(mappedKey.raw & 0x03FF); + ConsumerControl.release(CONSUMER(mappedKey)); } diff --git a/src/key_defs.h b/src/key_defs.h index 299f427d..82e91e64 100644 --- a/src/key_defs.h +++ b/src/key_defs.h @@ -123,4 +123,10 @@ typedef union Key_ { #define Key_LFN2 (Key) { KEY_LEFT_FN2, KEY_FLAGS } +/* Most Consumer keys are more then 8bit, the highest Consumer hid code + uses 10bit. By using the 11bit as flag to indicate a consumer keys was activate we can + 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.raw & 0x03FF) #define CONSUMER_KEY(code, flags) (Key) { .raw = (code) | ((flags | SYNTHETIC|IS_CONSUMER) << 8) }