Can someone explain this to me:
constexpr Key Key_LEDEffectNext = Key(0, KEY_FLAGS | SYNTHETIC | IS_INTERNAL | LED_TOGGLE);
More specifically what significance the ‘0
’ has.
What ‘SYNTHETIC
’ and ‘IS_INTERNAL
’ precisely means in relation the Kaleidoscope.
I am asking because I want to define my own ‘abstract’ key like the led one. But I am wondering whether there is a ‘correct’ and a ‘wrong’ way to do this. My first inclination is to just make something like this constexpr Key Key_MyCustomKey1 = Key(0xF0, KEY_FLAGS);
where the ‘0xF0
’ is in a reserved HID value range.
But it seems a bit ‘off’ for some reason to do it this way. I’d much rather do it the ‘Kaleidoscopic’ way.
Oh, and I also need to account for modifiers. Are those in the KEY_FLAGS part or can I still do Kaleidoscope.hid().keyboard().isModifierKeyActive(Key_LeftShift)
and get a reliable result? I am asking because of this part from key_defs.h
:
#define KEY_FLAGS 0b00000000
#define CTRL_HELD 0b00000001
#define LALT_HELD 0b00000010
#define RALT_HELD 0b00000100
#define SHIFT_HELD 0b00001000
#define GUI_HELD 0b00010000
#define SYNTHETIC 0b01000000
#define RESERVED 0b10000000
// we assert that synthetic keys can never have keys held, so we reuse the _HELD bits
#define IS_SYSCTL 0b00000001
#define IS_INTERNAL 0b00000010
#define SWITCH_TO_KEYMAP 0b00000100
#define IS_CONSUMER 0b00001000
The line about synthetic keys can never have keys held, I don’t understand. Does this mean that if I press the Led button with shift held, it is impossible to check if shift is in fact held?