Skip to content

Commit f86fc18

Browse files
committed
Reallocate SAFE_RANGE
1 parent 3bf01bb commit f86fc18

File tree

50 files changed

+31
-132
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+31
-132
lines changed

docs/configurator_default_keymaps.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -153,10 +153,9 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
153153
154154
```c
155155
enum keyboard_keycodes {
156-
CUSTOM_1 = SAFE_RANGE,
156+
CUSTOM_1 = QK_KB_0,
157157
CUSTOM_2,
158158
CUSTOM_3,
159-
NEW_SAFE_RANGE // Important!
160159
};
161160
```
162161

@@ -185,8 +184,7 @@ bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
185184
};
186185
```
187186
188-
Note the call to `process_record_user()` at the end. Additionally, users of the keyboard will need to use `NEW_SAFE_RANGE` instead of `SAFE_RANGE` if they wish to add their own custom keycodes at keymap level, beyond what is provided by the keyboard.
189-
187+
Note the call to `process_record_user()` at the end.
190188
191189
## Additional Reading :id=additional-reading
192190

keyboards/annepro2/annepro2.h

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ extern ble_capslock_t ble_capslock;
5959
// clang-format on
6060

6161
enum AP2KeyCodes {
62-
KC_AP2_BT1 = SAFE_RANGE,
62+
KC_AP2_BT1 = QK_KB_0,
6363
KC_AP2_BT2,
6464
KC_AP2_BT3,
6565
KC_AP2_BT4,
@@ -76,9 +76,4 @@ enum AP2KeyCodes {
7676
KC_AP_RGB_VAD,
7777
KC_AP_RGB_TOG,
7878
KC_AP_RGB_MOD,
79-
AP2_SAFE_RANGE,
8079
};
81-
82-
#undef SAFE_RANGE
83-
#define SAFE_RANGE AP2_SAFE_RANGE
84-

keyboards/bajjak/bajjak.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -117,16 +117,6 @@ inline void bajjak_led_all_set(uint8_t n) {
117117
bajjak_right_led_3_set(n);
118118
}
119119

120-
enum BAJJAK_ez_keycodes {
121-
LED_LEVEL = SAFE_RANGE,
122-
TOGGLE_LAYER_COLOR,
123-
EZ_SAFE_RANGE,
124-
};
125-
126-
#ifndef WEBUSB_ENABLE
127-
# define WEBUSB_PAIR KC_NO
128-
#endif
129-
130120
typedef union {
131121
uint32_t raw;
132122
struct {

keyboards/bastardkb/charybdis/charybdis.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ bool process_record_kb(uint16_t keycode, keyrecord_t* record) {
304304
}
305305
# endif // !NO_CHARYBDIS_KEYCODES
306306
# endif // POINTING_DEVICE_ENABLE
307-
if ((keycode >= POINTER_DEFAULT_DPI_FORWARD && keycode < CHARYBDIS_SAFE_RANGE) || IS_MOUSEKEY(keycode)) {
307+
if (IS_QK_KB(keycode) || IS_MOUSEKEY(keycode)) {
308308
debug_charybdis_config_to_console(&g_charybdis_config);
309309
}
310310
return true;

keyboards/bastardkb/charybdis/charybdis.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ enum charybdis_keycodes {
4343
SNIPING_MODE_TOGGLE,
4444
DRAGSCROLL_MODE,
4545
DRAGSCROLL_MODE_TOGGLE,
46-
CHARYBDIS_SAFE_RANGE,
4746
};
4847

4948
# define DPI_MOD POINTER_DEFAULT_DPI_FORWARD

keyboards/bastardkb/charybdis/readme.md

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -121,15 +121,14 @@ The Charybdis firmware defines a number of keycodes to leverage its features, na
121121
```
122122
#ifndef NO_CHARYBDIS_KEYCODES
123123
enum charybdis_keycodes {
124-
POINTER_DEFAULT_DPI_FORWARD = SAFE_RANGE,
124+
POINTER_DEFAULT_DPI_FORWARD = QK_KB_0,
125125
POINTER_DEFAULT_DPI_REVERSE,
126126
POINTER_SNIPING_DPI_FORWARD,
127127
POINTER_SNIPING_DPI_REVERSE,
128128
SNIPING_MODE,
129129
SNIPING_MODE_TOGGLE,
130130
DRAGSCROLL_MODE,
131131
DRAGSCROLL_MODE_TOGGLE,
132-
CHARYBDIS_SAFE_RANGE,
133132
};
134133

135134
#define DPI_MOD POINTER_DEFAULT_DPI_FORWARD
@@ -143,20 +142,6 @@ enum charybdis_keycodes {
143142
#endif // !NO_CHARYBDIS_KEYCODES
144143
```
145144

146-
Users extending the keycode set themselves (either in their keymap, or in their userspace) must start at `CHARYBDIS_SAFE_RANGE` to avoid conflicts, _eg._:
147-
148-
```c
149-
enum userspace_keycodes {
150-
#ifndef NO_CHARYBDIS_KEYCODES
151-
MY_FIRST_KEYCODE = CHARYBDIS_SAFE_RANGE,
152-
#else
153-
MY_FIRST_KEYCODE = SAFE_RANGE,
154-
#endif // !NO_CHARYBDIS_KEYCODES
155-
MY_SECOND_KEYCODE,
156-
157-
};
158-
```
159-
160145
To disable the custom keycodes, and reduce binary size, simply add a definition in `config.h`:
161146

162147
```c

keyboards/bastardkb/dilemma/dilemma.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ bool process_record_kb(uint16_t keycode, keyrecord_t* record) {
308308
# endif // !NO_DILEMMA_KEYCODES
309309
# endif // POINTING_DEVICE_ENABLE
310310
debug_dilemma_config_to_console(&g_dilemma_config);
311-
if ((keycode >= POINTER_DEFAULT_DPI_FORWARD && keycode < DILEMMA_SAFE_RANGE) || IS_MOUSEKEY(keycode)) {
311+
if (IS_QK_KB(keycode) || IS_MOUSEKEY(keycode)) {
312312
debug_dilemma_config_to_console(&g_dilemma_config);
313313
}
314314
return true;

keyboards/bastardkb/dilemma/dilemma.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ enum dilemma_keycodes {
4040
SNIPING_MODE_TOGGLE,
4141
DRAGSCROLL_MODE,
4242
DRAGSCROLL_MODE_TOGGLE,
43-
DILEMMA_SAFE_RANGE,
4443
};
4544

4645
# define DPI_MOD POINTER_DEFAULT_DPI_FORWARD

keyboards/clueboard/2x1800/2019/2019.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,12 @@
1818
#include "quantum.h"
1919

2020
enum TWOx1800_keycodes {
21-
ENC_BTN1 = SAFE_RANGE,
21+
ENC_BTN1 = QK_KB_0,
2222
ENC_BTN2,
2323
ENC_BTN3,
2424
ENC_BTN4,
25-
NEW_SAFE_RANGE
2625
};
2726

28-
#undef SAFE_RANGE
29-
#define SAFE_RANGE NEW_SAFE_RANGE
30-
3127
// Encoder update function that returns true/false
3228
bool encoder_update_keymap(uint8_t index, bool clockwise);
3329

keyboards/ergodox_ez/ergodox_ez.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,8 @@ inline void ergodox_led_all_set(uint8_t n) {
127127
}
128128

129129
enum ergodox_ez_keycodes {
130-
LED_LEVEL = SAFE_RANGE,
130+
LED_LEVEL = QK_KB_0,
131131
TOGGLE_LAYER_COLOR,
132-
EZ_SAFE_RANGE,
133132
};
134133

135134
#ifndef WEBUSB_ENABLE

0 commit comments

Comments
 (0)