USB-I2C/SPI/GPIO Interface Adapters
Published on USB-I2C/SPI/GPIO Interface Adapters (https://dlnware.com)

Home > C/C++ API > GPIO Interface > GPIO Interface Functions > DlnGpioPinSetEventCfg() Function

DlnGpioPinSetEventCfg() Function

The DlnGpioPinSetEventCfg() function configures when and which events should be generated for the specified pin. For more information, read Digital Input Events [1].

Syntax
C/C++
DLN_RESULT DlnGpioPinSetEventCfg(
   HDLN handle,
   uint8_t pin,
   uint8_t eventType,
   uint16_t eventPeriod
);
Parameters
handle

A handle to the DLN-series adapter.

pin

A number of the pin for which you want to configure the event generation.

eventType

Defines when the DLN adapter should generate pin events. The following values are available:

ValueDescription

0 or DLN_GPIO_EVENT_NONE

The DLN adapter does not generate any events.

1 or DLN_GPIO_EVENT_CHANGE

The DLN adapter generates events when the level on the digital input line changes. For details, read DLN_GPIO_EVENT_CHANGE Events [2]

2 or DLN_GPIO_EVENT_LEVEL_HIGH

The DLN adapter generates events when the high level is present on the digital input line or after transition from low to high level. For details, read DLN_GPIO_EVENT_LEVEL_HIGH Events [3]

3 or DLN_GPIO_EVENT_LEVEL_LOW

The DLN adapter generates events when the low level is present on the digital input line or after transition from high to low level. For details, read DLN_GPIO_EVENT_LEVEL_LOW Events [4]

4 or DLN_GPIO_EVENT_ALWAYS

The DLN adapter generates events continuously, regardless of the level. For details, read DLN_GPIO_EVENT_ALWAYS Events [5]

eventPeriod

Defines the interval in milliseconds (ms) at which the events occur.

Return Value
DLN_RES_SUCCESS (0x00)

The function configured event settings successfully.

DLN_RES_INVALID_PIN_NUMBER (0xAB)

The pin number is not valid. Use the DlnGpioGetPinCount() [6] function to find the maximum possible pin number.

DLN_RES_INVALID_EVENT_TYPE (0xA9)

The specified event type is not valid. Use the DlnGpioPinGetSupportedEventTypes() [7] function to check the event types supported for the pin.

DLN_RES_INVALID_EVENT_PERIOD (0xAC)

The specified event period is not valid.

Remarks
The DLN-1 adapters do not support GPIO events.

The DlnGpioPinSetEventCfg() function is declared in the dln_gpio.h file.


Links:
[1] http://dlnware.com/dll/Digital-Input-Events
[2] http://dlnware.com/dll/DLN_GPIO_EVENT_CHANGE-Events
[3] http://dlnware.com/dll/DLN_GPIO_EVENT_LEVEL_HIGH-Events
[4] http://dlnware.com/dll/DLN_GPIO_EVENT_LEVEL_LOW-Events
[5] http://dlnware.com/dll/DLN_GPIO_EVENT_ALWAYS-Events
[6] http://dlnware.com/dll/DlnGpioGetPinCount
[7] http://dlnware.com/dll/DlnGpioPinGetSupportedEventTypes