]> git.friedersdorff.com Git - max/tmk_keyboard.git/blobdiff - tmk_core/common/keycode.h
core: Add HID usage for Display Brightness Control
[max/tmk_keyboard.git] / tmk_core / common / keycode.h
index 51c919509ddd287c2efeaa0184373e9d250b49b4..534f52d54f8f92528463bcaabfb8c74c95101713 100644 (file)
@@ -1,5 +1,5 @@
 /*
-Copyright 2011,2012 Jun Wako <wakojun@gmail.com>
+Copyright 2011,2012,2020 Jun Wako <wakojun@gmail.com>
 
 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
@@ -25,13 +25,20 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 #define IS_ERROR(code)           (KC_ROLL_OVER <= (code) && (code) <= KC_UNDEFINED)
 #define IS_ANY(code)             (KC_A         <= (code) && (code) <= 0xFF)
+
+#ifndef ACTIONMAP_ENABLE
 #define IS_KEY(code)             (KC_A         <= (code) && (code) <= KC_EXSEL)
+#else
+#define IS_KEY(code)             ((KC_A         <= (code) && (code) <= KC_EXSEL) || \
+                                  (KC_KP_00     <= (code) && (code) <= KC_KP_HEXADECIMAL))
+#endif
+
 #define IS_MOD(code)             (KC_LCTRL     <= (code) && (code) <= KC_RGUI)
 
 
 #define IS_SPECIAL(code)         ((0xA5 <= (code) && (code) <= 0xDF) || (0xE8 <= (code) && (code) <= 0xFF))
 #define IS_SYSTEM(code)          (KC_PWR       <= (code) && (code) <= KC_WAKE)
-#define IS_CONSUMER(code)        (KC_MUTE      <= (code) && (code) <= KC_WFAV)
+#define IS_CONSUMER(code)        (KC_MUTE      <= (code) && (code) <= KC_BRIGHTNESS_DEC)
 #define IS_FN(code)              (KC_FN0       <= (code) && (code) <= KC_FN31)
 #define IS_MOUSEKEY(code)        (KC_MS_UP     <= (code) && (code) <= KC_MS_ACCEL2)
 #define IS_MOUSEKEY_MOVE(code)   (KC_MS_UP     <= (code) && (code) <= KC_MS_RIGHT)
@@ -109,6 +116,8 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #define KC_P8   KC_KP_8
 #define KC_P9   KC_KP_9
 #define KC_P0   KC_KP_0
+#define KC_P00  KC_KP_00
+#define KC_P000 KC_KP_000
 #define KC_PDOT KC_KP_DOT
 #define KC_PCMM KC_KP_COMMA
 #define KC_PSLS KC_KP_SLASH
@@ -165,6 +174,8 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #define KC_WSTP KC_WWW_STOP
 #define KC_WREF KC_WWW_REFRESH
 #define KC_WFAV KC_WWW_FAVORITES
+#define KC_BRTI KC_BRIGHTNESS_INC
+#define KC_BRTD KC_BRIGHTNESS_DEC
 /* Jump to bootloader */
 #define KC_BTLD KC_BOOTLOADER
 /* Transparent */
@@ -179,7 +190,7 @@ enum hid_keyboard_keypad_usage {
     KC_ROLL_OVER,
     KC_POST_FAIL,
     KC_UNDEFINED,
-    KC_A,
+    KC_A,               /* 0x04 */
     KC_B,
     KC_C,
     KC_D,
@@ -341,10 +352,7 @@ enum hid_keyboard_keypad_usage {
     KC_CRSEL,
     KC_EXSEL,           /* 0xA4 */
 
-    /* NOTE: 0xA5-DF are used for internal special purpose */
-
-#if 0
-    /* NOTE: Following codes(0xB0-DD) are not used. Leave them for reference. */
+    /* NOTE: Following code range(0xB0-DD) are shared with special codes of 8-bit keymap */
     KC_KP_00            = 0xB0,
     KC_KP_000,
     KC_THOUSANDS_SEPARATOR,
@@ -391,7 +399,6 @@ enum hid_keyboard_keypad_usage {
     KC_KP_OCTAL,
     KC_KP_DECIMAL,
     KC_KP_HEXADECIMAL,  /* 0xDD */
-#endif
 
     /* Modifiers */
     KC_LCTRL            = 0xE0,
@@ -401,13 +408,11 @@ enum hid_keyboard_keypad_usage {
     KC_RCTRL,
     KC_RSHIFT,
     KC_RALT,
-    KC_RGUI,
-
-    /* NOTE: 0xE8-FF are used for internal special purpose */
+    KC_RGUI,            /* 0xE7 */
 };
 
-/* Special keycodes */
-/* NOTE: 0xA5-DF and 0xE8-FF are used for internal special purpose */
+/* Special keycodes for 8-bit keymap
+   NOTE: 0xA5-DF and 0xE8-FF are used for internal special purpose */
 enum internal_special_keycodes {
     /* System Control */
     KC_SYSTEM_POWER     = 0xA5,
@@ -435,7 +440,9 @@ enum internal_special_keycodes {
     KC_WWW_FORWARD,
     KC_WWW_STOP,
     KC_WWW_REFRESH,
-    KC_WWW_FAVORITES,    /* 0xBC */
+    KC_WWW_FAVORITES,
+    KC_BRIGHTNESS_INC,
+    KC_BRIGHTNESS_DEC,  /* 0xBE */
 
     /* Jump to bootloader */
     KC_BOOTLOADER       = 0xBF,