1
0
Fork 0
forked from forks/qmk_firmware

Merge remote-tracking branch 'origin/master' into develop

This commit is contained in:
QMK Bot 2024-06-30 02:40:18 +00:00
commit 641a1ce568
2 changed files with 12 additions and 24 deletions

View file

@ -2,8 +2,6 @@
"keyboard_name": "%KEYBOARD%", "keyboard_name": "%KEYBOARD%",
"maintainer": "%USER_NAME%", "maintainer": "%USER_NAME%",
"manufacturer": "%REAL_NAME%", "manufacturer": "%REAL_NAME%",
"processor": "%MCU%",
"bootloader": "%BOOTLOADER%",
"diode_direction": "COL2ROW", "diode_direction": "COL2ROW",
"matrix_pins": { "matrix_pins": {
"cols": ["C2"], "cols": ["C2"],

View file

@ -14,7 +14,7 @@ from qmk.git import git_get_username
from qmk.json_schema import load_jsonschema from qmk.json_schema import load_jsonschema
from qmk.path import keyboard from qmk.path import keyboard
from qmk.json_encoders import InfoJSONEncoder from qmk.json_encoders import InfoJSONEncoder
from qmk.json_schema import deep_update, json_load from qmk.json_schema import deep_update
from qmk.constants import MCU2BOOTLOADER, QMK_FIRMWARE from qmk.constants import MCU2BOOTLOADER, QMK_FIRMWARE
COMMUNITY = Path('layouts/default/') COMMUNITY = Path('layouts/default/')
@ -78,7 +78,7 @@ def replace_string(src, token, value):
src.write_text(src.read_text().replace(token, value)) src.write_text(src.read_text().replace(token, value))
def augment_community_info(src, dest): def augment_community_info(config, src, dest):
"""Splice in any additional data into info.json """Splice in any additional data into info.json
""" """
info = json.loads(src.read_text()) info = json.loads(src.read_text())
@ -86,6 +86,7 @@ def augment_community_info(src, dest):
# merge community with template # merge community with template
deep_update(info, template) deep_update(info, template)
deep_update(info, config)
# avoid assumptions on macro name by using the first available # avoid assumptions on macro name by using the first available
first_layout = next(iter(info["layouts"].values()))["layout"] first_layout = next(iter(info["layouts"].values()))["layout"]
@ -105,7 +106,7 @@ def augment_community_info(src, dest):
for item in first_layout: for item in first_layout:
item["matrix"] = [int(item["y"]), int(item["x"])] item["matrix"] = [int(item["y"]), int(item["x"])]
# finally write out the updated info.json # finally write out the updated json
dest.write_text(json.dumps(info, cls=InfoJSONEncoder, sort_keys=True)) dest.write_text(json.dumps(info, cls=InfoJSONEncoder, sort_keys=True))
@ -212,15 +213,12 @@ def new_keyboard(cli):
default_layout = cli.args.layout if cli.args.layout else prompt_layout() default_layout = cli.args.layout if cli.args.layout else prompt_layout()
mcu = cli.args.type if cli.args.type else prompt_mcu() mcu = cli.args.type if cli.args.type else prompt_mcu()
# Preprocess any development_board presets config = {}
if mcu in dev_boards: if mcu in dev_boards:
defaults_map = json_load(Path('data/mappings/defaults.hjson')) config['development_board'] = mcu
board = defaults_map['development_board'][mcu]
mcu = board['processor']
bootloader = board['bootloader']
else: else:
bootloader = select_default_bootloader(mcu) config['processor'] = mcu
config['bootloader'] = select_default_bootloader(mcu)
detach_layout = False detach_layout = False
if default_layout == 'none of the above': if default_layout == 'none of the above':
@ -231,17 +229,9 @@ def new_keyboard(cli):
'YEAR': str(date.today().year), 'YEAR': str(date.today().year),
'KEYBOARD': kb_name, 'KEYBOARD': kb_name,
'USER_NAME': user_name, 'USER_NAME': user_name,
'REAL_NAME': real_name, 'REAL_NAME': real_name
'LAYOUT': default_layout,
'MCU': mcu,
'BOOTLOADER': bootloader
} }
if cli.config.general.verbose:
cli.log.info("Creating keyboard with:")
for key, value in tokens.items():
cli.echo(f" {key.ljust(10)}: {value}")
# begin with making the deepest folder in the tree # begin with making the deepest folder in the tree
keymaps_path = keyboard(kb_name) / 'keymaps/' keymaps_path = keyboard(kb_name) / 'keymaps/'
keymaps_path.mkdir(parents=True) keymaps_path.mkdir(parents=True)
@ -256,7 +246,7 @@ def new_keyboard(cli):
# merge in infos # merge in infos
community_info = Path(COMMUNITY / f'{default_layout}/info.json') community_info = Path(COMMUNITY / f'{default_layout}/info.json')
augment_community_info(community_info, keyboard(kb_name) / 'keyboard.json') augment_community_info(config, community_info, keyboard(kb_name) / 'keyboard.json')
# detach community layout and rename to just "LAYOUT" # detach community layout and rename to just "LAYOUT"
if detach_layout: if detach_layout:
@ -265,5 +255,5 @@ def new_keyboard(cli):
cli.log.info(f'{{fg_green}}Created a new keyboard called {{fg_cyan}}{kb_name}{{fg_green}}.{{fg_reset}}') cli.log.info(f'{{fg_green}}Created a new keyboard called {{fg_cyan}}{kb_name}{{fg_green}}.{{fg_reset}}')
cli.log.info(f"Build Command: {{fg_yellow}}qmk compile -kb {kb_name} -km default{{fg_reset}}.") cli.log.info(f"Build Command: {{fg_yellow}}qmk compile -kb {kb_name} -km default{{fg_reset}}.")
cli.log.info(f'Project Location: {{fg_cyan}}{QMK_FIRMWARE}/{keyboard(kb_name)}{{fg_reset}},') cli.log.info(f'Project Location: {{fg_cyan}}{QMK_FIRMWARE}/{keyboard(kb_name)}{{fg_reset}}.')
cli.log.info("{{fg_yellow}}Now update the config files to match the hardware!{{fg_reset}}") cli.log.info("{fg_yellow}Now update the config files to match the hardware!{fg_reset}")