You are here

GPIO_SET_IN_CFG (0x05)

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.

GPIO_SET_IN_CFG Command

Go to Response

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:

Byte 0: GPIO_SET_IN_CFG (0x05)

This byte contains command ID (command type). It should be set to 0x05.

Byte 1: ECHO

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.

Byte 2: PORT

GPIO PORT:

  • 0 – GPIO PORT A

  • 1 – GPIO PORT B

  • 2 – GPIO PORT C

Byte 3: MASK

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.

Byte 4: PHASE

Phase configuration, which determines the conditions when GPIO-24 adapter sends GPIO_EV_IN event.

The following values are available for this byte:

Byte 5: DEBOUNCE

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: REPEAT

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”.

Byte 7: Reserved

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_SET_IN_CFG Response

Go to Command

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:

Byte 0: GPIO_SET_IN_CFG (0x05)

Response ID (response type). This byte will contain 0x05.

Byte 1: ECHO

Echo byte copied from the corresponding command. It is used to associate the response with the specific command.

Byte 2: ST

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.

Bytes 3..7: Reserved

These bytes are reserved for future usage.

For convenience GPIO_SET_IN_CFG_RSP structure is declared in reports.h file.