From 804915841a1705442900ee8408605d348d396a83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Mon, 26 May 2025 11:57:25 +0200 Subject: [PATCH] shields: doc: allow to indicate supported hw features MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Shield authors can now indicate an optional list of hardware features that the shield supports, in the form of the same kind of "binding type" already used for boards. Signed-off-by: Benjamin Cabé --- .../zephyr/domain/templates/shield-card.html | 10 +++++++++- doc/_scripts/gen_boards_catalog.py | 1 + doc/hardware/porting/shields.rst | 8 ++++++++ scripts/list_shields.py | 4 +++- scripts/schemas/shield-schema.yml | 5 +++++ 5 files changed, 26 insertions(+), 2 deletions(-) diff --git a/doc/_extensions/zephyr/domain/templates/shield-card.html b/doc/_extensions/zephyr/domain/templates/shield-card.html index 57c5a1cf043..bd6a7e892d3 100644 --- a/doc/_extensions/zephyr/domain/templates/shield-card.html +++ b/doc/_extensions/zephyr/domain/templates/shield-card.html @@ -13,7 +13,15 @@ aria-label="Open the documentation page for {{ shield.full_name }}" data-name="{{ shield.full_name}}" data-vendor="{{ shield.vendor }}" - tabindex="0"> + data-supported-features=" + {%- set feature_types = [] -%} + {%- for feature in shield.supported_features -%} + {%- if feature not in feature_types -%} + {%- set _ = feature_types.append(feature) -%} + {%- endif -%} + {%- endfor -%} + {{- feature_types|join(' ') -}} + " tabindex="0">
{{ vendors[shield.vendor] }}
{% if shield.image -%} A picture of the {{ shield.full_name }} shield.overlay**: This file provides a shield description in devicetree format that is merged with the board's :ref:`devicetree ` diff --git a/scripts/list_shields.py b/scripts/list_shields.py index 7590fdd781d..27a84aa3004 100755 --- a/scripts/list_shields.py +++ b/scripts/list_shields.py @@ -39,6 +39,7 @@ class Shield: dir: Path full_name: str | None = None vendor: str | None = None + supported_features: list[str] | None = None def shield_key(shield): return shield.name @@ -49,7 +50,8 @@ def process_shield_data(shield_data, shield_dir): name=shield_data['name'], dir=shield_dir, full_name=shield_data.get('full_name'), - vendor=shield_data.get('vendor') + vendor=shield_data.get('vendor'), + supported_features=shield_data.get('supported_features', []), ) def find_shields(args): diff --git a/scripts/schemas/shield-schema.yml b/scripts/schemas/shield-schema.yml index b3dcba896b5..1637300228a 100644 --- a/scripts/schemas/shield-schema.yml +++ b/scripts/schemas/shield-schema.yml @@ -21,6 +21,11 @@ schema;shield-schema: required: true type: str desc: Manufacturer/vendor of the shield + supported_features: + required: false + sequence: + - type: str + desc: A hardware feature the shield supports (see dts/bindings/binding-types.txt) type: map range: