Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reallocate user/kb keycode ranges #19907

Merged
merged 2 commits into from
Feb 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions data/constants/keycodes/keycodes_0.0.2.hjson
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
{
"ranges": {
"0x7E00/0x00FF": "!delete!",
"0x7F00/0x00FF": "!delete!",

"0x7E00/0x003F": {
"define": "QK_KB"
},
"0x7E40/0x01BF": {
"define": "QK_USER"
},
"0x8000/0X3FFF": {
"define": "QK_UNICODEMAP"
},
Expand Down
64 changes: 32 additions & 32 deletions data/constants/keycodes/keycodes_0.0.2_user.hjson
Original file line number Diff line number Diff line change
@@ -1,130 +1,130 @@
{
"keycodes": {
"0x7F00": {
"0x7E40": {
"group": "user",
"key": "QK_USER_0",
},
"0x7F01": {
"0x7E41": {
"group": "user",
"key": "QK_USER_1",
},
"0x7F02": {
"0x7E42": {
"group": "user",
"key": "QK_USER_2",
},
"0x7F03": {
"0x7E43": {
"group": "user",
"key": "QK_USER_3",
},
"0x7F04": {
"0x7E44": {
"group": "user",
"key": "QK_USER_4",
},
"0x7F05": {
"0x7E45": {
"group": "user",
"key": "QK_USER_5",
},
"0x7F06": {
"0x7E46": {
"group": "user",
"key": "QK_USER_6",
},
"0x7F07": {
"0x7E47": {
"group": "user",
"key": "QK_USER_7",
},
"0x7F08": {
"0x7E48": {
"group": "user",
"key": "QK_USER_8",
},
"0x7F09": {
"0x7E49": {
"group": "user",
"key": "QK_USER_9",
},
"0x7F0A": {
"0x7E4A": {
"group": "user",
"key": "QK_USER_10",
},
"0x7F0B": {
"0x7E4B": {
"group": "user",
"key": "QK_USER_11",
},
"0x7F0C": {
"0x7E4C": {
"group": "user",
"key": "QK_USER_12",
},
"0x7F0D": {
"0x7E4D": {
"group": "user",
"key": "QK_USER_13",
},
"0x7F0E": {
"0x7E4E": {
"group": "user",
"key": "QK_USER_14",
},
"0x7F0F": {
"0x7E4F": {
"group": "user",
"key": "QK_USER_15",
},
"0x7F10": {
"0x7E50": {
"group": "user",
"key": "QK_USER_16",
},
"0x7F11": {
"0x7E51": {
"group": "user",
"key": "QK_USER_17",
},
"0x7F12": {
"0x7E52": {
"group": "user",
"key": "QK_USER_18",
},
"0x7F13": {
"0x7E53": {
"group": "user",
"key": "QK_USER_19",
},
"0x7F14": {
"0x7E54": {
"group": "user",
"key": "QK_USER_20",
},
"0x7F15": {
"0x7E55": {
"group": "user",
"key": "QK_USER_21",
},
"0x7F16": {
"0x7E56": {
"group": "user",
"key": "QK_USER_22",
},
"0x7F17": {
"0x7E57": {
"group": "user",
"key": "QK_USER_23",
},
"0x7F18": {
"0x7E58": {
"group": "user",
"key": "QK_USER_24",
},
"0x7F19": {
"0x7E59": {
"group": "user",
"key": "QK_USER_25",
},
"0x7F1A": {
"0x7E5A": {
"group": "user",
"key": "QK_USER_26",
},
"0x7F1B": {
"0x7E5B": {
"group": "user",
"key": "QK_USER_27",
},
"0x7F1C": {
"0x7E5C": {
"group": "user",
"key": "QK_USER_28",
},
"0x7F1D": {
"0x7E5D": {
"group": "user",
"key": "QK_USER_29",
},
"0x7F1E": {
"0x7E5E": {
"group": "user",
"key": "QK_USER_30",
},
"0x7F1F": {
"0x7E5F": {
"group": "user",
"key": "QK_USER_31",
},
Expand Down
3 changes: 3 additions & 0 deletions lib/python/qmk/json_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ def deep_update(origdict, newdict):
def merge_ordered_dicts(dicts):
"""Merges nested OrderedDict objects resulting from reading a hjson file.
Later input dicts overrides earlier dicts for plain values.
If any value is "!delete!", the existing value will be removed from its parent.
Arrays will be appended. If the first entry of an array is "!reset!", the contents of the array will be cleared and replaced with RHS.
Dictionaries will be recursively merged. If any entry is "!reset!", the contents of the dictionary will be cleared and replaced with RHS.
"""
Expand All @@ -125,6 +126,8 @@ def add_entry(target, k, v):
target[k] = v[1:]
else:
target[k] = target[k] + v
elif v == "!delete!" and isinstance(target, (OrderedDict, dict)):
del target[k]
else:
target[k] = v

Expand Down
1 change: 1 addition & 0 deletions lib/python/qmk/keycodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ def load_spec(version, lang=None):

# Sort?
spec['keycodes'] = dict(sorted(spec.get('keycodes', {}).items()))
spec['ranges'] = dict(sorted(spec.get('ranges', {}).items()))

# Validate?
_validate(spec)
Expand Down
74 changes: 37 additions & 37 deletions quantum/keycodes.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,13 @@ enum qk_keycode_ranges {
QK_QUANTUM = 0x7C00,
QK_QUANTUM_MAX = 0x7DFF,
QK_KB = 0x7E00,
QK_KB_MAX = 0x7EFF,
QK_USER = 0x7F00,
QK_KB_MAX = 0x7E3F,
QK_USER = 0x7E40,
QK_USER_MAX = 0x7FFF,
QK_UNICODE = 0x8000,
QK_UNICODE_MAX = 0xFFFF,
QK_UNICODEMAP = 0x8000,
QK_UNICODEMAP_MAX = 0xBFFF,
QK_UNICODE = 0x8000,
QK_UNICODE_MAX = 0xFFFF,
QK_UNICODEMAP_PAIR = 0xC000,
QK_UNICODEMAP_PAIR_MAX = 0xFFFF,
};
Expand Down Expand Up @@ -753,38 +753,38 @@ enum qk_keycode_defines {
QK_KB_29 = 0x7E1D,
QK_KB_30 = 0x7E1E,
QK_KB_31 = 0x7E1F,
QK_USER_0 = 0x7F00,
QK_USER_1 = 0x7F01,
QK_USER_2 = 0x7F02,
QK_USER_3 = 0x7F03,
QK_USER_4 = 0x7F04,
QK_USER_5 = 0x7F05,
QK_USER_6 = 0x7F06,
QK_USER_7 = 0x7F07,
QK_USER_8 = 0x7F08,
QK_USER_9 = 0x7F09,
QK_USER_10 = 0x7F0A,
QK_USER_11 = 0x7F0B,
QK_USER_12 = 0x7F0C,
QK_USER_13 = 0x7F0D,
QK_USER_14 = 0x7F0E,
QK_USER_15 = 0x7F0F,
QK_USER_16 = 0x7F10,
QK_USER_17 = 0x7F11,
QK_USER_18 = 0x7F12,
QK_USER_19 = 0x7F13,
QK_USER_20 = 0x7F14,
QK_USER_21 = 0x7F15,
QK_USER_22 = 0x7F16,
QK_USER_23 = 0x7F17,
QK_USER_24 = 0x7F18,
QK_USER_25 = 0x7F19,
QK_USER_26 = 0x7F1A,
QK_USER_27 = 0x7F1B,
QK_USER_28 = 0x7F1C,
QK_USER_29 = 0x7F1D,
QK_USER_30 = 0x7F1E,
QK_USER_31 = 0x7F1F,
QK_USER_0 = 0x7E40,
QK_USER_1 = 0x7E41,
QK_USER_2 = 0x7E42,
QK_USER_3 = 0x7E43,
QK_USER_4 = 0x7E44,
QK_USER_5 = 0x7E45,
QK_USER_6 = 0x7E46,
QK_USER_7 = 0x7E47,
QK_USER_8 = 0x7E48,
QK_USER_9 = 0x7E49,
QK_USER_10 = 0x7E4A,
QK_USER_11 = 0x7E4B,
QK_USER_12 = 0x7E4C,
QK_USER_13 = 0x7E4D,
QK_USER_14 = 0x7E4E,
QK_USER_15 = 0x7E4F,
QK_USER_16 = 0x7E50,
QK_USER_17 = 0x7E51,
QK_USER_18 = 0x7E52,
QK_USER_19 = 0x7E53,
QK_USER_20 = 0x7E54,
QK_USER_21 = 0x7E55,
QK_USER_22 = 0x7E56,
QK_USER_23 = 0x7E57,
QK_USER_24 = 0x7E58,
QK_USER_25 = 0x7E59,
QK_USER_26 = 0x7E5A,
QK_USER_27 = 0x7E5B,
QK_USER_28 = 0x7E5C,
QK_USER_29 = 0x7E5D,
QK_USER_30 = 0x7E5E,
QK_USER_31 = 0x7E5F,

// Alias
XXXXXXX = KC_NO,
Expand Down Expand Up @@ -1391,8 +1391,8 @@ enum qk_keycode_defines {
#define IS_QK_QUANTUM(code) ((code) >= QK_QUANTUM && (code) <= QK_QUANTUM_MAX)
#define IS_QK_KB(code) ((code) >= QK_KB && (code) <= QK_KB_MAX)
#define IS_QK_USER(code) ((code) >= QK_USER && (code) <= QK_USER_MAX)
#define IS_QK_UNICODE(code) ((code) >= QK_UNICODE && (code) <= QK_UNICODE_MAX)
#define IS_QK_UNICODEMAP(code) ((code) >= QK_UNICODEMAP && (code) <= QK_UNICODEMAP_MAX)
#define IS_QK_UNICODE(code) ((code) >= QK_UNICODE && (code) <= QK_UNICODE_MAX)
#define IS_QK_UNICODEMAP_PAIR(code) ((code) >= QK_UNICODEMAP_PAIR && (code) <= QK_UNICODEMAP_PAIR_MAX)

// Group Helpers
Expand Down