diff options
author | Giuseppe Rota <rota.giuseppe@gmail.com> | 2018-11-28 17:19:07 +0100 |
---|---|---|
committer | Drashna Jaelre <drashna@live.com> | 2018-11-28 08:19:07 -0800 |
commit | 8b85ec2a987d378fb95eea1468eadea70aec2cbf (patch) | |
tree | df3e29b6c643cd36cec19d98d4ec3a4130baf49a | |
parent | 3b42cff51607171285754ced097392332b40b5fd (diff) | |
download | qmk_firmware-8b85ec2a987d378fb95eea1468eadea70aec2cbf.tar.gz qmk_firmware-8b85ec2a987d378fb95eea1468eadea70aec2cbf.zip |
Add Extrakey support for Brightness up/down (#4477)
-rw-r--r-- | docs/keycode.txt | 2 | ||||
-rw-r--r-- | docs/keycodes.md | 2 | ||||
-rw-r--r-- | docs/keycodes_basic.md | 2 | ||||
-rw-r--r-- | quantum/keymap_common.c | 2 | ||||
-rw-r--r-- | tmk_core/common/keycode.h | 6 | ||||
-rw-r--r-- | tmk_core/common/report.h | 7 |
6 files changed, 18 insertions, 3 deletions
diff --git a/docs/keycode.txt b/docs/keycode.txt index b2070f711..bd93b0a94 100644 --- a/docs/keycode.txt +++ b/docs/keycode.txt | |||
@@ -209,6 +209,8 @@ KC_WWW_FORWARD KC_WFWD | |||
209 | KC_WWW_STOP KC_WSTP | 209 | KC_WWW_STOP KC_WSTP |
210 | KC_WWW_REFRESH KC_WREF | 210 | KC_WWW_REFRESH KC_WREF |
211 | KC_WWW_FAVORITES KC_WFAV | 211 | KC_WWW_FAVORITES KC_WFAV |
212 | KC_BRIGHTNESS_UP KC_BRIU | ||
213 | KC_BRIGHTNESS_DOWN KC_BRID | ||
212 | /* Mousekey */ | 214 | /* Mousekey */ |
213 | KC_MS_UP KC_MS_U Mouse Cursor Up | 215 | KC_MS_UP KC_MS_U Mouse Cursor Up |
214 | KC_MS_DOWN KC_MS_D Mouse Cursor Down | 216 | KC_MS_DOWN KC_MS_D Mouse Cursor Down |
diff --git a/docs/keycodes.md b/docs/keycodes.md index 1c5f46d6e..75b01389c 100644 --- a/docs/keycodes.md +++ b/docs/keycodes.md | |||
@@ -203,6 +203,8 @@ This is a reference only. Each group of keys links to the page documenting their | |||
203 | |`KC_WWW_FAVORITES` |`KC_WFAV` |Browser Favorites (Windows) | | 203 | |`KC_WWW_FAVORITES` |`KC_WFAV` |Browser Favorites (Windows) | |
204 | |`KC_MEDIA_FAST_FORWARD`|`KC_MFFD` |Next Track (macOS) | | 204 | |`KC_MEDIA_FAST_FORWARD`|`KC_MFFD` |Next Track (macOS) | |
205 | |`KC_MEDIA_REWIND` |`KC_MRWD` |Previous Track (macOS) | | 205 | |`KC_MEDIA_REWIND` |`KC_MRWD` |Previous Track (macOS) | |
206 | |`KC_BRIGHTNESS_UP` |`KC_BRIU` |Brightness Up | | ||
207 | |`KC_BRIGHTNESS_DOWN` |`KC_BRID` |Brightness Down | | ||
206 | 208 | ||
207 | ## [Quantum Keycodes](quantum_keycodes.md#qmk-keycodes) | 209 | ## [Quantum Keycodes](quantum_keycodes.md#qmk-keycodes) |
208 | 210 | ||
diff --git a/docs/keycodes_basic.md b/docs/keycodes_basic.md index ada9cc0e5..9cc00f032 100644 --- a/docs/keycodes_basic.md +++ b/docs/keycodes_basic.md | |||
@@ -219,6 +219,8 @@ Windows and macOS use different keycodes for "next track" and "previous track". | |||
219 | |`KC_WWW_FAVORITES` |`KC_WFAV`|Browser Favorites (Windows) | | 219 | |`KC_WWW_FAVORITES` |`KC_WFAV`|Browser Favorites (Windows) | |
220 | |`KC_MEDIA_FAST_FORWARD`|`KC_MFFD`|Next Track (macOS) | | 220 | |`KC_MEDIA_FAST_FORWARD`|`KC_MFFD`|Next Track (macOS) | |
221 | |`KC_MEDIA_REWIND` |`KC_MRWD`|Previous Track (macOS) | | 221 | |`KC_MEDIA_REWIND` |`KC_MRWD`|Previous Track (macOS) | |
222 | |`KC_BRIGHTNESS_UP` |`KC_BRIU`|Brightness Up | | ||
223 | |`KC_BRIGHTNESS_DOWN` |`KC_BRID`|Brightness Down | | ||
222 | 224 | ||
223 | ## Number Pad | 225 | ## Number Pad |
224 | 226 | ||
diff --git a/quantum/keymap_common.c b/quantum/keymap_common.c index 50af15d62..f6c8b70d2 100644 --- a/quantum/keymap_common.c +++ b/quantum/keymap_common.c | |||
@@ -64,7 +64,7 @@ action_t action_for_key(uint8_t layer, keypos_t key) | |||
64 | case KC_SYSTEM_POWER ... KC_SYSTEM_WAKE: | 64 | case KC_SYSTEM_POWER ... KC_SYSTEM_WAKE: |
65 | action.code = ACTION_USAGE_SYSTEM(KEYCODE2SYSTEM(keycode)); | 65 | action.code = ACTION_USAGE_SYSTEM(KEYCODE2SYSTEM(keycode)); |
66 | break; | 66 | break; |
67 | case KC_AUDIO_MUTE ... KC_MEDIA_REWIND: | 67 | case KC_AUDIO_MUTE ... KC_BRIGHTNESS_DOWN: |
68 | action.code = ACTION_USAGE_CONSUMER(KEYCODE2CONSUMER(keycode)); | 68 | action.code = ACTION_USAGE_CONSUMER(KEYCODE2CONSUMER(keycode)); |
69 | break; | 69 | break; |
70 | case KC_MS_UP ... KC_MS_ACCEL2: | 70 | case KC_MS_UP ... KC_MS_ACCEL2: |
diff --git a/tmk_core/common/keycode.h b/tmk_core/common/keycode.h index 61642ae84..d6fef2beb 100644 --- a/tmk_core/common/keycode.h +++ b/tmk_core/common/keycode.h | |||
@@ -33,7 +33,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
33 | 33 | ||
34 | #define IS_SPECIAL(code) ((0xA5 <= (code) && (code) <= 0xDF) || (0xE8 <= (code) && (code) <= 0xFF)) | 34 | #define IS_SPECIAL(code) ((0xA5 <= (code) && (code) <= 0xDF) || (0xE8 <= (code) && (code) <= 0xFF)) |
35 | #define IS_SYSTEM(code) (KC_PWR <= (code) && (code) <= KC_WAKE) | 35 | #define IS_SYSTEM(code) (KC_PWR <= (code) && (code) <= KC_WAKE) |
36 | #define IS_CONSUMER(code) (KC_MUTE <= (code) && (code) <= KC_MRWD) | 36 | #define IS_CONSUMER(code) (KC_MUTE <= (code) && (code) <= KC_BRID) |
37 | 37 | ||
38 | #define IS_FN(code) (KC_FN0 <= (code) && (code) <= KC_FN31) | 38 | #define IS_FN(code) (KC_FN0 <= (code) && (code) <= KC_FN31) |
39 | 39 | ||
@@ -170,6 +170,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
170 | #define KC_WFAV KC_WWW_FAVORITES | 170 | #define KC_WFAV KC_WWW_FAVORITES |
171 | #define KC_MFFD KC_MEDIA_FAST_FORWARD | 171 | #define KC_MFFD KC_MEDIA_FAST_FORWARD |
172 | #define KC_MRWD KC_MEDIA_REWIND | 172 | #define KC_MRWD KC_MEDIA_REWIND |
173 | #define KC_BRIU KC_BRIGHTNESS_UP | ||
174 | #define KC_BRID KC_BRIGHTNESS_DOWN | ||
173 | 175 | ||
174 | /* Mouse Keys */ | 176 | /* Mouse Keys */ |
175 | #define KC_MS_U KC_MS_UP | 177 | #define KC_MS_U KC_MS_UP |
@@ -457,6 +459,8 @@ enum internal_special_keycodes { | |||
457 | KC_WWW_FAVORITES, | 459 | KC_WWW_FAVORITES, |
458 | KC_MEDIA_FAST_FORWARD, | 460 | KC_MEDIA_FAST_FORWARD, |
459 | KC_MEDIA_REWIND, | 461 | KC_MEDIA_REWIND, |
462 | KC_BRIGHTNESS_UP, | ||
463 | KC_BRIGHTNESS_DOWN, | ||
460 | 464 | ||
461 | /* Fn keys */ | 465 | /* Fn keys */ |
462 | KC_FN0 = 0xC0, | 466 | KC_FN0 = 0xC0, |
diff --git a/tmk_core/common/report.h b/tmk_core/common/report.h index 5a1a6b19c..eb9afb727 100644 --- a/tmk_core/common/report.h +++ b/tmk_core/common/report.h | |||
@@ -38,6 +38,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
38 | 38 | ||
39 | /* Consumer Page(0x0C) | 39 | /* Consumer Page(0x0C) |
40 | * following are supported by Windows: http://msdn.microsoft.com/en-us/windows/hardware/gg463372.aspx | 40 | * following are supported by Windows: http://msdn.microsoft.com/en-us/windows/hardware/gg463372.aspx |
41 | * see also https://docs.microsoft.com/en-us/windows-hardware/drivers/hid/display-brightness-control | ||
41 | */ | 42 | */ |
42 | #define AUDIO_MUTE 0x00E2 | 43 | #define AUDIO_MUTE 0x00E2 |
43 | #define AUDIO_VOL_UP 0x00E9 | 44 | #define AUDIO_VOL_UP 0x00E9 |
@@ -47,6 +48,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
47 | #define TRANSPORT_STOP 0x00B7 | 48 | #define TRANSPORT_STOP 0x00B7 |
48 | #define TRANSPORT_STOP_EJECT 0x00CC | 49 | #define TRANSPORT_STOP_EJECT 0x00CC |
49 | #define TRANSPORT_PLAY_PAUSE 0x00CD | 50 | #define TRANSPORT_PLAY_PAUSE 0x00CD |
51 | #define BRIGHTNESSUP 0x006F | ||
52 | #define BRIGHTNESSDOWN 0x0070 | ||
50 | /* application launch */ | 53 | /* application launch */ |
51 | #define AL_CC_CONFIG 0x0183 | 54 | #define AL_CC_CONFIG 0x0183 |
52 | #define AL_EMAIL 0x018A | 55 | #define AL_EMAIL 0x018A |
@@ -189,7 +192,9 @@ typedef struct { | |||
189 | (key == KC_WWW_FORWARD ? AC_FORWARD : \ | 192 | (key == KC_WWW_FORWARD ? AC_FORWARD : \ |
190 | (key == KC_WWW_STOP ? AC_STOP : \ | 193 | (key == KC_WWW_STOP ? AC_STOP : \ |
191 | (key == KC_WWW_REFRESH ? AC_REFRESH : \ | 194 | (key == KC_WWW_REFRESH ? AC_REFRESH : \ |
192 | (key == KC_WWW_FAVORITES ? AC_BOOKMARKS : 0))))))))))))))))))))) | 195 | (key == KC_BRIGHTNESS_UP ? BRIGHTNESSUP : \ |
196 | (key == KC_BRIGHTNESS_DOWN ? BRIGHTNESSDOWN : \ | ||
197 | (key == KC_WWW_FAVORITES ? AC_BOOKMARKS : 0))))))))))))))))))))))) | ||
193 | 198 | ||
194 | uint8_t has_anykey(report_keyboard_t* keyboard_report); | 199 | uint8_t has_anykey(report_keyboard_t* keyboard_report); |
195 | uint8_t get_first_key(report_keyboard_t* keyboard_report); | 200 | uint8_t get_first_key(report_keyboard_t* keyboard_report); |