Add converter support to keymap.json (#18776)

master
Joel Challis 2022-10-21 02:21:17 +01:00 committed by GitHub
parent 6e55aa42fa
commit 345f19a5d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 2 deletions

View File

@ -5,6 +5,10 @@
"type": "object", "type": "object",
"properties": { "properties": {
"author": {"type": "string"}, "author": {"type": "string"},
"converter": {
"type": "string",
"enum": ["elite_pi", "proton_c", "kb2040", "promicro_rp2040", "blok", "bit_c_pro", "stemcell", "bonsai_c4"]
},
"host_language": {"$ref": "qmk.definitions.v1#/text_identifier"}, "host_language": {"$ref": "qmk.definitions.v1#/text_identifier"},
"keyboard": {"$ref": "qmk.definitions.v1#/text_identifier"}, "keyboard": {"$ref": "qmk.definitions.v1#/text_identifier"},
"keymap": {"$ref": "qmk.definitions.v1#/text_identifier"}, "keymap": {"$ref": "qmk.definitions.v1#/text_identifier"},

View File

@ -174,7 +174,7 @@ def generate_config_h(cli):
# Determine our keyboard/keymap # Determine our keyboard/keymap
if cli.args.filename: if cli.args.filename:
user_keymap = parse_configurator_json(cli.args.filename) user_keymap = parse_configurator_json(cli.args.filename)
kb_info_json = user_keymap.get('config', {}) kb_info_json = dotty(user_keymap.get('config', {}))
elif cli.args.keyboard: elif cli.args.keyboard:
kb_info_json = dotty(info_json(cli.args.keyboard)) kb_info_json = dotty(info_json(cli.args.keyboard))
else: else:

View File

@ -49,10 +49,12 @@ def process_mapping_rule(kb_info_json, rules_key, info_dict):
def generate_rules_mk(cli): def generate_rules_mk(cli):
"""Generates a rules.mk file from info.json. """Generates a rules.mk file from info.json.
""" """
converter = None
# Determine our keyboard/keymap # Determine our keyboard/keymap
if cli.args.filename: if cli.args.filename:
user_keymap = parse_configurator_json(cli.args.filename) user_keymap = parse_configurator_json(cli.args.filename)
kb_info_json = user_keymap.get('config', {}) kb_info_json = dotty(user_keymap.get('config', {}))
converter = user_keymap.get('converter', None)
elif cli.args.keyboard: elif cli.args.keyboard:
kb_info_json = dotty(info_json(cli.args.keyboard)) kb_info_json = dotty(info_json(cli.args.keyboard))
else: else:
@ -88,6 +90,9 @@ def generate_rules_mk(cli):
else: else:
rules_mk_lines.append('CUSTOM_MATRIX ?= yes') rules_mk_lines.append('CUSTOM_MATRIX ?= yes')
if converter:
rules_mk_lines.append(f'CONVERT_TO ?= {converter}')
# Show the results # Show the results
dump_lines(cli.args.output, rules_mk_lines) dump_lines(cli.args.output, rules_mk_lines)