SPI Slave Events

DLN adapters-slaves can be configured to send events. The events are generated when the slave meets the certain predefined conditions.

DLN adapters-slaves support the following events:

Event TypeDescription

DLN_SPI_SLAVE_EVENT_NONE

A DLN adapter does not generate any events.

DLN_SPI_SLAVE_EVENT_SS_RISE

A DLN adapter generates events when the level on the SS line rises. For details, read DLN_SPI_SLAVE_EVENT_SS_RISE Events.

DLN_SPI_SLAVE_EVENT_BUFFER_FULL

A DLN adapter generates events when the buffer is full. For details, read DLN_SPI_SLAVE_EVENT_BUFFER_FULL Events.

DLN_SPI_SLAVE_EVENT_IDLE

A DLN adapter generates events when the slave idles for the configured time. For details, read DLN_SPI_SLAVE_EVENT_IDLE Events.

When an event occurs, your application is notified (see the Notifications section). Call the DlnGetMessage() function to obtain the event details. The DLN_SPI_SLAVE_DATA_RECEIVED_EV structure describes this information.

By default, event generation is disabled (DLN_SPI_SLAVE_EVENT_NONE).

Rating: 
Average: 5 (1 vote)

DLN_SPI_SLAVE_EVENT_SS_RISE Events

A DLN adapter generates the DLN_SPI_SLAVE_EVENT_SS_RISE events each time the level on the SS line rises.

DLN_SPI_SLAVE_EVENT_SS_RISE event

When the transmission from/to the SPI master completes, the master rises the level on the SS line. At this moment, a DLN adapter-slave generates the DLN_SPI_SLAVE_EVENT_SS_RISE event. After receiving this event, your application can perform certain actions, for example, show received data or start processing them.

The eventCount field of the first event is set to zero. For every new DLN_SPI_SLAVE_EVENT_SS_RISE event, the eventCount field increments. When you reset the slave or change its configuration, the eventCount filed is reset to zero.

Use the DlnSpiSlaveEnableSSRiseEvent() function to enable generating these events. To disable this event, use the DlnSpiSlaveDisableSSRiseEvent() function. The DlnSpiSlaveIsSSRiseEventEnabled() function allows to check whether this event is enabled.

The DLN_SPI_SLAVE_EVENT_SS_RISE and DLN_SPI_SLAVE_EVENT_IDLE events are conflicting; therefore when you enable one of these events, check that the other one is disabled.
Rating: 
No votes yet

DLN_SPI_SLAVE_EVENT_BUFFER_FULL Events

A DLN adapter generates the DLN_SPI_SLAVE_EVENT_BUFFER_FULL events each time the buffer becomes full.

DLN_SPI_SLAVE_EVENT_BUFFER_FULL event

You can configure the buffer size by calling the DlnSpiSlaveSetEventSize() function. The supported values are from 1 to 256 bytes. By default, the size parameter is set to 256 bytes. To check the current value, use the DlnSpiSlaveGetEventSize() function.

During the transmission from the SPI master, if the buffer is overfilled, a DLN adapter-slave generates the DLN_SPI_SLAVE_EVENT_BUFFER_FULL event.

The eventCount field of the first event is set to zero. For every new DLN_SPI_SLAVE_EVENT_SS_RISE event, the eventCount field increments. When you reset the slave or change its configuration, the eventCount filed is reset to zero.

Use the DlnSpiSlaveEnableEvent() function to enable generating these events. To disable this event, use the DlnSpiSlaveDisableEvent() function. The DlnSpiSlaveIsEventEnabled() function allows to check whether this event is enabled.

The DLN_SPI_SLAVE_EVENT_BUFFER_FULL event does not conflict with other events.

Rating: 
No votes yet

DLN_SPI_SLAVE_EVENT_IDLE Events

A DLN adapter generates the DLN_SPI_SLAVE_EVENT_IDLE events each time the SS line stays raised for a certain time.

DLN_SPI_SLAVE_EVENT_IDLE event

When the transmission from/to the SPI master completes, the master rises the level on the SS line. If the level stays high for the time set in the timeout parameter, a DLN adapter-slave generates the DLN_SPI_SLAVE_EVENT_IDLE event. If the SS line stays in the high level less than the required idle timeout, the event does not occur.

To configure the timeout parameter, use the DlnSpiSlaveSetIdleEventTimeout() function. The DlnSpiSlaveSetIdleEventTimeout() function allows to check the current value of this parameter.

Use the DlnSpiSlaveEnableIdleEvent() function to enable generating DLN_SPI_SLAVE_EVENT_IDLE events. To disable this event, use the DlnSpiSlaveDisableIdleEvent() function. The DlnSpiSlaveIsIdleEventEnabled() function allows to check whether this event is enabled.

Rating: 
No votes yet