Compare commits

...

8 Commits

Author SHA1 Message Date
Nick Brassel
4bce7fef31
Comments. 2024-08-13 11:52:44 +10:00
Nick Brassel
2577f05cb3
Update documentation for keys that are actually handled. 2024-08-13 11:50:54 +10:00
Nick Brassel
89ac5cb0ff
Review comments. 2024-08-13 11:35:18 +10:00
Nick Brassel
64d626864a
Keycode processing migration+stubs. 2024-08-07 17:46:45 +10:00
Nick Brassel
7f9d61fe21
Mirror Bluetooth profiles and provide a NONE output (i.e. unpaired). 2024-08-07 17:27:01 +10:00
Nick Brassel
0c12f74c5c
Remove CX_xxxx keycodes, keeping OU_xxxx. 2024-08-07 17:19:23 +10:00
Nick Brassel
d88048cc93
Keycodes for cycling output. 2024-08-07 17:17:08 +10:00
Nick Brassel
22c9c8c87e
Add new connection keycodes for Bluetooth, 2.4GHz. 2024-08-07 14:26:31 +10:00
11 changed files with 226 additions and 32 deletions

View File

@ -881,7 +881,7 @@ ifeq ($(strip $(BLUETOOTH_ENABLE)), yes)
OPT_DEFS += -DBLUETOOTH_$(strip $(shell echo $(BLUETOOTH_DRIVER) | tr '[:lower:]' '[:upper:]'))
NO_USB_STARTUP_CHECK := yes
COMMON_VPATH += $(DRIVER_PATH)/bluetooth
SRC += outputselect.c
SRC += outputselect.c process_connection.c
ifeq ($(strip $(BLUETOOTH_DRIVER)), bluefruit_le)
SPI_DRIVER_REQUIRED = yes

View File

@ -0,0 +1,109 @@
{
"ranges": {
"0x7780/0x003F": {
"define": "QK_CONNECTION"
}
}
"keycodes": {
"0x7780": {
"group": "connection",
"key": "QK_OUTPUT_NEXT",
"aliases": [
"OU_NEXT",
"OU_AUTO"
]
},
"0x7781": {
"group": "connection",
"key": "QK_OUTPUT_PREV",
"aliases": [
"OU_PREV"
]
},
"0x7782": {
"group": "connection",
"key": "QK_OUTPUT_NONE",
"aliases": [
"OU_NONE"
]
},
"0x7783": {
"group": "connection",
"key": "QK_OUTPUT_USB",
"aliases": [
"OU_USB"
]
},
"0x7784": {
"group": "connection",
"key": "QK_OUTPUT_2P4GHZ",
"aliases": [
"OU_2P4G"
]
},
"0x7785": {
"group": "connection",
"key": "QK_OUTPUT_BLUETOOTH",
"aliases": [
"OU_BT"
]
},
"0x7790": {
"group": "connection",
"key": "QK_BLUETOOTH_PROFILE_NEXT",
"aliases": [
"BT_NEXT"
]
},
"0x7791": {
"group": "connection",
"key": "QK_BLUETOOTH_PROFILE_PREV",
"aliases": [
"BT_PREV"
]
},
"0x7792": {
"group": "connection",
"key": "QK_BLUETOOTH_UNPAIR",
"aliases": [
"BT_UNPR"
]
}
"0x7793": {
"group": "connection",
"key": "QK_BLUETOOTH_PROFILE1",
"aliases": [
"BT_PRF1"
]
},
"0x7794": {
"group": "connection",
"key": "QK_BLUETOOTH_PROFILE2",
"aliases": [
"BT_PRF2"
]
},
"0x7795": {
"group": "connection",
"key": "QK_BLUETOOTH_PROFILE3",
"aliases": [
"BT_PRF3"
]
},
"0x7796": {
"group": "connection",
"key": "QK_BLUETOOTH_PROFILE4",
"aliases": [
"BT_PRF4"
]
},
"0x7797": {
"group": "connection",
"key": "QK_BLUETOOTH_PROFILE5",
"aliases": [
"BT_PRF5"
]
},
}
}

View File

@ -0,0 +1,7 @@
{
"keycodes": {
"0x7C20": "!delete!", // old QK_OUTPUT_AUTO
"0x7C21": "!delete!", // old QK_OUTPUT_USB
"0x7C22": "!delete!", // old QK_OUTPUT_BLUETOOTH
}
}

View File

@ -39,8 +39,8 @@ BLUETOOTH_DRIVER = bluefruit_le # or rn42
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.
|Key |Aliases |Description |
|---------------------|---------|----------------------------------------------|
|`QK_OUTPUT_AUTO` |`OU_AUTO`|Automatically switch between USB and Bluetooth|
|`QK_OUTPUT_USB` |`OU_USB` |USB only |
|`QK_OUTPUT_BLUETOOTH`|`OU_BT` |Bluetooth only |
| Key | Aliases | Description |
|-----------------------|----------------------|------------------------------------------------|
| `QK_OUTPUT_NEXT` | `OU_NEXT`, `OU_AUTO` | Automatically switch between USB and Bluetooth |
| `QK_OUTPUT_USB` | `OU_USB` | USB only |
| `QK_OUTPUT_BLUETOOTH` | `OU_BT` | Bluetooth only |

View File

@ -294,11 +294,11 @@ See also: [Backlighting](features/backlight)
See also: [Bluetooth](features/bluetooth)
|Key |Aliases |Description |
|---------------------|---------|----------------------------------------------|
|`QK_OUTPUT_AUTO` |`OU_AUTO`|Automatically switch between USB and Bluetooth|
|`QK_OUTPUT_USB` |`OU_USB` |USB only |
|`QK_OUTPUT_BLUETOOTH`|`OU_BT` |Bluetooth only |
| Key | Aliases | Description |
|-----------------------|----------------------|------------------------------------------------|
| `QK_OUTPUT_NEXT` | `OU_NEXT`, `OU_AUTO` | Automatically switch between USB and Bluetooth |
| `QK_OUTPUT_USB` | `OU_USB` | USB only |
| `QK_OUTPUT_BLUETOOTH` | `OU_BT` | Bluetooth only |
## Caps Word {#caps-word}

View File

@ -72,6 +72,8 @@ enum qk_keycode_ranges {
QK_STENO_MAX = 0x74FF,
QK_MACRO = 0x7700,
QK_MACRO_MAX = 0x777F,
QK_CONNECTION = 0x7780,
QK_CONNECTION_MAX = 0x77BF,
QK_LIGHTING = 0x7800,
QK_LIGHTING_MAX = 0x78FF,
QK_QUANTUM = 0x7C00,
@ -620,6 +622,20 @@ enum qk_keycode_defines {
QK_MACRO_29 = 0x771D,
QK_MACRO_30 = 0x771E,
QK_MACRO_31 = 0x771F,
QK_OUTPUT_NEXT = 0x7780,
QK_OUTPUT_PREV = 0x7781,
QK_OUTPUT_NONE = 0x7782,
QK_OUTPUT_USB = 0x7783,
QK_OUTPUT_2P4GHZ = 0x7784,
QK_OUTPUT_BLUETOOTH = 0x7785,
QK_BLUETOOTH_PROFILE_NEXT = 0x7790,
QK_BLUETOOTH_PROFILE_PREV = 0x7791,
QK_BLUETOOTH_UNPAIR = 0x7792,
QK_BLUETOOTH_PROFILE1 = 0x7793,
QK_BLUETOOTH_PROFILE2 = 0x7794,
QK_BLUETOOTH_PROFILE3 = 0x7795,
QK_BLUETOOTH_PROFILE4 = 0x7796,
QK_BLUETOOTH_PROFILE5 = 0x7797,
QK_BACKLIGHT_ON = 0x7800,
QK_BACKLIGHT_OFF = 0x7801,
QK_BACKLIGHT_TOGGLE = 0x7802,
@ -690,9 +706,6 @@ enum qk_keycode_defines {
QK_SPACE_CADET_LEFT_ALT_PARENTHESIS_OPEN = 0x7C1C,
QK_SPACE_CADET_RIGHT_ALT_PARENTHESIS_CLOSE = 0x7C1D,
QK_SPACE_CADET_RIGHT_SHIFT_ENTER = 0x7C1E,
QK_OUTPUT_AUTO = 0x7C20,
QK_OUTPUT_USB = 0x7C21,
QK_OUTPUT_BLUETOOTH = 0x7C22,
QK_UNICODE_MODE_NEXT = 0x7C30,
QK_UNICODE_MODE_PREVIOUS = 0x7C31,
QK_UNICODE_MODE_MACOS = 0x7C32,
@ -1296,6 +1309,21 @@ enum qk_keycode_defines {
MC_29 = QK_MACRO_29,
MC_30 = QK_MACRO_30,
MC_31 = QK_MACRO_31,
OU_NEXT = QK_OUTPUT_NEXT,
OU_AUTO = QK_OUTPUT_NEXT,
OU_PREV = QK_OUTPUT_PREV,
OU_NONE = QK_OUTPUT_NONE,
OU_USB = QK_OUTPUT_USB,
OU_2P4G = QK_OUTPUT_2P4GHZ,
OU_BT = QK_OUTPUT_BLUETOOTH,
BT_NEXT = QK_BLUETOOTH_PROFILE_NEXT,
BT_PREV = QK_BLUETOOTH_PROFILE_PREV,
BT_UNPR = QK_BLUETOOTH_UNPAIR,
BT_PRF1 = QK_BLUETOOTH_PROFILE1,
BT_PRF2 = QK_BLUETOOTH_PROFILE2,
BT_PRF3 = QK_BLUETOOTH_PROFILE3,
BT_PRF4 = QK_BLUETOOTH_PROFILE4,
BT_PRF5 = QK_BLUETOOTH_PROFILE5,
BL_ON = QK_BACKLIGHT_ON,
BL_OFF = QK_BACKLIGHT_OFF,
BL_TOGG = QK_BACKLIGHT_TOGGLE,
@ -1365,9 +1393,6 @@ enum qk_keycode_defines {
SC_LAPO = QK_SPACE_CADET_LEFT_ALT_PARENTHESIS_OPEN,
SC_RAPC = QK_SPACE_CADET_RIGHT_ALT_PARENTHESIS_CLOSE,
SC_SENT = QK_SPACE_CADET_RIGHT_SHIFT_ENTER,
OU_AUTO = QK_OUTPUT_AUTO,
OU_USB = QK_OUTPUT_USB,
OU_BT = QK_OUTPUT_BLUETOOTH,
UC_NEXT = QK_UNICODE_MODE_NEXT,
UC_PREV = QK_UNICODE_MODE_PREVIOUS,
UC_MAC = QK_UNICODE_MODE_MACOS,
@ -1444,6 +1469,7 @@ enum qk_keycode_defines {
#define IS_QK_AUDIO(code) ((code) >= QK_AUDIO && (code) <= QK_AUDIO_MAX)
#define IS_QK_STENO(code) ((code) >= QK_STENO && (code) <= QK_STENO_MAX)
#define IS_QK_MACRO(code) ((code) >= QK_MACRO && (code) <= QK_MACRO_MAX)
#define IS_QK_CONNECTION(code) ((code) >= QK_CONNECTION && (code) <= QK_CONNECTION_MAX)
#define IS_QK_LIGHTING(code) ((code) >= QK_LIGHTING && (code) <= QK_LIGHTING_MAX)
#define IS_QK_QUANTUM(code) ((code) >= QK_QUANTUM && (code) <= QK_QUANTUM_MAX)
#define IS_QK_KB(code) ((code) >= QK_KB && (code) <= QK_KB_MAX)
@ -1468,6 +1494,7 @@ enum qk_keycode_defines {
#define IS_AUDIO_KEYCODE(code) ((code) >= QK_AUDIO_ON && (code) <= QK_AUDIO_VOICE_PREVIOUS)
#define IS_STENO_KEYCODE(code) ((code) >= QK_STENO_BOLT && (code) <= QK_STENO_COMB_MAX)
#define IS_MACRO_KEYCODE(code) ((code) >= QK_MACRO_0 && (code) <= QK_MACRO_31)
#define IS_CONNECTION_KEYCODE(code) ((code) >= QK_OUTPUT_NEXT && (code) <= QK_BLUETOOTH_PROFILE5)
#define IS_BACKLIGHT_KEYCODE(code) ((code) >= QK_BACKLIGHT_ON && (code) <= QK_BACKLIGHT_TOGGLE_BREATHING)
#define IS_LED_MATRIX_KEYCODE(code) ((code) >= QK_LED_MATRIX_ON && (code) <= QK_LED_MATRIX_SPEED_DOWN)
#define IS_UNDERGLOW_KEYCODE(code) ((code) >= QK_UNDERGLOW_TOGGLE && (code) <= QK_UNDERGLOW_SPEED_DOWN)
@ -1493,6 +1520,7 @@ enum qk_keycode_defines {
#define AUDIO_KEYCODE_RANGE QK_AUDIO_ON ... QK_AUDIO_VOICE_PREVIOUS
#define STENO_KEYCODE_RANGE QK_STENO_BOLT ... QK_STENO_COMB_MAX
#define MACRO_KEYCODE_RANGE QK_MACRO_0 ... QK_MACRO_31
#define CONNECTION_KEYCODE_RANGE QK_OUTPUT_NEXT ... QK_BLUETOOTH_PROFILE5
#define BACKLIGHT_KEYCODE_RANGE QK_BACKLIGHT_ON ... QK_BACKLIGHT_TOGGLE_BREATHING
#define LED_MATRIX_KEYCODE_RANGE QK_LED_MATRIX_ON ... QK_LED_MATRIX_SPEED_DOWN
#define UNDERGLOW_KEYCODE_RANGE QK_UNDERGLOW_TOGGLE ... QK_UNDERGLOW_SPEED_DOWN

View File

@ -0,0 +1,36 @@
// Copyright 2024 Nick Brassel (@tzarc)
// SPDX-License-Identifier: GPL-2.0-or-later
#include "outputselect.h"
#include "process_connection.h"
bool process_connection(uint16_t keycode, keyrecord_t *record) {
if (record->event.pressed) {
switch (keycode) {
case QK_OUTPUT_NEXT:
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.
return false;
case QK_OUTPUT_USB:
set_output(OUTPUT_USB);
return false;
case QK_OUTPUT_BLUETOOTH:
set_output(OUTPUT_BLUETOOTH);
return false;
case QK_OUTPUT_PREV:
case QK_OUTPUT_NONE:
case QK_OUTPUT_2P4GHZ:
case QK_BLUETOOTH_PROFILE_NEXT:
case QK_BLUETOOTH_PROFILE_PREV:
case QK_BLUETOOTH_UNPAIR:
case QK_BLUETOOTH_PROFILE1:
case QK_BLUETOOTH_PROFILE2:
case QK_BLUETOOTH_PROFILE3:
case QK_BLUETOOTH_PROFILE4:
case QK_BLUETOOTH_PROFILE5:
// As-yet unimplemented.
// When implementation is done, ensure `docs/keycodes.md`, `docs/features/bluetooth.md` are updated accordingly.
return false;
}
}
return true;
}

View File

@ -0,0 +1,9 @@
// Copyright 2024 Nick Brassel (@tzarc)
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include <stdint.h>
#include <stdbool.h>
#include "action.h"
bool process_connection(uint16_t keycode, keyrecord_t *record);

View File

@ -21,7 +21,7 @@
#endif
#ifdef BLUETOOTH_ENABLE
# include "outputselect.h"
# include "process_connection.h"
#endif
#ifdef GRAVE_ESC_ENABLE
@ -393,6 +393,9 @@ bool process_record_quantum(keyrecord_t *record) {
#endif
#ifdef TRI_LAYER_ENABLE
process_tri_layer(keycode, record) &&
#endif
#ifdef BLUETOOTH_ENABLE
process_connection(keycode, record) &&
#endif
true)) {
return false;
@ -431,17 +434,6 @@ bool process_record_quantum(keyrecord_t *record) {
velocikey_toggle();
return false;
#endif
#ifdef BLUETOOTH_ENABLE
case QK_OUTPUT_AUTO:
set_output(OUTPUT_AUTO);
return false;
case QK_OUTPUT_USB:
set_output(OUTPUT_USB);
return false;
case QK_OUTPUT_BLUETOOTH:
set_output(OUTPUT_BLUETOOTH);
return false;
#endif
#ifndef NO_ACTION_ONESHOT
case QK_ONE_SHOT_TOGGLE:
oneshot_toggle();

View File

@ -55,3 +55,5 @@
#define KC_ACL1 QK_MOUSE_ACCELERATION_1
#define KC_MS_ACCEL2 QK_MOUSE_ACCELERATION_2
#define KC_ACL2 QK_MOUSE_ACCELERATION_2
#define QK_OUTPUT_AUTO OU_AUTO

View File

@ -562,6 +562,20 @@ std::map<uint16_t, std::string> KEYCODE_ID_TABLE = {
{QK_MACRO_29, "QK_MACRO_29"},
{QK_MACRO_30, "QK_MACRO_30"},
{QK_MACRO_31, "QK_MACRO_31"},
{QK_OUTPUT_NEXT, "QK_OUTPUT_NEXT"},
{QK_OUTPUT_PREV, "QK_OUTPUT_PREV"},
{QK_OUTPUT_NONE, "QK_OUTPUT_NONE"},
{QK_OUTPUT_USB, "QK_OUTPUT_USB"},
{QK_OUTPUT_2P4GHZ, "QK_OUTPUT_2P4GHZ"},
{QK_OUTPUT_BLUETOOTH, "QK_OUTPUT_BLUETOOTH"},
{QK_BLUETOOTH_PROFILE_NEXT, "QK_BLUETOOTH_PROFILE_NEXT"},
{QK_BLUETOOTH_PROFILE_PREV, "QK_BLUETOOTH_PROFILE_PREV"},
{QK_BLUETOOTH_UNPAIR, "QK_BLUETOOTH_UNPAIR"},
{QK_BLUETOOTH_PROFILE1, "QK_BLUETOOTH_PROFILE1"},
{QK_BLUETOOTH_PROFILE2, "QK_BLUETOOTH_PROFILE2"},
{QK_BLUETOOTH_PROFILE3, "QK_BLUETOOTH_PROFILE3"},
{QK_BLUETOOTH_PROFILE4, "QK_BLUETOOTH_PROFILE4"},
{QK_BLUETOOTH_PROFILE5, "QK_BLUETOOTH_PROFILE5"},
{QK_BACKLIGHT_ON, "QK_BACKLIGHT_ON"},
{QK_BACKLIGHT_OFF, "QK_BACKLIGHT_OFF"},
{QK_BACKLIGHT_TOGGLE, "QK_BACKLIGHT_TOGGLE"},
@ -632,9 +646,6 @@ std::map<uint16_t, std::string> KEYCODE_ID_TABLE = {
{QK_SPACE_CADET_LEFT_ALT_PARENTHESIS_OPEN, "QK_SPACE_CADET_LEFT_ALT_PARENTHESIS_OPEN"},
{QK_SPACE_CADET_RIGHT_ALT_PARENTHESIS_CLOSE, "QK_SPACE_CADET_RIGHT_ALT_PARENTHESIS_CLOSE"},
{QK_SPACE_CADET_RIGHT_SHIFT_ENTER, "QK_SPACE_CADET_RIGHT_SHIFT_ENTER"},
{QK_OUTPUT_AUTO, "QK_OUTPUT_AUTO"},
{QK_OUTPUT_USB, "QK_OUTPUT_USB"},
{QK_OUTPUT_BLUETOOTH, "QK_OUTPUT_BLUETOOTH"},
{QK_UNICODE_MODE_NEXT, "QK_UNICODE_MODE_NEXT"},
{QK_UNICODE_MODE_PREVIOUS, "QK_UNICODE_MODE_PREVIOUS"},
{QK_UNICODE_MODE_MACOS, "QK_UNICODE_MODE_MACOS"},