Configuration
Informative
A worked Port configuration, using the YAML configuration model (the toolchain and file format are implementation-defined). The full property tables are in Configuration Reference; the binding rule is CHI-PORT-MUST-13.
Ports and pins
The configuration is a list of ports, each with a list of pins. Naming a port or pin makes
the generator emit a friendly PORT_PORT_<name> / PORT_PIN_<name> symbol alongside the default
PORT_PORT_P<n> / PORT_PIN_P<port>_<pin> one.
general:
enable_development_error_reporting: true
config_set:
- config_set_name: "PortCfg"
port:
- port_id: 2
port_name: "SENSOR" # -> PORT_PORT_SENSOR; null for no alias
pin:
- pin_id: 3
pin_name: "LED" # -> PORT_PIN_LED
mode: "GPIO" # function mode (impl-defined list; e.g. GPIO/PWM/I2C)
direction: "Out" # In | Out | In-Out | Hi-Z
init_value: "Low" # High | Low (output pins)
event_handling_mode: "Interrupt"
- pin_id: 4
pin_name: "BUTTON" # -> PORT_PIN_BUTTON
mode: "GPIO"
direction: "In"
init_value: "Low"
event_handling_mode: "Polling"
Notes
Function and direction are fixed at init.
modeanddirectionare applied byPort_Initand cannot be changed at runtime — only edge detection is runtime-settable.``mode`` is implementation-defined. The available function modes (GPIO, PWM, analog, bus alternate functions, …) depend on the hardware; the tool should offer only the modes each pin supports.
Names are optional. A
nullport_name/pin_namesuppresses the alias symbol; the defaultP<n>symbols are always generated.Event handling is per pin:
Pollingevents are serviced byPort_PollFunction,Interruptevents byPort_Interrupt.