There are two ways to detect an I2C transmission:
To observe I2C lines permanently. This consumes much CPU time. Besides, the more times the device polls the I2C bus, the less time it can spend carrying out its intended function. That is why such devices are slow.
To receive events about the requests from the I2C bus. You can configure event generation when the I2C master addresses for receiving or transmitting data.
To configure events, use the DlnI2cSlaveSetEvent() function. You need to specify the slaveAddressNumber
and eventType
parameters. The DlnI2cSlaveGetSupportedEventTypes() function returns the list of event types available for the I2C slave port.
The eventType
parameter can have one of the following values:
| A DLN adapter does not generate any I2C events. |
| A DLN adapter generates events when the I2C master device initiates receiving data from the I2C slave address assigned to the DLN adapter. The |
| A DLN adapter generates events when the I2C master device initiates transmitting data to the I2C slave address assigned to the DLN adapter. The |
| A DLN adapter generates events when the I2C master device initiates receiving data from or transmitting data to the I2C slave address assigned to the DLN adapter. The |
By default, event generation is disabled for all I2C slave addresses (the eventType
parameter is set to DLN_I2C_SLAVE_EVENT_NONE
).
If your DLN adapter uses more than one I2C slave address, you can specify different event configuration for each I2C slave address.