qmk_firmware/data/templates/xap/firmware/xap_generated.inl.j2

35 lines
1.4 KiB
Plaintext
Raw Normal View History

{{ constants.GPL2_HEADER_C_LIKE }}
{{ constants.GENERATED_HEADER_C_LIKE }}
////////////////////////////////////////////////////////////////////////////////
// Full XAP {{ xap.version }} definitions
2023-01-06 02:49:37 +00:00
{% for message_id,data in xap.broadcast_messages.messages | dictsort %}
{% if 'return_type' in data %}
void {{ xap.broadcast_messages.define_prefix | lower }}_{{ data.define | to_snake | lower }}({{ data.return_type | type_to_c('value') }}) { xap_broadcast({{ message_id }}, &value, sizeof(value)); }
{% else %}
void {{ xap.broadcast_messages.define_prefix | lower }}_{{ data.define | to_snake | lower }}(const void *data, size_t length) { xap_broadcast({{ message_id }}, data, length); }
{% endif %}
{% endfor %}
{% macro append_routing_table(prefix, container, route_stack) %}
{% set this_route_stack = route_stack.copy() %}
{{ this_route_stack.append(container) }}
{% set stack_names = this_route_stack | map(attribute='name') | join(', ') %}
Stack names: {{ stack_names }}
{% if 'routes' in container %}
{% for route, data in container.routes | dictsort %}
{% set this_prefix_uc = (prefix + '_' + data.define) | upper %}
{% set this_prefix_lc = this_prefix_uc | lower %}
{{ append_routing_table(this_prefix_lc, data, this_route_stack) }}
Inner route prefix for {{ prefix }}: {{ this_prefix_lc }}
{% endfor %}
{% endif %}
Prefix: {{ prefix }}
{% endmacro %}
{{ append_routing_table("xap_route", xap, []) }}
#if 0
2023-01-06 02:49:37 +00:00
{{ xap | tojson(indent=4) }}
#endif