libcamera: controls: Add a 'size' yaml property

Add a 'size' property to the control yaml description, to convey the
size constraints of array controls. The semantics of the property
contents is currently unspecified, but its presence triggers the
generation of an array control (Control<Span<const T>>).

Example:

  - BayerGains:
      type: float
      description: Gains to apply to the four Bayer colour components for white balance
      size: [4]

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
Jacopo Mondi 2019-12-30 18:03:29 +01:00 committed by Laurent Pinchart
parent 3556ae95ec
commit abd96336ed

View file

@ -42,9 +42,14 @@ ${description}
name, ctrl = ctrl.popitem()
id_name = snake_case(name).upper()
if ctrl.get('size'):
ctrl_type = 'Span<const %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('size'):
ctrl_type = 'Span<const %s>' % ctrl['type']
else:
ctrl_type = ctrl['type']
info = {
'name': name,
'type': ctrl['type'],
'type': ctrl_type,
}
enum = ctrl.get('enum')