DlnGpioPortSetCfg() Function
Syntax
- C/C++
-
DLN_RESULT DlnGpioPortSetCfg( HDLN handle, uint8_t port, uint8_t mask, uint16_t validFields, DLN_GPIO_PORT_CONFIG config uint16_t* conflictedPin );
The DlnGpioPortSetCfg() function changes the configuration of the GPIO pins from the specified port and sets the conditions of the DLN_GPIO_CONDITION_MET_EV event generation. Each pin is configured individually via the DLN_GPIO_PIN_CONFIG structure.
The mask parameter allows a user to reconfigure all of the pins from the specified port or only some of them. This parameter is a byte value. Each of the eight bits, contained in the byte, corresponds to a pin of the port. The new configuration will be applied only to the pins with their mask bits set to 1. The configuration of pins with mask bits set to 0 will remain unchanged.
For example, if we only need to reconfigure the first and the fourth pin, we should set the mask byte as follows: 00010010
Parameters:
- handle
- A handle to the DLN-series adapter.
- port
- A port, whose I/O lines are to be configured.
- mask
- A bit field that defines, which I/O lines are to be configured.
- validFields
- A bit field that defines valid DLN_GPIO_PIN_CONFIG fields.
- config
- A configuration to be set. See DLN_GPIO_PORT_CONFIG structure for details.
- conflictedPin
-
A number of the conflicted pin, if any. The pins are numbered throughout the whole device. Numbers 0 to 7 belong to port A, 8 to 15 belong to port B etc.
In case there are several conflicted pins, only the number of the first one will be returned. As soon as a user fixes the problem, they should use the
DlnGpioPortSetCfg()function once again, to see if there are any more conflicting pins.
Results:
| Result | Description |
|---|---|
| DLN_RES_SUCCESS | The GPIO port configuration has been successfully set. |
This function is defined in the dln_gpio.h file.
2006-2012