diff options
| author | Nick Brassel <nick@tzarc.org> | 2024-08-27 10:52:23 +1000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-08-27 10:52:23 +1000 |
| commit | 70cbf08b673c2cc59e603503e834ac460040ecc1 (patch) | |
| tree | 3843e6c36e6564a1a6842cc15adc276cd29ce0d2 | |
| parent | ecf725b356e999799f30f0fcaa9e0848cc3163ca (diff) | |
Add new connection keycodes for Bluetooth, 2.4GHz. (#24251)
| -rw-r--r-- | builddefs/common_features.mk | 2 | ||||
| -rw-r--r-- | data/constants/keycodes/keycodes_0.0.5_connection.hjson | 109 | ||||
| -rw-r--r-- | data/constants/keycodes/keycodes_0.0.5_quantum.hjson | 7 | ||||
| -rw-r--r-- | docs/features/bluetooth.md | 10 | ||||
| -rw-r--r-- | docs/keycodes.md | 10 | ||||
| -rw-r--r-- | quantum/keycodes.h | 40 | ||||
| -rw-r--r-- | quantum/process_keycode/process_connection.c | 36 | ||||
| -rw-r--r-- | quantum/process_keycode/process_connection.h | 9 | ||||
| -rw-r--r-- | quantum/quantum.c | 16 | ||||
| -rw-r--r-- | quantum/quantum_keycodes_legacy.h | 2 | ||||
| -rw-r--r-- | tests/test_common/keycode_table.cpp | 17 |
11 files changed, 226 insertions, 32 deletions
diff --git a/builddefs/common_features.mk b/builddefs/common_features.mk index 498614dd26..c1cdd5d886 100644 --- a/builddefs/common_features.mk +++ b/builddefs/common_features.mk | |||
| @@ -881,7 +881,7 @@ ifeq ($(strip $(BLUETOOTH_ENABLE)), yes) | |||
| 881 | OPT_DEFS += -DBLUETOOTH_$(strip $(shell echo $(BLUETOOTH_DRIVER) | tr '[:lower:]' '[:upper:]')) | 881 | OPT_DEFS += -DBLUETOOTH_$(strip $(shell echo $(BLUETOOTH_DRIVER) | tr '[:lower:]' '[:upper:]')) |
| 882 | NO_USB_STARTUP_CHECK := yes | 882 | NO_USB_STARTUP_CHECK := yes |
| 883 | COMMON_VPATH += $(DRIVER_PATH)/bluetooth | 883 | COMMON_VPATH += $(DRIVER_PATH)/bluetooth |
| 884 | SRC += outputselect.c | 884 | SRC += outputselect.c process_connection.c |
| 885 | 885 | ||
| 886 | ifeq ($(strip $(BLUETOOTH_DRIVER)), bluefruit_le) | 886 | ifeq ($(strip $(BLUETOOTH_DRIVER)), bluefruit_le) |
| 887 | SPI_DRIVER_REQUIRED = yes | 887 | SPI_DRIVER_REQUIRED = yes |
diff --git a/data/constants/keycodes/keycodes_0.0.5_connection.hjson b/data/constants/keycodes/keycodes_0.0.5_connection.hjson new file mode 100644 index 0000000000..9a1a750f1a --- /dev/null +++ b/data/constants/keycodes/keycodes_0.0.5_connection.hjson | |||
| @@ -0,0 +1,109 @@ | |||
| 1 | { | ||
| 2 | "ranges": { | ||
| 3 | "0x7780/0x003F": { | ||
| 4 | "define": "QK_CONNECTION" | ||
| 5 | } | ||
| 6 | } | ||
| 7 | "keycodes": { | ||
| 8 | "0x7780": { | ||
| 9 | "group": "connection", | ||
| 10 | "key": "QK_OUTPUT_NEXT", | ||
| 11 | "aliases": [ | ||
| 12 | "OU_NEXT", | ||
| 13 | "OU_AUTO" | ||
| 14 | ] | ||
| 15 | }, | ||
| 16 | "0x7781": { | ||
| 17 | "group": "connection", | ||
| 18 | "key": "QK_OUTPUT_PREV", | ||
| 19 | "aliases": [ | ||
| 20 | "OU_PREV" | ||
| 21 | ] | ||
| 22 | }, | ||
| 23 | "0x7782": { | ||
| 24 | "group": "connection", | ||
| 25 | "key": "QK_OUTPUT_NONE", | ||
| 26 | "aliases": [ | ||
| 27 | "OU_NONE" | ||
| 28 | ] | ||
| 29 | }, | ||
| 30 | "0x7783": { | ||
| 31 | "group": "connection", | ||
| 32 | "key": "QK_OUTPUT_USB", | ||
| 33 | "aliases": [ | ||
| 34 | "OU_USB" | ||
| 35 | ] | ||
| 36 | }, | ||
| 37 | "0x7784": { | ||
| 38 | "group": "connection", | ||
| 39 | "key": "QK_OUTPUT_2P4GHZ", | ||
| 40 | "aliases": [ | ||
| 41 | "OU_2P4G" | ||
| 42 | ] | ||
| 43 | }, | ||
| 44 | "0x7785": { | ||
| 45 | "group": "connection", | ||
| 46 | "key": "QK_OUTPUT_BLUETOOTH", | ||
| 47 | "aliases": [ | ||
| 48 | "OU_BT" | ||
| 49 | ] | ||
| 50 | }, | ||
| 51 | |||
| 52 | "0x7790": { | ||
| 53 | "group": "connection", | ||
| 54 | "key": "QK_BLUETOOTH_PROFILE_NEXT", | ||
| 55 | "aliases": [ | ||
| 56 | "BT_NEXT" | ||
| 57 | ] | ||
| 58 | }, | ||
| 59 | "0x7791": { | ||
| 60 | "group": "connection", | ||
| 61 | "key": "QK_BLUETOOTH_PROFILE_PREV", | ||
| 62 | "aliases": [ | ||
| 63 | "BT_PREV" | ||
| 64 | ] | ||
| 65 | }, | ||
| 66 | "0x7792": { | ||
| 67 | "group": "connection", | ||
| 68 | "key": "QK_BLUETOOTH_UNPAIR", | ||
| 69 | "aliases": [ | ||
| 70 | "BT_UNPR" | ||
| 71 | ] | ||
| 72 | } | ||
| 73 | "0x7793": { | ||
| 74 | "group": "connection", | ||
| 75 | "key": "QK_BLUETOOTH_PROFILE1", | ||
| 76 | "aliases": [ | ||
| 77 | "BT_PRF1" | ||
| 78 | ] | ||
| 79 | }, | ||
| 80 | "0x7794": { | ||
| 81 | "group": "connection", | ||
| 82 | "key": "QK_BLUETOOTH_PROFILE2", | ||
| 83 | "aliases": [ | ||
| 84 | "BT_PRF2" | ||
| 85 | ] | ||
| 86 | }, | ||
| 87 | "0x7795": { | ||
| 88 | "group": "connection", | ||
| 89 | "key": "QK_BLUETOOTH_PROFILE3", | ||
| 90 | "aliases": [ | ||
| 91 | "BT_PRF3" | ||
| 92 | ] | ||
| 93 | }, | ||
| 94 | "0x7796": { | ||
| 95 | "group": "connection", | ||
| 96 | "key": "QK_BLUETOOTH_PROFILE4", | ||
| 97 | "aliases": [ | ||
| 98 | "BT_PRF4" | ||
| 99 | ] | ||
| 100 | }, | ||
| 101 | "0x7797": { | ||
| 102 | "group": "connection", | ||
| 103 | "key": "QK_BLUETOOTH_PROFILE5", | ||
| 104 | "aliases": [ | ||
| 105 | "BT_PRF5" | ||
| 106 | ] | ||
| 107 | }, | ||
| 108 | } | ||
| 109 | } | ||
diff --git a/data/constants/keycodes/keycodes_0.0.5_quantum.hjson b/data/constants/keycodes/keycodes_0.0.5_quantum.hjson new file mode 100644 index 0000000000..814cd66a5b --- /dev/null +++ b/data/constants/keycodes/keycodes_0.0.5_quantum.hjson | |||
| @@ -0,0 +1,7 @@ | |||
| 1 | { | ||
| 2 | "keycodes": { | ||
| 3 | "0x7C20": "!delete!", // old QK_OUTPUT_AUTO | ||
| 4 | "0x7C21": "!delete!", // old QK_OUTPUT_USB | ||
| 5 | "0x7C22": "!delete!", // old QK_OUTPUT_BLUETOOTH | ||
| 6 | } | ||
| 7 | } | ||
diff --git a/docs/features/bluetooth.md b/docs/features/bluetooth.md index 1dbf15f4e1..d3634498be 100644 --- a/docs/features/bluetooth.md +++ b/docs/features/bluetooth.md | |||
| @@ -39,8 +39,8 @@ BLUETOOTH_DRIVER = bluefruit_le # or rn42 | |||
| 39 | 39 | ||
| 40 | This is used when multiple keyboard outputs can be selected. Currently this only allows for switching between USB and Bluetooth on keyboards that support both. | 40 | This is used when multiple keyboard outputs can be selected. Currently this only allows for switching between USB and Bluetooth on keyboards that support both. |
| 41 | 41 | ||
| 42 | |Key |Aliases |Description | | 42 | | Key | Aliases | Description | |
| 43 | |---------------------|---------|----------------------------------------------| | 43 | |-----------------------|----------------------|------------------------------------------------| |
| 44 | |`QK_OUTPUT_AUTO` |`OU_AUTO`|Automatically switch between USB and Bluetooth| | 44 | | `QK_OUTPUT_NEXT` | `OU_NEXT`, `OU_AUTO` | Automatically switch between USB and Bluetooth | |
| 45 | |`QK_OUTPUT_USB` |`OU_USB` |USB only | | 45 | | `QK_OUTPUT_USB` | `OU_USB` | USB only | |
| 46 | |`QK_OUTPUT_BLUETOOTH`|`OU_BT` |Bluetooth only | | 46 | | `QK_OUTPUT_BLUETOOTH` | `OU_BT` | Bluetooth only | |
diff --git a/docs/keycodes.md b/docs/keycodes.md index 9038c2b6d7..9107ca5eb8 100644 --- a/docs/keycodes.md +++ b/docs/keycodes.md | |||
| @@ -294,11 +294,11 @@ See also: [Backlighting](features/backlight) | |||
| 294 | 294 | ||
| 295 | See also: [Bluetooth](features/bluetooth) | 295 | See also: [Bluetooth](features/bluetooth) |
| 296 | 296 | ||
| 297 | |Key |Aliases |Description | | 297 | | Key | Aliases | Description | |
| 298 | |---------------------|---------|----------------------------------------------| | 298 | |-----------------------|----------------------|------------------------------------------------| |
| 299 | |`QK_OUTPUT_AUTO` |`OU_AUTO`|Automatically switch between USB and Bluetooth| | 299 | | `QK_OUTPUT_NEXT` | `OU_NEXT`, `OU_AUTO` | Automatically switch between USB and Bluetooth | |
| 300 | |`QK_OUTPUT_USB` |`OU_USB` |USB only | | 300 | | `QK_OUTPUT_USB` | `OU_USB` | USB only | |
| 301 | |`QK_OUTPUT_BLUETOOTH`|`OU_BT` |Bluetooth only | | 301 | | `QK_OUTPUT_BLUETOOTH` | `OU_BT` | Bluetooth only | |
| 302 | 302 | ||
| 303 | ## Caps Word {#caps-word} | 303 | ## Caps Word {#caps-word} |
| 304 | 304 | ||
diff --git a/quantum/keycodes.h b/quantum/keycodes.h index f461e4a586..38127bb6da 100644 --- a/quantum/keycodes.h +++ b/quantum/keycodes.h | |||
| @@ -72,6 +72,8 @@ enum qk_keycode_ranges { | |||
| 72 | QK_STENO_MAX = 0x74FF, | 72 | QK_STENO_MAX = 0x74FF, |
| 73 | QK_MACRO = 0x7700, | 73 | QK_MACRO = 0x7700, |
| 74 | QK_MACRO_MAX = 0x777F, | 74 | QK_MACRO_MAX = 0x777F, |
| 75 | QK_CONNECTION = 0x7780, | ||
| 76 | QK_CONNECTION_MAX = 0x77BF, | ||
| 75 | QK_LIGHTING = 0x7800, | 77 | QK_LIGHTING = 0x7800, |
| 76 | QK_LIGHTING_MAX = 0x78FF, | 78 | QK_LIGHTING_MAX = 0x78FF, |
| 77 | QK_QUANTUM = 0x7C00, | 79 | QK_QUANTUM = 0x7C00, |
| @@ -620,6 +622,20 @@ enum qk_keycode_defines { | |||
| 620 | QK_MACRO_29 = 0x771D, | 622 | QK_MACRO_29 = 0x771D, |
| 621 | QK_MACRO_30 = 0x771E, | 623 | QK_MACRO_30 = 0x771E, |
| 622 | QK_MACRO_31 = 0x771F, | 624 | QK_MACRO_31 = 0x771F, |
| 625 | QK_OUTPUT_NEXT = 0x7780, | ||
| 626 | QK_OUTPUT_PREV = 0x7781, | ||
| 627 | QK_OUTPUT_NONE = 0x7782, | ||
| 628 | QK_OUTPUT_USB = 0x7783, | ||
| 629 | QK_OUTPUT_2P4GHZ = 0x7784, | ||
| 630 | QK_OUTPUT_BLUETOOTH = 0x7785, | ||
| 631 | QK_BLUETOOTH_PROFILE_NEXT = 0x7790, | ||
| 632 | QK_BLUETOOTH_PROFILE_PREV = 0x7791, | ||
| 633 | QK_BLUETOOTH_UNPAIR = 0x7792, | ||
| 634 | QK_BLUETOOTH_PROFILE1 = 0x7793, | ||
| 635 | QK_BLUETOOTH_PROFILE2 = 0x7794, | ||
| 636 | QK_BLUETOOTH_PROFILE3 = 0x7795, | ||
| 637 | QK_BLUETOOTH_PROFILE4 = 0x7796, | ||
| 638 | QK_BLUETOOTH_PROFILE5 = 0x7797, | ||
| 623 | QK_BACKLIGHT_ON = 0x7800, | 639 | QK_BACKLIGHT_ON = 0x7800, |
| 624 | QK_BACKLIGHT_OFF = 0x7801, | 640 | QK_BACKLIGHT_OFF = 0x7801, |
| 625 | QK_BACKLIGHT_TOGGLE = 0x7802, | 641 | QK_BACKLIGHT_TOGGLE = 0x7802, |
| @@ -690,9 +706,6 @@ enum qk_keycode_defines { | |||
| 690 | QK_SPACE_CADET_LEFT_ALT_PARENTHESIS_OPEN = 0x7C1C, | 706 | QK_SPACE_CADET_LEFT_ALT_PARENTHESIS_OPEN = 0x7C1C, |
| 691 | QK_SPACE_CADET_RIGHT_ALT_PARENTHESIS_CLOSE = 0x7C1D, | 707 | QK_SPACE_CADET_RIGHT_ALT_PARENTHESIS_CLOSE = 0x7C1D, |
| 692 | QK_SPACE_CADET_RIGHT_SHIFT_ENTER = 0x7C1E, | 708 | QK_SPACE_CADET_RIGHT_SHIFT_ENTER = 0x7C1E, |
| 693 | QK_OUTPUT_AUTO = 0x7C20, | ||
| 694 | QK_OUTPUT_USB = 0x7C21, | ||
| 695 | QK_OUTPUT_BLUETOOTH = 0x7C22, | ||
| 696 | QK_UNICODE_MODE_NEXT = 0x7C30, | 709 | QK_UNICODE_MODE_NEXT = 0x7C30, |
| 697 | QK_UNICODE_MODE_PREVIOUS = 0x7C31, | 710 | QK_UNICODE_MODE_PREVIOUS = 0x7C31, |
| 698 | QK_UNICODE_MODE_MACOS = 0x7C32, | 711 | QK_UNICODE_MODE_MACOS = 0x7C32, |
| @@ -1296,6 +1309,21 @@ enum qk_keycode_defines { | |||
| 1296 | MC_29 = QK_MACRO_29, | 1309 | MC_29 = QK_MACRO_29, |
| 1297 | MC_30 = QK_MACRO_30, | 1310 | MC_30 = QK_MACRO_30, |
| 1298 | MC_31 = QK_MACRO_31, | 1311 | MC_31 = QK_MACRO_31, |
| 1312 | OU_NEXT = QK_OUTPUT_NEXT, | ||
| 1313 | OU_AUTO = QK_OUTPUT_NEXT, | ||
| 1314 | OU_PREV = QK_OUTPUT_PREV, | ||
| 1315 | OU_NONE = QK_OUTPUT_NONE, | ||
| 1316 | OU_USB = QK_OUTPUT_USB, | ||
| 1317 | OU_2P4G = QK_OUTPUT_2P4GHZ, | ||
| 1318 | OU_BT = QK_OUTPUT_BLUETOOTH, | ||
| 1319 | BT_NEXT = QK_BLUETOOTH_PROFILE_NEXT, | ||
| 1320 | BT_PREV = QK_BLUETOOTH_PROFILE_PREV, | ||
| 1321 | BT_UNPR = QK_BLUETOOTH_UNPAIR, | ||
| 1322 | BT_PRF1 = QK_BLUETOOTH_PROFILE1, | ||
| 1323 | BT_PRF2 = QK_BLUETOOTH_PROFILE2, | ||
| 1324 | BT_PRF3 = QK_BLUETOOTH_PROFILE3, | ||
| 1325 | BT_PRF4 = QK_BLUETOOTH_PROFILE4, | ||
| 1326 | BT_PRF5 = QK_BLUETOOTH_PROFILE5, | ||
| 1299 | BL_ON = QK_BACKLIGHT_ON, | 1327 | BL_ON = QK_BACKLIGHT_ON, |
| 1300 | BL_OFF = QK_BACKLIGHT_OFF, | 1328 | BL_OFF = QK_BACKLIGHT_OFF, |
| 1301 | BL_TOGG = QK_BACKLIGHT_TOGGLE, | 1329 | BL_TOGG = QK_BACKLIGHT_TOGGLE, |
| @@ -1365,9 +1393,6 @@ enum qk_keycode_defines { | |||
| 1365 | SC_LAPO = QK_SPACE_CADET_LEFT_ALT_PARENTHESIS_OPEN, | 1393 | SC_LAPO = QK_SPACE_CADET_LEFT_ALT_PARENTHESIS_OPEN, |
| 1366 | SC_RAPC = QK_SPACE_CADET_RIGHT_ALT_PARENTHESIS_CLOSE, | 1394 | SC_RAPC = QK_SPACE_CADET_RIGHT_ALT_PARENTHESIS_CLOSE, |
| 1367 | SC_SENT = QK_SPACE_CADET_RIGHT_SHIFT_ENTER, | 1395 | SC_SENT = QK_SPACE_CADET_RIGHT_SHIFT_ENTER, |
| 1368 | OU_AUTO = QK_OUTPUT_AUTO, | ||
| 1369 | OU_USB = QK_OUTPUT_USB, | ||
| 1370 | OU_BT = QK_OUTPUT_BLUETOOTH, | ||
| 1371 | UC_NEXT = QK_UNICODE_MODE_NEXT, | 1396 | UC_NEXT = QK_UNICODE_MODE_NEXT, |
| 1372 | UC_PREV = QK_UNICODE_MODE_PREVIOUS, | 1397 | UC_PREV = QK_UNICODE_MODE_PREVIOUS, |
| 1373 | UC_MAC = QK_UNICODE_MODE_MACOS, | 1398 | UC_MAC = QK_UNICODE_MODE_MACOS, |
| @@ -1444,6 +1469,7 @@ enum qk_keycode_defines { | |||
| 1444 | #define IS_QK_AUDIO(code) ((code) >= QK_AUDIO && (code) <= QK_AUDIO_MAX) | 1469 | #define IS_QK_AUDIO(code) ((code) >= QK_AUDIO && (code) <= QK_AUDIO_MAX) |
| 1445 | #define IS_QK_STENO(code) ((code) >= QK_STENO && (code) <= QK_STENO_MAX) | 1470 | #define IS_QK_STENO(code) ((code) >= QK_STENO && (code) <= QK_STENO_MAX) |
| 1446 | #define IS_QK_MACRO(code) ((code) >= QK_MACRO && (code) <= QK_MACRO_MAX) | 1471 | #define IS_QK_MACRO(code) ((code) >= QK_MACRO && (code) <= QK_MACRO_MAX) |
| 1472 | #define IS_QK_CONNECTION(code) ((code) >= QK_CONNECTION && (code) <= QK_CONNECTION_MAX) | ||
| 1447 | #define IS_QK_LIGHTING(code) ((code) >= QK_LIGHTING && (code) <= QK_LIGHTING_MAX) | 1473 | #define IS_QK_LIGHTING(code) ((code) >= QK_LIGHTING && (code) <= QK_LIGHTING_MAX) |
| 1448 | #define IS_QK_QUANTUM(code) ((code) >= QK_QUANTUM && (code) <= QK_QUANTUM_MAX) | 1474 | #define IS_QK_QUANTUM(code) ((code) >= QK_QUANTUM && (code) <= QK_QUANTUM_MAX) |
| 1449 | #define IS_QK_KB(code) ((code) >= QK_KB && (code) <= QK_KB_MAX) | 1475 | #define IS_QK_KB(code) ((code) >= QK_KB && (code) <= QK_KB_MAX) |
| @@ -1468,6 +1494,7 @@ enum qk_keycode_defines { | |||
| 1468 | #define IS_AUDIO_KEYCODE(code) ((code) >= QK_AUDIO_ON && (code) <= QK_AUDIO_VOICE_PREVIOUS) | 1494 | #define IS_AUDIO_KEYCODE(code) ((code) >= QK_AUDIO_ON && (code) <= QK_AUDIO_VOICE_PREVIOUS) |
| 1469 | #define IS_STENO_KEYCODE(code) ((code) >= QK_STENO_BOLT && (code) <= QK_STENO_COMB_MAX) | 1495 | #define IS_STENO_KEYCODE(code) ((code) >= QK_STENO_BOLT && (code) <= QK_STENO_COMB_MAX) |
| 1470 | #define IS_MACRO_KEYCODE(code) ((code) >= QK_MACRO_0 && (code) <= QK_MACRO_31) | 1496 | #define IS_MACRO_KEYCODE(code) ((code) >= QK_MACRO_0 && (code) <= QK_MACRO_31) |
| 1497 | #define IS_CONNECTION_KEYCODE(code) ((code) >= QK_OUTPUT_NEXT && (code) <= QK_BLUETOOTH_PROFILE5) | ||
| 1471 | #define IS_BACKLIGHT_KEYCODE(code) ((code) >= QK_BACKLIGHT_ON && (code) <= QK_BACKLIGHT_TOGGLE_BREATHING) | 1498 | #define IS_BACKLIGHT_KEYCODE(code) ((code) >= QK_BACKLIGHT_ON && (code) <= QK_BACKLIGHT_TOGGLE_BREATHING) |
| 1472 | #define IS_LED_MATRIX_KEYCODE(code) ((code) >= QK_LED_MATRIX_ON && (code) <= QK_LED_MATRIX_SPEED_DOWN) | 1499 | #define IS_LED_MATRIX_KEYCODE(code) ((code) >= QK_LED_MATRIX_ON && (code) <= QK_LED_MATRIX_SPEED_DOWN) |
| 1473 | #define IS_UNDERGLOW_KEYCODE(code) ((code) >= QK_UNDERGLOW_TOGGLE && (code) <= QK_UNDERGLOW_SPEED_DOWN) | 1500 | #define IS_UNDERGLOW_KEYCODE(code) ((code) >= QK_UNDERGLOW_TOGGLE && (code) <= QK_UNDERGLOW_SPEED_DOWN) |
| @@ -1493,6 +1520,7 @@ enum qk_keycode_defines { | |||
| 1493 | #define AUDIO_KEYCODE_RANGE QK_AUDIO_ON ... QK_AUDIO_VOICE_PREVIOUS | 1520 | #define AUDIO_KEYCODE_RANGE QK_AUDIO_ON ... QK_AUDIO_VOICE_PREVIOUS |
| 1494 | #define STENO_KEYCODE_RANGE QK_STENO_BOLT ... QK_STENO_COMB_MAX | 1521 | #define STENO_KEYCODE_RANGE QK_STENO_BOLT ... QK_STENO_COMB_MAX |
| 1495 | #define MACRO_KEYCODE_RANGE QK_MACRO_0 ... QK_MACRO_31 | 1522 | #define MACRO_KEYCODE_RANGE QK_MACRO_0 ... QK_MACRO_31 |
| 1523 | #define CONNECTION_KEYCODE_RANGE QK_OUTPUT_NEXT ... QK_BLUETOOTH_PROFILE5 | ||
| 1496 | #define BACKLIGHT_KEYCODE_RANGE QK_BACKLIGHT_ON ... QK_BACKLIGHT_TOGGLE_BREATHING | 1524 | #define BACKLIGHT_KEYCODE_RANGE QK_BACKLIGHT_ON ... QK_BACKLIGHT_TOGGLE_BREATHING |
| 1497 | #define LED_MATRIX_KEYCODE_RANGE QK_LED_MATRIX_ON ... QK_LED_MATRIX_SPEED_DOWN | 1525 | #define LED_MATRIX_KEYCODE_RANGE QK_LED_MATRIX_ON ... QK_LED_MATRIX_SPEED_DOWN |
| 1498 | #define UNDERGLOW_KEYCODE_RANGE QK_UNDERGLOW_TOGGLE ... QK_UNDERGLOW_SPEED_DOWN | 1526 | #define UNDERGLOW_KEYCODE_RANGE QK_UNDERGLOW_TOGGLE ... QK_UNDERGLOW_SPEED_DOWN |
diff --git a/quantum/process_keycode/process_connection.c b/quantum/process_keycode/process_connection.c new file mode 100644 index 0000000000..b0e230d680 --- /dev/null +++ b/quantum/process_keycode/process_connection.c | |||
| @@ -0,0 +1,36 @@ | |||
| 1 | // Copyright 2024 Nick Brassel (@tzarc) | ||
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | ||
| 3 | #include "outputselect.h" | ||
| 4 | #include "process_connection.h" | ||
| 5 | |||
| 6 | bool process_connection(uint16_t keycode, keyrecord_t *record) { | ||
| 7 | if (record->event.pressed) { | ||
| 8 | switch (keycode) { | ||
| 9 | case QK_OUTPUT_NEXT: | ||
| 10 | set_output(OUTPUT_AUTO); // This should cycle through the outputs going forward. Ensure `docs/keycodes.md`, `docs/features/bluetooth.md` are updated when it does. | ||
| 11 | return false; | ||
| 12 | case QK_OUTPUT_USB: | ||
| 13 | set_output(OUTPUT_USB); | ||
| 14 | return false; | ||
| 15 | case QK_OUTPUT_BLUETOOTH: | ||
| 16 | set_output(OUTPUT_BLUETOOTH); | ||
| 17 | return false; | ||
| 18 | |||
| 19 | case QK_OUTPUT_PREV: | ||
| 20 | case QK_OUTPUT_NONE: | ||
| 21 | case QK_OUTPUT_2P4GHZ: | ||
| 22 | case QK_BLUETOOTH_PROFILE_NEXT: | ||
| 23 | case QK_BLUETOOTH_PROFILE_PREV: | ||
| 24 | case QK_BLUETOOTH_UNPAIR: | ||
| 25 | case QK_BLUETOOTH_PROFILE1: | ||
| 26 | case QK_BLUETOOTH_PROFILE2: | ||
| 27 | case QK_BLUETOOTH_PROFILE3: | ||
| 28 | case QK_BLUETOOTH_PROFILE4: | ||
| 29 | case QK_BLUETOOTH_PROFILE5: | ||
| 30 | // As-yet unimplemented. | ||
| 31 | // When implementation is done, ensure `docs/keycodes.md`, `docs/features/bluetooth.md` are updated accordingly. | ||
| 32 | return false; | ||
| 33 | } | ||
| 34 | } | ||
| 35 | return true; | ||
| 36 | } | ||
diff --git a/quantum/process_keycode/process_connection.h b/quantum/process_keycode/process_connection.h new file mode 100644 index 0000000000..cc58011bb7 --- /dev/null +++ b/quantum/process_keycode/process_connection.h | |||
| @@ -0,0 +1,9 @@ | |||
| 1 | // Copyright 2024 Nick Brassel (@tzarc) | ||
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | ||
| 3 | #pragma once | ||
| 4 | |||
| 5 | #include <stdint.h> | ||
| 6 | #include <stdbool.h> | ||
| 7 | #include "action.h" | ||
| 8 | |||
| 9 | bool process_connection(uint16_t keycode, keyrecord_t *record); | ||
diff --git a/quantum/quantum.c b/quantum/quantum.c index b21d6f1a3d..db323e31c9 100644 --- a/quantum/quantum.c +++ b/quantum/quantum.c | |||
| @@ -21,7 +21,7 @@ | |||
| 21 | #endif | 21 | #endif |
| 22 | 22 | ||
| 23 | #ifdef BLUETOOTH_ENABLE | 23 | #ifdef BLUETOOTH_ENABLE |
| 24 | # include "outputselect.h" | 24 | # include "process_connection.h" |
| 25 | #endif | 25 | #endif |
| 26 | 26 | ||
| 27 | #ifdef GRAVE_ESC_ENABLE | 27 | #ifdef GRAVE_ESC_ENABLE |
| @@ -393,6 +393,9 @@ bool process_record_quantum(keyrecord_t *record) { | |||
| 393 | #ifdef TRI_LAYER_ENABLE | 393 | #ifdef TRI_LAYER_ENABLE |
| 394 | process_tri_layer(keycode, record) && | 394 | process_tri_layer(keycode, record) && |
| 395 | #endif | 395 | #endif |
| 396 | #ifdef BLUETOOTH_ENABLE | ||
| 397 | process_connection(keycode, record) && | ||
| 398 | #endif | ||
| 396 | true)) { | 399 | true)) { |
| 397 | return false; | 400 | return false; |
| 398 | } | 401 | } |
| @@ -430,17 +433,6 @@ bool process_record_quantum(keyrecord_t *record) { | |||
| 430 | velocikey_toggle(); | 433 | velocikey_toggle(); |
| 431 | return false; | 434 | return false; |
| 432 | #endif | 435 | #endif |
| 433 | #ifdef BLUETOOTH_ENABLE | ||
| 434 | case QK_OUTPUT_AUTO: | ||
| 435 | set_output(OUTPUT_AUTO); | ||
| 436 | return false; | ||
| 437 | case QK_OUTPUT_USB: | ||
| 438 | set_output(OUTPUT_USB); | ||
| 439 | return false; | ||
| 440 | case QK_OUTPUT_BLUETOOTH: | ||
| 441 | set_output(OUTPUT_BLUETOOTH); | ||
| 442 | return false; | ||
| 443 | #endif | ||
| 444 | #ifndef NO_ACTION_ONESHOT | 436 | #ifndef NO_ACTION_ONESHOT |
| 445 | case QK_ONE_SHOT_TOGGLE: | 437 | case QK_ONE_SHOT_TOGGLE: |
| 446 | oneshot_toggle(); | 438 | oneshot_toggle(); |
diff --git a/quantum/quantum_keycodes_legacy.h b/quantum/quantum_keycodes_legacy.h index e1562077e5..21aec90675 100644 --- a/quantum/quantum_keycodes_legacy.h +++ b/quantum/quantum_keycodes_legacy.h | |||
| @@ -55,3 +55,5 @@ | |||
| 55 | #define KC_ACL1 QK_MOUSE_ACCELERATION_1 | 55 | #define KC_ACL1 QK_MOUSE_ACCELERATION_1 |
| 56 | #define KC_MS_ACCEL2 QK_MOUSE_ACCELERATION_2 | 56 | #define KC_MS_ACCEL2 QK_MOUSE_ACCELERATION_2 |
| 57 | #define KC_ACL2 QK_MOUSE_ACCELERATION_2 | 57 | #define KC_ACL2 QK_MOUSE_ACCELERATION_2 |
| 58 | |||
| 59 | #define QK_OUTPUT_AUTO OU_AUTO | ||
diff --git a/tests/test_common/keycode_table.cpp b/tests/test_common/keycode_table.cpp index 4c28ab4d20..e4d445de82 100644 --- a/tests/test_common/keycode_table.cpp +++ b/tests/test_common/keycode_table.cpp | |||
| @@ -562,6 +562,20 @@ std::map<uint16_t, std::string> KEYCODE_ID_TABLE = { | |||
| 562 | {QK_MACRO_29, "QK_MACRO_29"}, | 562 | {QK_MACRO_29, "QK_MACRO_29"}, |
| 563 | {QK_MACRO_30, "QK_MACRO_30"}, | 563 | {QK_MACRO_30, "QK_MACRO_30"}, |
| 564 | {QK_MACRO_31, "QK_MACRO_31"}, | 564 | {QK_MACRO_31, "QK_MACRO_31"}, |
| 565 | {QK_OUTPUT_NEXT, "QK_OUTPUT_NEXT"}, | ||
| 566 | {QK_OUTPUT_PREV, "QK_OUTPUT_PREV"}, | ||
| 567 | {QK_OUTPUT_NONE, "QK_OUTPUT_NONE"}, | ||
| 568 | {QK_OUTPUT_USB, "QK_OUTPUT_USB"}, | ||
| 569 | {QK_OUTPUT_2P4GHZ, "QK_OUTPUT_2P4GHZ"}, | ||
| 570 | {QK_OUTPUT_BLUETOOTH, "QK_OUTPUT_BLUETOOTH"}, | ||
| 571 | {QK_BLUETOOTH_PROFILE_NEXT, "QK_BLUETOOTH_PROFILE_NEXT"}, | ||
| 572 | {QK_BLUETOOTH_PROFILE_PREV, "QK_BLUETOOTH_PROFILE_PREV"}, | ||
| 573 | {QK_BLUETOOTH_UNPAIR, "QK_BLUETOOTH_UNPAIR"}, | ||
| 574 | {QK_BLUETOOTH_PROFILE1, "QK_BLUETOOTH_PROFILE1"}, | ||
| 575 | {QK_BLUETOOTH_PROFILE2, "QK_BLUETOOTH_PROFILE2"}, | ||
| 576 | {QK_BLUETOOTH_PROFILE3, "QK_BLUETOOTH_PROFILE3"}, | ||
| 577 | {QK_BLUETOOTH_PROFILE4, "QK_BLUETOOTH_PROFILE4"}, | ||
| 578 | {QK_BLUETOOTH_PROFILE5, "QK_BLUETOOTH_PROFILE5"}, | ||
| 565 | {QK_BACKLIGHT_ON, "QK_BACKLIGHT_ON"}, | 579 | {QK_BACKLIGHT_ON, "QK_BACKLIGHT_ON"}, |
| 566 | {QK_BACKLIGHT_OFF, "QK_BACKLIGHT_OFF"}, | 580 | {QK_BACKLIGHT_OFF, "QK_BACKLIGHT_OFF"}, |
| 567 | {QK_BACKLIGHT_TOGGLE, "QK_BACKLIGHT_TOGGLE"}, | 581 | {QK_BACKLIGHT_TOGGLE, "QK_BACKLIGHT_TOGGLE"}, |
| @@ -632,9 +646,6 @@ std::map<uint16_t, std::string> KEYCODE_ID_TABLE = { | |||
| 632 | {QK_SPACE_CADET_LEFT_ALT_PARENTHESIS_OPEN, "QK_SPACE_CADET_LEFT_ALT_PARENTHESIS_OPEN"}, | 646 | {QK_SPACE_CADET_LEFT_ALT_PARENTHESIS_OPEN, "QK_SPACE_CADET_LEFT_ALT_PARENTHESIS_OPEN"}, |
| 633 | {QK_SPACE_CADET_RIGHT_ALT_PARENTHESIS_CLOSE, "QK_SPACE_CADET_RIGHT_ALT_PARENTHESIS_CLOSE"}, | 647 | {QK_SPACE_CADET_RIGHT_ALT_PARENTHESIS_CLOSE, "QK_SPACE_CADET_RIGHT_ALT_PARENTHESIS_CLOSE"}, |
| 634 | {QK_SPACE_CADET_RIGHT_SHIFT_ENTER, "QK_SPACE_CADET_RIGHT_SHIFT_ENTER"}, | 648 | {QK_SPACE_CADET_RIGHT_SHIFT_ENTER, "QK_SPACE_CADET_RIGHT_SHIFT_ENTER"}, |
| 635 | {QK_OUTPUT_AUTO, "QK_OUTPUT_AUTO"}, | ||
| 636 | {QK_OUTPUT_USB, "QK_OUTPUT_USB"}, | ||
| 637 | {QK_OUTPUT_BLUETOOTH, "QK_OUTPUT_BLUETOOTH"}, | ||
| 638 | {QK_UNICODE_MODE_NEXT, "QK_UNICODE_MODE_NEXT"}, | 649 | {QK_UNICODE_MODE_NEXT, "QK_UNICODE_MODE_NEXT"}, |
| 639 | {QK_UNICODE_MODE_PREVIOUS, "QK_UNICODE_MODE_PREVIOUS"}, | 650 | {QK_UNICODE_MODE_PREVIOUS, "QK_UNICODE_MODE_PREVIOUS"}, |
| 640 | {QK_UNICODE_MODE_MACOS, "QK_UNICODE_MODE_MACOS"}, | 651 | {QK_UNICODE_MODE_MACOS, "QK_UNICODE_MODE_MACOS"}, |
