]> git.donarmstrong.com Git - qmk_firmware.git/commitdiff
Add Extrakey support for Brightness up/down (#4477)
authorGiuseppe Rota <rota.giuseppe@gmail.com>
Wed, 28 Nov 2018 16:19:07 +0000 (17:19 +0100)
committerDrashna Jaelre <drashna@live.com>
Wed, 28 Nov 2018 16:19:07 +0000 (08:19 -0800)
docs/keycode.txt
docs/keycodes.md
docs/keycodes_basic.md
quantum/keymap_common.c
tmk_core/common/keycode.h
tmk_core/common/report.h

index b2070f7117d67f71582067823a914f290d7470b5..bd93b0a941b675598c06a5d580b5d732a960c5b9 100644 (file)
@@ -209,6 +209,8 @@ KC_WWW_FORWARD      KC_WFWD
 KC_WWW_STOP         KC_WSTP
 KC_WWW_REFRESH      KC_WREF
 KC_WWW_FAVORITES    KC_WFAV
+KC_BRIGHTNESS_UP    KC_BRIU
+KC_BRIGHTNESS_DOWN  KC_BRID
 /* Mousekey */
 KC_MS_UP            KC_MS_U         Mouse Cursor Up
 KC_MS_DOWN          KC_MS_D         Mouse Cursor Down
index 1c5f46d6eceaedf2b1673d24bc079bcf0c45665c..75b01389c5d186578190e04e7c16b0cdc7a1c005 100644 (file)
@@ -203,6 +203,8 @@ This is a reference only. Each group of keys links to the page documenting their
 |`KC_WWW_FAVORITES`     |`KC_WFAV`           |Browser Favorites (Windows)                    |
 |`KC_MEDIA_FAST_FORWARD`|`KC_MFFD`           |Next Track (macOS)                             |
 |`KC_MEDIA_REWIND`      |`KC_MRWD`           |Previous Track (macOS)                         |
+|`KC_BRIGHTNESS_UP`     |`KC_BRIU`           |Brightness Up                                  |
+|`KC_BRIGHTNESS_DOWN`   |`KC_BRID`           |Brightness Down                                |
 
 ## [Quantum Keycodes](quantum_keycodes.md#qmk-keycodes)
 
index ada9cc0e5a21a92e95dbf2f7637b5f3ea126a25f..9cc00f03252dd4e6458cc4a5b2a1208785e1f0e4 100644 (file)
@@ -219,6 +219,8 @@ Windows and macOS use different keycodes for "next track" and "previous track".
 |`KC_WWW_FAVORITES`     |`KC_WFAV`|Browser Favorites (Windows)  |
 |`KC_MEDIA_FAST_FORWARD`|`KC_MFFD`|Next Track (macOS)           |
 |`KC_MEDIA_REWIND`      |`KC_MRWD`|Previous Track (macOS)       |
+|`KC_BRIGHTNESS_UP`     |`KC_BRIU`|Brightness Up                |
+|`KC_BRIGHTNESS_DOWN`   |`KC_BRID`|Brightness Down              |
 
 ## Number Pad
 
index 50af15d62696e9172a7c1dc023a4cd34a85ecaef..f6c8b70d28b9a6b40b86a04c154e0fa0359e628e 100644 (file)
@@ -64,7 +64,7 @@ action_t action_for_key(uint8_t layer, keypos_t key)
         case KC_SYSTEM_POWER ... KC_SYSTEM_WAKE:
             action.code = ACTION_USAGE_SYSTEM(KEYCODE2SYSTEM(keycode));
             break;
-        case KC_AUDIO_MUTE ... KC_MEDIA_REWIND:
+        case KC_AUDIO_MUTE ... KC_BRIGHTNESS_DOWN:
             action.code = ACTION_USAGE_CONSUMER(KEYCODE2CONSUMER(keycode));
             break;
         case KC_MS_UP ... KC_MS_ACCEL2:
index 61642ae84fb3377d87d414d2796c9fb28f4aec02..d6fef2bebf0e311d8ffa985d16e1223160905367 100644 (file)
@@ -33,7 +33,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 #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_MRWD)
+#define IS_CONSUMER(code)        (KC_MUTE      <= (code) && (code) <= KC_BRID)
 
 #define IS_FN(code)              (KC_FN0       <= (code) && (code) <= KC_FN31)
 
@@ -170,6 +170,8 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #define KC_WFAV KC_WWW_FAVORITES
 #define KC_MFFD KC_MEDIA_FAST_FORWARD
 #define KC_MRWD KC_MEDIA_REWIND
+#define KC_BRIU KC_BRIGHTNESS_UP
+#define KC_BRID KC_BRIGHTNESS_DOWN
 
 /* Mouse Keys */
 #define KC_MS_U KC_MS_UP
@@ -457,6 +459,8 @@ enum internal_special_keycodes {
   KC_WWW_FAVORITES,
   KC_MEDIA_FAST_FORWARD,
   KC_MEDIA_REWIND,
+  KC_BRIGHTNESS_UP,
+  KC_BRIGHTNESS_DOWN,
 
   /* Fn keys */
   KC_FN0                  = 0xC0,
index 5a1a6b19c7b4e412cba13ecc176a5592b02a9830..eb9afb727e44cbd8a2bb405cb76cab66e9adf304 100644 (file)
@@ -38,6 +38,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 /* Consumer Page(0x0C)
  * following are supported by Windows: http://msdn.microsoft.com/en-us/windows/hardware/gg463372.aspx
+ * see also https://docs.microsoft.com/en-us/windows-hardware/drivers/hid/display-brightness-control
  */
 #define AUDIO_MUTE              0x00E2
 #define AUDIO_VOL_UP            0x00E9
@@ -47,6 +48,8 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #define TRANSPORT_STOP          0x00B7
 #define TRANSPORT_STOP_EJECT    0x00CC
 #define TRANSPORT_PLAY_PAUSE    0x00CD
+#define BRIGHTNESSUP            0x006F
+#define BRIGHTNESSDOWN          0x0070
 /* application launch */
 #define AL_CC_CONFIG            0x0183
 #define AL_EMAIL                0x018A
@@ -189,7 +192,9 @@ typedef struct {
     (key == KC_WWW_FORWARD      ?  AC_FORWARD : \
     (key == KC_WWW_STOP         ?  AC_STOP : \
     (key == KC_WWW_REFRESH      ?  AC_REFRESH : \
-    (key == KC_WWW_FAVORITES    ?  AC_BOOKMARKS : 0)))))))))))))))))))))
+    (key == KC_BRIGHTNESS_UP    ?  BRIGHTNESSUP : \
+    (key == KC_BRIGHTNESS_DOWN  ?  BRIGHTNESSDOWN : \
+    (key == KC_WWW_FAVORITES    ?  AC_BOOKMARKS : 0)))))))))))))))))))))))
 
 uint8_t has_anykey(report_keyboard_t* keyboard_report);
 uint8_t get_first_key(report_keyboard_t* keyboard_report);