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

Add converter support to keymap.json #18776

Merged
merged 2 commits into from
Oct 21, 2022
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
4 changes: 4 additions & 0 deletions data/schemas/keymap.jsonschema
Original file line number Diff line number Diff line change
Expand Up @@ -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"},
Expand Down
2 changes: 1 addition & 1 deletion lib/python/qmk/cli/generate/config_h.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
7 changes: 6 additions & 1 deletion lib/python/qmk/cli/generate/rules_mk.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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)

Expand Down