I2C Slave Events
A DLN-series adapter can be configured to send I2C slave events. They are generated when certain predefined conditions are met. The I2C slave events are configured using the DlnI2cSlaveSetEvent() function. The eventType parameter defines conditions for event generation. You can retrieve current event generation conditions by calling the DlnI2cSlaveGetEvent() function. There are four possible values for I2C events type:
No I2C slave events are generated.
If you want to receive no I2C slave events, call the DlnI2cSlaveSetEvent() and specify 0 or DLN_I2C_SLAVE_EVENT_NONE as the eventType parameter.
I2C slave events are generated when I2C master device reads data from PC-I2C adapter.
Use DLN_I2C_SLAVE_READ_EV structure to parse the event details (I2C event counter, I2C slave port number, I2C slave address and the number of bytes read by I2C master device).
To receive I2C read events, call the DlnI2cSlaveSetEvent() and specify 1 or DLN_I2C_SLAVE_EVENT_READ as the eventType parameter.
I2C slave events are generated when I2C master device sends data to PC-I2C adapter.
You can parse the event details and data using the DLN_I2C_SLAVE_WRITE_EV structure.
To receive I2C write events, call the DlnI2cSlaveSetEvent() and specify 2 or DLN_I2C_SLAVE_EVENT_WRITE as the eventType parameter.
Both I2C read and I2C write events as sent by the PC-I2C adapter.
You can use the msgId field in the event header to distinguish between I2C write and I2C read events.
For I2C read events the msgId field is equal to DLN_MSG_ID_I2C_SLAVE_READ_EV(0x0C10). You can use the DLN_I2C_SLAVE_READ_EV structure to get the event details.
For I2C write events the msgId field is equal to DLN_MSG_ID_I2C_SLAVE_WRITE_EV(0x0C10). The event details and data are available through the DLN_I2C_SLAVE_WRITE_EV structure.
To receive both I2C read and I2C write events, call the DlnI2cSlaveSetEvent() and specify 3 or DLN_I2C_SLAVE_EVENT_READ_WRITE as the eventType parameter.