diff --git a/ArduinoKeyboard.ino b/ArduinoKeyboard.ino index 7afdaa62..fd32b177 100644 --- a/ArduinoKeyboard.ino +++ b/ArduinoKeyboard.ino @@ -405,6 +405,14 @@ void handle_synthetic_key_press(byte switchState, Key mappedKey) { Keyboard.consumerControl(mappedKey.rawKey); } } + + else if (mappedKey.flags & IS_INTERNAL) { + if (key_toggled_on (switchState)) { + if (mappedKey.rawKey == LED_TOGGLE) { + next_led_mode(); + } + } + } else if (mappedKey.flags & IS_SYSCTL) { if (key_toggled_on (switchState)) { Keyboard.systemControl(mappedKey.rawKey); diff --git a/key_defs.h b/key_defs.h index bede3f26..fc4aa6d1 100644 --- a/key_defs.h +++ b/key_defs.h @@ -19,6 +19,12 @@ typedef struct { #define IS_MACRO B00000001 #define IS_SYSCTL B00000010 #define IS_CONSUMER B00000100 +#define IS_INTERNAL B00001000 + + +// IS_INTERNAL key table: + +#define LED_TOGGLE 1 #define MOUSE_UP B0000001 @@ -427,3 +433,7 @@ typedef struct { + +#define Key_LEDEffectNext (Key) { KEY_FLAGS | SYNTHETIC_KEY | IS_INTERNAL, LED_TOGGLE } + +