From 345f19a5d763053cd9cea6698656d4a2a1000b23 Mon Sep 17 00:00:00 2001 From: Joel Challis Date: Fri, 21 Oct 2022 02:21:17 +0100 Subject: Add converter support to keymap.json (#18776) --- data/schemas/keymap.jsonschema | 4 ++++ lib/python/qmk/cli/generate/config_h.py | 2 +- lib/python/qmk/cli/generate/rules_mk.py | 7 ++++++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/data/schemas/keymap.jsonschema b/data/schemas/keymap.jsonschema index 0a4fb5d453..1b8d01bcc6 100644 --- a/data/schemas/keymap.jsonschema +++ b/data/schemas/keymap.jsonschema @@ -5,6 +5,10 @@ "type": "object", "properties": { "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"}, "keyboard": {"$ref": "qmk.definitions.v1#/text_identifier"}, "keymap": {"$ref": "qmk.definitions.v1#/text_identifier"}, diff --git a/lib/python/qmk/cli/generate/config_h.py b/lib/python/qmk/cli/generate/config_h.py index fa7c43788d..f64daba134 100755 --- a/lib/python/qmk/cli/generate/config_h.py +++ b/lib/python/qmk/cli/generate/config_h.py @@ -174,7 +174,7 @@ def generate_config_h(cli): # Determine our keyboard/keymap if 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: kb_info_json = dotty(info_json(cli.args.keyboard)) else: diff --git a/lib/python/qmk/cli/generate/rules_mk.py b/lib/python/qmk/cli/generate/rules_mk.py index 361d3c758a..1d708f371e 100755 --- a/lib/python/qmk/cli/generate/rules_mk.py +++ b/lib/python/qmk/cli/generate/rules_mk.py @@ -49,10 +49,12 @@ def process_mapping_rule(kb_info_json, rules_key, info_dict): def generate_rules_mk(cli): """Generates a rules.mk file from info.json. """ + converter = None # Determine our keyboard/keymap if 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: kb_info_json = dotty(info_json(cli.args.keyboard)) else: @@ -88,6 +90,9 @@ def generate_rules_mk(cli): else: rules_mk_lines.append('CUSTOM_MATRIX ?= yes') + if converter: + rules_mk_lines.append(f'CONVERT_TO ?= {converter}') + # Show the results dump_lines(cli.args.output, rules_mk_lines) -- cgit v1.2.3