mirror of
https://github.com/Keychron/qmk_firmware.git
synced 2024-11-25 01:47:10 +06:00
Format DD mappings and schemas (#18924)
This commit is contained in:
parent
ce80a3ad46
commit
479d8de622
|
@ -1,15 +1,15 @@
|
|||
# This file maps keys between `config.h` and `info.json`. It is used by QMK
|
||||
# to correctly and consistently map back and forth between the two systems.
|
||||
// This file maps keys between `config.h` and `info.json`. It is used by QMK
|
||||
// to correctly and consistently map back and forth between the two systems.
|
||||
{
|
||||
# Format:
|
||||
# <config.h key>: {"info_key": <info.json key>, ["value_type": <value_type>], ["to_json": <true/false>], ["to_c": <true/false>]}
|
||||
# value_type: one of "array", "array.int", "bool", "int", "hex", "list", "mapping", "str", "raw"
|
||||
# to_json: Default `true`. Set to `false` to exclude this mapping from info.json
|
||||
# to_c: Default `true`. Set to `false` to exclude this mapping from config.h
|
||||
# warn_duplicate: Default `true`. Set to `false` to turn off warning when a value exists in both places
|
||||
# deprecated: Default `false`. Set to `true` to turn on warning when a value exists
|
||||
# invalid: Default `false`. Set to `true` to generate errors when a value exists
|
||||
# replace_with: use with a key marked deprecated or invalid to designate a replacement
|
||||
// Format:
|
||||
// <config.h key>: {"info_key": <info.json key>, ["value_type": <value_type>], ["to_json": <true/false>], ["to_c": <true/false>]}
|
||||
// value_type: one of "array", "array.int", "bool", "int", "hex", "list", "mapping", "str", "raw"
|
||||
// to_json: Default `true`. Set to `false` to exclude this mapping from info.json
|
||||
// to_c: Default `true`. Set to `false` to exclude this mapping from config.h
|
||||
// warn_duplicate: Default `true`. Set to `false` to turn off warning when a value exists in both places
|
||||
// deprecated: Default `false`. Set to `true` to turn on warning when a value exists
|
||||
// invalid: Default `false`. Set to `true` to generate errors when a value exists
|
||||
// replace_with: use with a key marked deprecated or invalid to designate a replacement
|
||||
"AUDIO_VOICES": {"info_key": "audio.voices", "value_type": "bool"},
|
||||
"BACKLIGHT_BREATHING": {"info_key": "backlight.breathing", "value_type": "bool"},
|
||||
"BREATHING_PERIOD": {"info_key": "backlight.breathing_period", "value_type": "int"},
|
||||
|
@ -118,7 +118,7 @@
|
|||
"USB_POLLING_INTERVAL_MS": {"info_key": "usb.polling_interval", "value_type": "int"},
|
||||
"USB_SUSPEND_WAKEUP_DELAY": {"info_key": "usb.suspend_wakeup_delay", "value_type": "int"},
|
||||
|
||||
# Items we want flagged in lint
|
||||
// Items we want flagged in lint
|
||||
"NO_ACTION_MACRO": {"info_key": "_invalid.no_action_macro", "invalid": true},
|
||||
"NO_ACTION_FUNCTION": {"info_key": "_invalid.no_action_function", "invalid": true},
|
||||
"DESCRIPTION": {"info_key": "_invalid.usb_description", "invalid": true},
|
|
@ -1,15 +1,15 @@
|
|||
# This file maps keys between `rules.mk` and `info.json`. It is used by QMK
|
||||
# to correctly and consistently map back and forth between the two systems.
|
||||
// This file maps keys between `rules.mk` and `info.json`. It is used by QMK
|
||||
// to correctly and consistently map back and forth between the two systems.
|
||||
{
|
||||
# Format:
|
||||
# <rules.mk key>: {"info_key": <info.json key>, ["value_type": <value_type>], ["to_json": <true/false>], ["to_c": <true/false>]}
|
||||
# value_type: one of "array", "array.int", "bool", "int", "list", "hex", "mapping", "str", "raw"
|
||||
# to_json: Default `true`. Set to `false` to exclude this mapping from info.json
|
||||
# to_c: Default `true`. Set to `false` to exclude this mapping from rules.mk
|
||||
# warn_duplicate: Default `true`. Set to `false` to turn off warning when a value exists in both places
|
||||
# deprecated: Default `false`. Set to `true` to turn on warning when a value exists
|
||||
# invalid: Default `false`. Set to `true` to generate errors when a value exists
|
||||
# replace_with: use with a key marked deprecated or invalid to designate a replacement
|
||||
// Format:
|
||||
// <rules.mk key>: {"info_key": <info.json key>, ["value_type": <value_type>], ["to_json": <true/false>], ["to_c": <true/false>]}
|
||||
// value_type: one of "array", "array.int", "bool", "int", "list", "hex", "mapping", "str", "raw"
|
||||
// to_json: Default `true`. Set to `false` to exclude this mapping from info.json
|
||||
// to_c: Default `true`. Set to `false` to exclude this mapping from rules.mk
|
||||
// warn_duplicate: Default `true`. Set to `false` to turn off warning when a value exists in both places
|
||||
// deprecated: Default `false`. Set to `true` to turn on warning when a value exists
|
||||
// invalid: Default `false`. Set to `true` to generate errors when a value exists
|
||||
// replace_with: use with a key marked deprecated or invalid to designate a replacement
|
||||
"BOARD": {"info_key": "board"},
|
||||
"BOOTLOADER": {"info_key": "bootloader", "warn_duplicate": false},
|
||||
"BLUETOOTH_DRIVER": {"info_key": "bluetooth.driver"},
|
||||
|
@ -37,7 +37,7 @@
|
|||
"PS2_MOUSE_ENABLE": {"info_key": "ps2.mouse_enabled", "value_type": "bool"},
|
||||
"PS2_DRIVER": {"info_key": "ps2.driver"},
|
||||
|
||||
# Items we want flagged in lint
|
||||
// Items we want flagged in lint
|
||||
"CTPC": {"info_key": "_deprecated.ctpc", "deprecated": true, "replace_with": "CONVERT_TO=proton_c"},
|
||||
"CONVERT_TO_PROTON_C": {"info_key": "_deprecated.ctpc", "deprecated": true, "replace_with": "CONVERT_TO=proton_c"},
|
||||
"VIAL_ENABLE": {"info_key": "_invalid.vial", "invalid": true}
|
1252
data/mappings/keyboard_aliases.hjson
Normal file
1252
data/mappings/keyboard_aliases.hjson
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -601,7 +601,10 @@
|
|||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"device_ver": {"$ref": "qmk.definitions.v1#/hex_number_4d"}, # Deprecated
|
||||
"device_ver": {
|
||||
"$ref": "qmk.definitions.v1#/hex_number_4d",
|
||||
"$comment": "Deprecated: use device_version instead"
|
||||
},
|
||||
"device_version": {"$ref": "qmk.definitions.v1#/bcd_version"},
|
||||
"force_nkro": {"type": "boolean"},
|
||||
"pid": {"$ref": "qmk.definitions.v1#/hex_number_4d"},
|
||||
|
|
|
@ -41,7 +41,7 @@ In other cases you should group like options together in an `object`. This is pa
|
|||
|
||||
### Add a mapping
|
||||
|
||||
In most cases you can add a simple mapping. These are maintained as JSON files in `data/mappings/info_config.json` and `data/mappings/info_rules.json`, and control mapping for `config.h` and `rules.mk`, respectively. Each mapping is keyed by the `config.h` or `rules.mk` variable, and the value is a hash with the following keys:
|
||||
In most cases you can add a simple mapping. These are maintained as JSON files in `data/mappings/info_config.hjson` and `data/mappings/info_rules.hjson`, and control mapping for `config.h` and `rules.mk`, respectively. Each mapping is keyed by the `config.h` or `rules.mk` variable, and the value is a hash with the following keys:
|
||||
|
||||
* `info_key`: (required) The location within `info.json` for this value. See below.
|
||||
* `value_type`: (optional) Default `raw`. The format for this variable's value. See below.
|
||||
|
|
|
@ -98,7 +98,7 @@ def generate_api(cli):
|
|||
|
||||
# Generate data for the global files
|
||||
keyboard_list = sorted(kb_all)
|
||||
keyboard_aliases = json_load(Path('data/mappings/keyboard_aliases.json'))
|
||||
keyboard_aliases = json_load(Path('data/mappings/keyboard_aliases.hjson'))
|
||||
keyboard_metadata = {
|
||||
'last_updated': current_datetime(),
|
||||
'keyboards': keyboard_list,
|
||||
|
|
|
@ -70,7 +70,7 @@ def generate_matrix_size(kb_info_json, config_h_lines):
|
|||
def generate_config_items(kb_info_json, config_h_lines):
|
||||
"""Iterate through the info_config map to generate basic config values.
|
||||
"""
|
||||
info_config_map = json_load(Path('data/mappings/info_config.json'))
|
||||
info_config_map = json_load(Path('data/mappings/info_config.hjson'))
|
||||
|
||||
for config_key, info_dict in info_config_map.items():
|
||||
info_key = info_dict['info_key']
|
||||
|
|
|
@ -62,7 +62,7 @@ def generate_rules_mk(cli):
|
|||
cli.subcommands['generate-rules-mk'].print_help()
|
||||
return False
|
||||
|
||||
info_rules_map = json_load(Path('data/mappings/info_rules.json'))
|
||||
info_rules_map = json_load(Path('data/mappings/info_rules.hjson'))
|
||||
rules_mk_lines = [GPL2_HEADER_SH_LIKE, GENERATED_HEADER_SH_LIKE]
|
||||
|
||||
# Iterate through the info_rules map to generate basic rules
|
||||
|
|
|
@ -210,7 +210,7 @@ def new_keyboard(cli):
|
|||
|
||||
# Preprocess any development_board presets
|
||||
if mcu in dev_boards:
|
||||
defaults_map = json_load(Path('data/mappings/defaults.json'))
|
||||
defaults_map = json_load(Path('data/mappings/defaults.hjson'))
|
||||
board = defaults_map['development_board'][mcu]
|
||||
|
||||
mcu = board['processor']
|
||||
|
|
|
@ -214,7 +214,7 @@ def parse_configurator_json(configurator_file):
|
|||
exit(1)
|
||||
|
||||
orig_keyboard = user_keymap['keyboard']
|
||||
aliases = json_load(Path('data/mappings/keyboard_aliases.json'))
|
||||
aliases = json_load(Path('data/mappings/keyboard_aliases.hjson'))
|
||||
|
||||
if orig_keyboard in aliases:
|
||||
if 'target' in aliases[orig_keyboard]:
|
||||
|
|
|
@ -483,7 +483,7 @@ def _extract_config_h(info_data, config_c):
|
|||
"""
|
||||
# Pull in data from the json map
|
||||
dotty_info = dotty(info_data)
|
||||
info_config_map = json_load(Path('data/mappings/info_config.json'))
|
||||
info_config_map = json_load(Path('data/mappings/info_config.hjson'))
|
||||
|
||||
for config_key, info_dict in info_config_map.items():
|
||||
info_key = info_dict['info_key']
|
||||
|
@ -529,7 +529,7 @@ def _extract_config_h(info_data, config_c):
|
|||
def _process_defaults(info_data):
|
||||
"""Process any additional defaults based on currently discovered information
|
||||
"""
|
||||
defaults_map = json_load(Path('data/mappings/defaults.json'))
|
||||
defaults_map = json_load(Path('data/mappings/defaults.hjson'))
|
||||
for default_type in defaults_map.keys():
|
||||
thing_map = defaults_map[default_type]
|
||||
if default_type in info_data:
|
||||
|
@ -555,7 +555,7 @@ def _extract_rules_mk(info_data, rules):
|
|||
|
||||
# Pull in data from the json map
|
||||
dotty_info = dotty(info_data)
|
||||
info_rules_map = json_load(Path('data/mappings/info_rules.json'))
|
||||
info_rules_map = json_load(Path('data/mappings/info_rules.hjson'))
|
||||
|
||||
for rules_key, info_dict in info_rules_map.items():
|
||||
info_key = info_dict['info_key']
|
||||
|
|
|
@ -69,7 +69,7 @@ def keyboard_folder(keyboard):
|
|||
|
||||
This checks aliases and DEFAULT_FOLDER to resolve the actual path for a keyboard.
|
||||
"""
|
||||
aliases = json_load(Path('data/mappings/keyboard_aliases.json'))
|
||||
aliases = json_load(Path('data/mappings/keyboard_aliases.hjson'))
|
||||
|
||||
if keyboard in aliases:
|
||||
keyboard = aliases[keyboard].get('target', keyboard)
|
||||
|
|
Loading…
Reference in New Issue
Block a user