mirror of
https://github.com/qmk/qmk_firmware.git
synced 2024-12-04 17:05:17 +00:00
Fix xap_client gen after render_xap_output changes
This commit is contained in:
parent
dc591c751d
commit
751e72c1f9
@ -5,13 +5,15 @@ from enum import IntEnum
|
||||
|
||||
# version: 0.0.1
|
||||
class RgblightModes(IntEnum):
|
||||
{%- for id, effect in specs.rgblight.effects | dictsort %}
|
||||
{% for id, effect in specs.rgblight.effects | dictsort %}
|
||||
{{ effect.key }} = {{ id }}
|
||||
{%- endfor %}
|
||||
{% endfor %}
|
||||
|
||||
|
||||
# version: 0.0.1
|
||||
class RgbMatrixModes(IntEnum):
|
||||
{%- for id, effect in specs.rgb_matrix.effects | dictsort %}
|
||||
{% for id, effect in specs.rgb_matrix.effects | dictsort %}
|
||||
{{ effect.key }} = {{ id }}
|
||||
{%- endfor %}
|
||||
{% endfor %}
|
||||
|
||||
# noqa: W391
|
@ -5,16 +5,18 @@ class XAPRouteError(Exception):
|
||||
|
||||
|
||||
class XAPRoutes():
|
||||
{%- for id, route in xap.routes | dictsort %}
|
||||
{%- if route.routes %}
|
||||
{% for id, route in xap.routes | dictsort %}
|
||||
{% if route.routes %}
|
||||
# {{route.define}}
|
||||
{%- for subid, subroute in route.routes | dictsort %}
|
||||
{% for subid, subroute in route.routes | dictsort %}
|
||||
{{route.define}}_{{subroute.define}} = b'\x{{ '%02d' % id|int(base=16) }}\x{{ '%02d' % subid|int(base=16) }}'
|
||||
{%- if subroute.routes %}
|
||||
{%- for subsubid, subsubroute in subroute.routes | dictsort %}
|
||||
{% if subroute.routes %}
|
||||
{% for subsubid, subsubroute in subroute.routes | dictsort %}
|
||||
{{route.define}}_{{subroute.define}}_{{subsubroute.define}} = b'\x{{ '%02d' % id|int(base=16) }}\x{{ '%02d' % subid|int(base=16) }}\x{{ '%02d' % subsubid|int(base=16) }}'
|
||||
{%- endfor %}
|
||||
{%- endif %}
|
||||
{%- endfor %}
|
||||
{%- endif %}
|
||||
{%- endfor %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
# noqa: W391
|
@ -4,6 +4,7 @@ from collections import namedtuple
|
||||
from enum import IntFlag, IntEnum
|
||||
from struct import Struct
|
||||
|
||||
|
||||
{% macro gen_struct(name, members, fmt) -%}
|
||||
class {{ name }}(namedtuple('{{ name }}', '{{ members }}')):
|
||||
fmt = Struct('{{ fmt }}')
|
||||
@ -31,16 +32,16 @@ class {{ name }}(namedtuple('{{ name }}', '{{ members }}')):
|
||||
{% for item in type_definitions -%}{{ gen_struct(item.name, item.members, item.fmt) }}{% endfor -%}
|
||||
|
||||
# Spec structs
|
||||
{%- for item in xap.routes.values() recursive -%}
|
||||
{% for item in xap.routes.values() recursive %}
|
||||
{%- if item.routes -%}
|
||||
{{ loop(item.routes.values()) }}
|
||||
{%- endif -%}
|
||||
{% if item.request_struct_members %}
|
||||
{%- if item.request_struct_members %}
|
||||
# TODO: gen inbound object for {{ item.define | to_snake }}
|
||||
{%- endif -%}
|
||||
{% if item.return_struct_members %}
|
||||
{% endif -%}
|
||||
{%- if item.return_struct_members %}
|
||||
# TODO: gen outbound object for {{ item.define | to_snake }}
|
||||
{%- endif -%}
|
||||
{% endif %}
|
||||
{%- endfor %}
|
||||
|
||||
|
||||
@ -51,14 +52,16 @@ class XAPSecureStatus(IntEnum):
|
||||
|
||||
|
||||
class XAPEventType(IntEnum):
|
||||
{%- for id, message in xap.broadcast_messages.messages | dictsort %}
|
||||
{% for id, message in xap.broadcast_messages.messages | dictsort %}
|
||||
{{ message.define }} = {{ id }}
|
||||
{%- endfor %}
|
||||
{% endfor %}
|
||||
|
||||
|
||||
class XAPFlags(IntFlag):
|
||||
{%- for bitnum, bitinfo in xap.response_flags.bits | dictsort %}
|
||||
{%- if bitinfo.define != "-" %}
|
||||
{% for bitnum, bitinfo in xap.response_flags.bits | dictsort %}
|
||||
{% if bitinfo.define != "-" %}
|
||||
{{ bitinfo.define }} = 1 << {{ bitnum }}
|
||||
{%- endif %}
|
||||
{%- endfor %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
# noqa: W391
|
||||
|
@ -1,4 +1,4 @@
|
||||
# Copyright 2022 QMK
|
||||
# Copyright 2023 QMK
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
################################################################################
|
||||
@ -121,3 +121,5 @@ class RgbMatrixModes(IntEnum):
|
||||
MULTISPLASH = 0x29
|
||||
SOLID_SPLASH = 0x2A
|
||||
SOLID_MULTISPLASH = 0x2B
|
||||
|
||||
# noqa: W391
|
||||
|
@ -1,4 +1,4 @@
|
||||
# Copyright 2022 QMK
|
||||
# Copyright 2023 QMK
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
################################################################################
|
||||
@ -84,3 +84,5 @@ class XAPRoutes():
|
||||
AUDIO_GET_CONFIG = b'\x07\x03'
|
||||
AUDIO_SET_CONFIG = b'\x07\x04'
|
||||
AUDIO_SAVE_CONFIG = b'\x07\x05'
|
||||
|
||||
# noqa: W391
|
||||
|
@ -1,4 +1,4 @@
|
||||
# Copyright 2022 QMK
|
||||
# Copyright 2023 QMK
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
################################################################################
|
||||
@ -133,3 +133,5 @@ class XAPEventType(IntEnum):
|
||||
class XAPFlags(IntFlag):
|
||||
SUCCESS = 1 << 0
|
||||
SECURE_FAILURE = 1 << 1
|
||||
|
||||
# noqa: W391
|
||||
|
Loading…
Reference in New Issue
Block a user