Configuration
Informative
A worked I2C channel configuration. The full property tables are in Configuration Reference; the binding rule is CHI-I2C-MUST-23.
Controller and target channels
Each channel is configured as either a controller or a target — the node_type selects which
properties apply.
general:
enable_development_error_reporting: true
config_set:
- config_set_name: "I2cCfg"
channel:
- node_type: "Controller"
channel_id: 0
hw_channel: 0
event_handling_mode: "Interrupt" # or "Polling"
clock_divider: 16 # derives the SCL bitrate
- node_type: "Target"
channel_id: 1
hw_channel: 1
event_handling_mode: "Polling"
device_address: 0x42 # this target's 7-bit address [0, 127]
default_data: 0xFF # sent when the controller over-reads
Notes
Controller vs target properties differ. A controller channel has
clock_divider; a target channel hasdevice_addressanddefault_data.7-bit addresses only —
device_addressis in[0, 127].Event handling is per channel. With
Pollingyou must callI2c_PollFunctioncyclically; withInterruptthe driver services events inI2c_Interrupt.