Skip to content

Commit

Permalink
Add converter support to keymap.json (qmk#18776)
Browse files Browse the repository at this point in the history
  • Loading branch information
zvecr authored and ramonimbao committed Nov 28, 2022
1 parent adf09b1 commit f6bb1a8
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
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

0 comments on commit f6bb1a8

Please sign in to comment.