GPIO Event Structure

This section describes the structure used for GPIO events. This structure is declared in the dln_gpio.h file.

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

DLN_GPIO_CONDITION_MET_EV Structure

The DLN_GPIO_CONDITION_MET_EV structure contains information about the current GPIO event on a pin.

Syntax
C/C++
typedef struct
{
        DLN_MSG_HEADER header;
        uint16_t eventCount;
        uint8_t eventType;
        uint16_t pin;
        uint8_t value;
} __PACKED_ATTR DLN_GPIO_CONDITION_MET_EV;
Event Structure Members
header

Defines the DLN message header. It should have the following value: DLN_MSG_ID_GPIO_CONDITION_MET_EV (0x010F)

eventCount

The number of events generated in the series. For the DLN_GPIO_EVENT_ALWAYS events, this field contains the number of events generated after the event configuration changed. For other events, this field contains the number of events generated since the previous level change.

eventType

The type of generating events. The following values are available:

ValueConstantDescription

0

DLN_GPIO_EVENT_NONE

No events are generated.

1

DLN_GPIO_EVENT_CHANGE

Events are generated when the input value changes.

2

DLN_GPIO_EVENT_LEVEL_HIGH

Events are generated when the high level (logic 1) is detected.

3

DLN_GPIO_EVENT_LEVEL_LOW

Events are generated when the low level (logic 0) is detected.

4

DLN_GPIO_EVENT_ALWAYS

The events are generated periodically with the predefined interval.

For more information, read Digital Input Events.

pin

The number of the pin where the event is generated.

value

The current value of the pin.

Remarks

The eventCount parameter contains information about the number of events generated in one event series. A new event series can start if:

  • event generation is enabled;

  • the event type is changed;

  • the level on the pin changed (except for DLN_GPIO_EVENT_ALWAYS events).

When a new series of events starts, the eventCount is reset to zero. This parameter increases by 1 when a new event in the series is generated.

Find examples of the eventCount values in the Digital Input Events section.