9.5. GPIO_GET_PWM_CFG (0x08)

The GPIO_GET_PWM_CFG command retrieves pulse width modulation (PWM) settings for specified I/O pin.

GPIO_GET_PWM_CFG Command

Go to Response

Byte 0GPIO_GET_PWM_CFGCommand ID (0x08).
Byte 1ECHOEcho to associate a command with the response.
Byte 2GPIOGPIO pin number.
Byte  3..7ReservedReserved (must be 0).

Command is an 8-byte array of the following format:

Byte 0: GPIO_GET_PWM_CFG (0x08)

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

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

GPIO pin number:

  • 0..7 corresponds to GPIO PORT A pins 0..7;

  • 8..15 corresponds to GPIO PORT B pins 0..7;

  • 16..23 corresponds to GPIO PORT C pins 0..7.

Bytes 3..7: Reserved

These bytes are reserved for future usage and must be set to 0.

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

GPIO-24 adapter sends GPIO_GET_PWM_CFG response after command execution. The PWM configuration settings are specified inside the response.

GPIO_GET_PWM_CFG Response

Go to Command

The GPIO_GET_PWM_CFG response contains PWM configuration settings for I/O pin specified in GPIO_GET_PWM_CFG command.

Byte 0 GPIO_GET_PWM_CFGResponse ID (0x08).
Byte 1ECHOEcho to associate a command with the response.
Byte 2STStatus of the command execution.
Byte 3GPIOGPIO pin number.
Byte 4T0LLow time of the pulse (least significant byte).
Byte 5T0HLow time of the pulse (most significant byte).
Byte 6T1LHigh time of the pulse (least significant byte).
Byte 7T1HHigh time of the pulse (most significant byte).

Response is an 8-byte array of the following format:

Byte 0: GPIO_GET_PWM_CFG (0x08)

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

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 pin PWM configuration settings were successfully retrieved.

  • GPIO_ST_INVALID_GPIO (0x02) – Invalid I/O pin number has been specified.

Byte 3: GPIO

GPIO pin number:

  • 0..7 corresponds to GPIO PORT A pins 0..7

  • 8..15 corresponds to GPIO PORT B pins 0..7

  • 16..23 corresponds to GPIO PORT C pins 0..7

Bytes 4, 5: T0L/T0H

Byte 4: T0L – least significant byte (low byte) of low time of the pulse.

Byte 5: T0H – most significant byte (high byte) of low time of the pulse.

Low time is a time period when the output equals to 0. It is specified in ms in the range from 1 to 65535 ms (65.535 seconds).

Bytes 6, 7: T1L/T1H

Byte 6: T1L – least significant byte (low byte) of high time of the pulse.

Byte 7: T1H – most significant byte (high byte) of high time of the pulse.

High time is a time period when the output equals to 1. It is specified in ms in the range from 1 to 65535 ms (65.535 seconds).

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