The GPIO_SET_IN_CFG command configures input mode settings
for specified I/O pins. If I/O pin is already
in input mode, settings are applied immediately. If a pin is not in input mode, use
GPIO_SET_CFG command to configure it as
a digital input. GPIO_SET_IN_CFG command can be used prior to
GPIO_SET_CFG command.
| Byte 0 | GPIO_SET _IN_CFG | Command ID (0x05). |
| Byte 1 | ECHO | Echo to associate a command with the response. |
| Byte 2 | PORT | GPIO port. |
| Byte 3 | MASK | Data mask to use while modifying I/O pin
configuration. |
| Byte 4 | PHASE | Phase configuration |
| Byte 5 | DEBOUNCE | Debounce time in ms. |
| Byte 6 | REPEAT | Repeat interval in units of 100 ms. |
| Byte 7 | Reserved | Reserved (must be 0). |
Command is an 8-byte array of the following format:
This byte contains command ID (command type). It should be set to 0x05.
This byte is used to associate a response received from GPIO-24 adapter with a specific command. Response will contain exactly the same value in its echo byte.
GPIO PORT:
0 – GPIO PORT A
1 – GPIO PORT B
2 – GPIO PORT C
Data mask to use while modifying I/O pin digital
input mode configuration. It is well known that a byte consists of 8
bits (which can be 0 or 1). This characteristic is used to create a
mask. The mask value allows to modify certain pins, leaving rest of the
pins unchanged. Note, that only the pins with mask bit set to 1 will be
affected.
Phase configuration, which determines the conditions when GPIO-24 adapter sends GPIO_EV_IN event.
The following values are available for this byte:
GPIO_IN_EV_NONE (0x00) – No events are sent for current pin. For more detailed information see Section 6.2.1, “GPIO_IN_EV_NONE (0x00) – No events are sent”.
GPIO_IN_EV_LEV_0 (0x01) – Events are sent when pin has logical "0" on its input. For more detailed information see Section 6.2.2, “GPIO_IN_EV_LEV_0 (0x01) – Sending events when pin has logical "0" on its input”.
GPIO_IN_EV_LEV_1 (0x02) – Events are sent when pin has logical "1" on its input. For more detailed information see Section 6.2.3, “GPIO_IN_EV_LEV_1 (0x01) – Sending events when pin has logical "1" on its input”.
GPIO_IN_EV_RISING (0x03) – Events are sent when input value changes from logical "0" to "1". For more detailed information see Section 6.2.4, “GPIO_IN_EV_RISING (0x03) – Sending events when input value changes from logical "0" to "1"”.
GPIO_IN_EV_FALLING (0x04) – Events are sent when input value changes from logical "1" to "0". For more detailed information see Section 6.2.5, “GPIO_IN_EV_FALLING (0x04) – Sending events when input value changes from logical "1" to "0"”.
GPIO_IN_EV_CHANGE (0x05) – Events are sent when input value of the pin changes. For more detailed information see Section 6.2.6, “GPIO_IN_EV_CHANGE (0x05) – Sending events when input value of the pin changes”.
To avoid sending numerous events caused by contact bounce, GPIO-24 adapter accepts signal change only after the new value is stable. Byte 5: DEBOUNCE parameter specifies the debounce time in ms. If Byte 5: DEBOUNCE = 0, the debounce check is not carried out.
Byte 6 defines the repeat interval in units of 100 ms for the event GPIO_EV_IN generation. Byte 6: REPEAT is used for pins with phase configuration set to GPIO_IN_EV_LEV_0 or GPIO_IN_EV_LEV_1. It is ignored for pins with other phase configurations. If Byte 6: REPEAT is non-zero , GPIO-24 adapter sends events each REPEAT*100 ms. For more detailed information see Section 6.1, “Digital Input Event”.
This byte is reserved for future usage and must be set to 0.
For convenience GPIO_SET_IN_CFG_CMD structure is declared in reports.h file.
GPIO-24 adapter sends GPIO_SET_IN_CFG response after command execution.
GPIO-24 adapter sends GPIO_SET_IN_CFG response after GPIO_SET_IN_CFG command execution. It contains the command execution status.
| Byte 0 | GPIO_SET _IN_CFG | Response ID (0x05). |
| Byte 1 | ECHO | Echo to associate a command with the response. |
| Byte 2 | ST | Status of the command execution. |
| Byte 3..7 | Reserved | Reserved. |
Response is an 8-byte array of the following format:
Response ID (response type). This byte will contain 0x05.
Echo byte copied from the corresponding command. It is used to associate the response with the specific command.
Status of the command execution:
GPIO_ST_SUCCESS (0x00) – The I/O pins were successfully configured.
GPIO_ST_INVALID_PORT (0x03) – Invalid port number has been specified.
These bytes are reserved for future usage.
For convenience GPIO_SET_IN_CFG_RSP structure is declared in reports.h file.