@@ -42,9 +42,14 @@ ${description}
name, ctrl = ctrl.popitem()
id_name = snake_case(name).upper()
+ if ctrl.get('compound'):
+ ctrl_type = 'Span<%s>' % ctrl['type']
+ else:
+ ctrl_type = ctrl['type']
+
info = {
'name': name,
- 'type': ctrl['type'],
+ 'type': ctrl_type,
'description': format_description(ctrl['description']),
'id_name': id_name,
}
@@ -92,9 +97,14 @@ def generate_h(controls):
ids.append('\t' + id_name + ' = ' + str(id_value) + ',')
+ if ctrl.get('compound'):
+ ctrl_type = 'Span<%s>' % ctrl['type']
+ else:
+ ctrl_type = ctrl['type']
+
info = {
'name': name,
- 'type': ctrl['type'],
+ 'type': ctrl_type,
}
enum = ctrl.get('enum')
Parse the 'compound' yaml property and create Control<> instances with the opportune type accordingly. Controls defined in the yaml source file as 'compound' will be instantiated with 'Span<T>' type, while non-compound controls retain the 'T' type. Example controls_ids.yaml: - CompoundControl: type: int32_t description: A fictional compound control compound: true Will be parsed by gen-control.py to generate a Control<Span<int32_t>> instance. Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> --- src/libcamera/gen-controls.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)