2021-08-11 11:08:32 +00:00
|
|
|
"""This script generates the XAP protocol generated sources to be compiled into QMK firmware.
|
|
|
|
"""
|
|
|
|
from milc import cli
|
|
|
|
|
|
|
|
from qmk.path import normpath
|
2022-03-15 17:59:12 +00:00
|
|
|
from qmk.keyboard import keyboard_completer, keyboard_folder
|
2022-06-19 21:04:30 +00:00
|
|
|
from qmk.xap.gen_firmware.blob_generator import generate_blob
|
2021-08-11 11:08:32 +00:00
|
|
|
from qmk.xap.gen_firmware.inline_generator import generate_inline
|
|
|
|
from qmk.xap.gen_firmware.header_generator import generate_header
|
|
|
|
|
|
|
|
|
|
|
|
@cli.argument('-o', '--output', type=normpath, help='File to write to')
|
2022-05-22 23:12:36 +00:00
|
|
|
@cli.argument('-kb', '--keyboard', type=keyboard_folder, completer=keyboard_completer, help='Name of the keyboard')
|
|
|
|
@cli.argument('-km', '--keymap', help='The keymap\'s name')
|
2021-08-11 11:08:32 +00:00
|
|
|
@cli.subcommand('Generates the XAP protocol include.', hidden=False if cli.config.user.developer else True)
|
|
|
|
def xap_generate_qmk_inc(cli):
|
|
|
|
"""Generates the XAP protocol inline codegen file, generated during normal build.
|
|
|
|
"""
|
2022-05-22 23:12:36 +00:00
|
|
|
# Determine our keyboard/keymap
|
|
|
|
if not cli.args.keyboard:
|
|
|
|
cli.log.error('Missing parameter: --keyboard')
|
2022-09-29 22:44:11 +00:00
|
|
|
cli.subcommands['xap-generate-qmk-inc'].print_help()
|
2022-05-22 23:12:36 +00:00
|
|
|
return False
|
|
|
|
if not cli.args.keymap:
|
|
|
|
cli.log.error('Missing parameter: --keymap')
|
2022-09-29 22:44:11 +00:00
|
|
|
cli.subcommands['xap-generate-qmk-inc'].print_help()
|
2022-05-22 23:12:36 +00:00
|
|
|
return False
|
|
|
|
|
|
|
|
generate_inline(cli.args.output, cli.args.keyboard, cli.args.keymap)
|
2021-08-11 11:08:32 +00:00
|
|
|
|
|
|
|
|
|
|
|
@cli.argument('-o', '--output', type=normpath, help='File to write to')
|
2022-03-15 17:59:12 +00:00
|
|
|
@cli.argument('-kb', '--keyboard', type=keyboard_folder, completer=keyboard_completer, help='Name of the keyboard')
|
2022-05-22 23:12:36 +00:00
|
|
|
@cli.argument('-km', '--keymap', help='The keymap\'s name')
|
2021-08-11 11:08:32 +00:00
|
|
|
@cli.subcommand('Generates the XAP protocol include.', hidden=False if cli.config.user.developer else True)
|
|
|
|
def xap_generate_qmk_h(cli):
|
|
|
|
"""Generates the XAP protocol header file, generated during normal build.
|
|
|
|
"""
|
2022-05-22 23:12:36 +00:00
|
|
|
# Determine our keyboard/keymap
|
2022-03-15 17:59:12 +00:00
|
|
|
if not cli.args.keyboard:
|
|
|
|
cli.log.error('Missing parameter: --keyboard')
|
2022-09-29 22:44:11 +00:00
|
|
|
cli.subcommands['xap-generate-qmk-h'].print_help()
|
2022-03-15 17:59:12 +00:00
|
|
|
return False
|
2022-05-22 23:12:36 +00:00
|
|
|
if not cli.args.keymap:
|
|
|
|
cli.log.error('Missing parameter: --keymap')
|
2022-09-29 22:44:11 +00:00
|
|
|
cli.subcommands['xap-generate-qmk-h'].print_help()
|
2022-05-22 23:12:36 +00:00
|
|
|
return False
|
|
|
|
|
|
|
|
generate_header(cli.args.output, cli.args.keyboard, cli.args.keymap)
|
2022-03-15 17:59:12 +00:00
|
|
|
|
|
|
|
|
|
|
|
@cli.argument('-o', '--output', type=normpath, help='File to write to')
|
|
|
|
@cli.argument('-kb', '--keyboard', type=keyboard_folder, completer=keyboard_completer, help='Name of the keyboard')
|
|
|
|
@cli.argument('-km', '--keymap', help='The keymap\'s name')
|
2022-06-19 21:04:30 +00:00
|
|
|
@cli.subcommand('Generates the XAP config payload include.', hidden=False if cli.config.user.developer else True)
|
|
|
|
def xap_generate_qmk_blob_h(cli):
|
|
|
|
"""Generates the XAP config payload header file, generated during normal build.
|
2022-03-15 17:59:12 +00:00
|
|
|
"""
|
2022-03-20 01:25:04 +00:00
|
|
|
# Determine our keyboard/keymap
|
2022-03-15 17:59:12 +00:00
|
|
|
if not cli.args.keyboard:
|
|
|
|
cli.log.error('Missing parameter: --keyboard')
|
2022-09-29 22:44:11 +00:00
|
|
|
cli.subcommands['xap-generate-qmk-blob-h'].print_help()
|
2022-03-15 17:59:12 +00:00
|
|
|
return False
|
2022-03-20 01:25:04 +00:00
|
|
|
if not cli.args.keymap:
|
|
|
|
cli.log.error('Missing parameter: --keymap')
|
2022-09-29 22:44:11 +00:00
|
|
|
cli.subcommands['xap-generate-qmk-blob-h'].print_help()
|
2022-03-20 01:25:04 +00:00
|
|
|
return False
|
2022-03-15 17:59:12 +00:00
|
|
|
|
2022-06-19 21:04:30 +00:00
|
|
|
generate_blob(cli.args.output, cli.args.keyboard, cli.args.keymap)
|