Selector
Component Type: Program
Status: Implemented
Overview
CProgSelector routes one of N data inputs to a target IO based on the value of a control input. When the control changes or when the currently selected data input changes, the program copies that data input’s value to the target.
Indexing is zero-based; out-of-range control values are ignored.
Implementation
Standalone program (CProgCommon-based), no thread.
Registers notification callbacks on the control input and on all data inputs that support notifications.
applyRoute()reads the selected data input viagetData()and writes the value to the target viasetData().The iodata buffer is sized to match the target IO’s
getDataSize().If the target is a deferred
virtoutput,selectorinitializes or reuses it becauseselectordefines that output-side fixed shape from its data contract.Control and data inputs are input-only;
selectordoes not initialize them and expects them to be provided by upstream producers.
Configuration
Kconfig
CONFIG_DAWN_PROG_SELECTOR: enables the program.
YAML
programs:
- id: selector_leds
type: selector
config:
control: [mode]
data: [seq0, seq1, seq2, seq3]
target: [leds0]