mirror of
https://github.com/qmk/qmk_firmware.git
synced 2026-07-10 19:04:28 -04:00
Stub out nested routes
This commit is contained in:
@@ -53,6 +53,8 @@ def _get_route_type(container):
|
||||
return 'XAP_CONST_MEM'
|
||||
elif container['return_type'] == 'u32':
|
||||
return 'XAP_CONST_MEM'
|
||||
elif container['return_type'] == 'u64':
|
||||
return 'XAP_CONST_MEM'
|
||||
elif container['return_type'] == 'struct':
|
||||
return 'XAP_CONST_MEM'
|
||||
elif container['return_type'] == 'string':
|
||||
@@ -98,6 +100,11 @@ def _append_routing_table_declaration(lines, container, container_id, route_stac
|
||||
lines.append('')
|
||||
lines.append(f'static const uint32_t {route_name}_data PROGMEM = {constant};')
|
||||
|
||||
elif container['return_type'] == 'u64':
|
||||
constant = container['return_constant']
|
||||
lines.append('')
|
||||
lines.append(f'static const uint64_t {route_name}_data PROGMEM = {constant};')
|
||||
|
||||
elif container['return_type'] == 'struct':
|
||||
lines.append('')
|
||||
lines.append(f'static const {route_name}_t {route_name}_data PROGMEM = {{')
|
||||
@@ -196,6 +203,8 @@ def _append_routing_table_entry(lines, container, container_id, route_stack):
|
||||
_append_routing_table_entry_const_data(lines, container, container_id, route_stack)
|
||||
elif container['return_type'] == 'u32':
|
||||
_append_routing_table_entry_const_data(lines, container, container_id, route_stack)
|
||||
elif container['return_type'] == 'u64':
|
||||
_append_routing_table_entry_const_data(lines, container, container_id, route_stack)
|
||||
elif container['return_type'] == 'struct':
|
||||
_append_routing_table_entry_const_data(lines, container, container_id, route_stack)
|
||||
elif container['return_type'] == 'string':
|
||||
|
||||
@@ -147,8 +147,12 @@ class XAPDevice(XAPDeviceBase):
|
||||
XAPRouteError: Access to invalid route attempted
|
||||
"""
|
||||
# TODO: Remove assumption that capability is always xx01
|
||||
(sub, rt) = route
|
||||
cap = bytes([sub, 1])
|
||||
(remain, sub, rt) = (route[:-2], route[-2], route[-1])
|
||||
cap = remain + bytes([sub, 1])
|
||||
|
||||
# recurse for nested routes
|
||||
if remain:
|
||||
self._ensure_route(remain + bytes([sub]))
|
||||
|
||||
if self.subsystems() & (1 << sub) == 0:
|
||||
raise XAPRouteError("subsystem not available")
|
||||
|
||||
Reference in New Issue
Block a user