DLN series interface adapters contain a large number of pins that you can use as general-purpose inputs and outputs. Some of these pins are shared between GPIO (general-purpose input/output) and other modules (I2C, SPI). If you do not the corresponding pins to other modules, you can configure them as digital inputs or digital outputs and control them.
If you configure pins as inputs, your application reads the digital value set by the external device. If you define pins as outputs, your application can control the digital value on these pins.
To use a pin as a digital input or a digital output, the pin must be assigned to the GPIO module by using the DlnGpioPinEnable() function. You can use the DlnGpioPinIsEnabled() function, to check whether a pin is already assigned to the GPIO module.
You cannot assign a pin to the GPIO module if another module uses it. Call the DlnGetPinCfg() function to check which module uses a pin.
Most of the DLN-series adapters provide additional functionality for GPIO pins. You can configure the following features for any input and/or output pin individually:
Event-driven interface. You can configure a digital input pin to raise events when the value on this pin changes. There are several configuration options - what kind of events and when should be generated. For more details, read Digital Input Events.
Debounce filter. If you do not want to treat casual pulses as value changes, you can enable the debounce filter, which rejects pulses less that the predefined debounce period. For details, read Debounce Filter.
Open drain mode. If you interconnect several outputs on a single I/O line, they may settle different values simultaneously and cause hardware damage. The open drain mode helps you to avoid this. For details, read Open Drain Mode.
Pull-up and pull-down resistors. When no external hardware is connected to an input line, the logic level on this line is undefined. Use pull-up or pull-down resistors to ensure that inputs to I/O lines are settled at expected levels. For details, read Pull-up/Pull-down Resistors.