Вы здесь

I2C Slave Events

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:

I2C Events Types

DLN_I2C_SLAVE_EVENT_NONE

A DLN adapter does not generate any I2C events.

DLN_I2C_SLAVE_EVENT_READ

A DLN adapter generates events when the I2C master device initiates receiving data from the I2C slave address assigned to the DLN adapter. The DLN_I2C_SLAVE_READ_EV structure describes the event details. Read DLN_I2C_SLAVE_EVENT_READ Events

DLN_I2C_SLAVE_EVENT_WRITE

A DLN adapter generates events when the I2C master device initiates transmitting data to the I2C slave address assigned to the DLN adapter. The DLN_I2C_SLAVE_WRITE_EV structure describes the event details. Read DLN_I2C_SLAVE_EVENT_WRITE Events

DLN_I2C_SLAVE_EVENT_READ_WRITE

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 DLN_I2C_SLAVE_READ_EV structure describes the read event details. The DLN_I2C_SLAVE_WRITE_EV structure describes the write event details. Read DLN_I2C_SLAVE_EVENT_READ_WRITE Events

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.

Rating: 
Голосов пока нет

Языки

Вход на сайт