gpio_get_info()

Get the GPIO information of a pin

Synopsis:

#include <hw/gpio_api.h>

gpio_level_t gpio_get_level( int32_t gpio_fd,
                             gpio_header_t hdr
                             gpio_info_t *info );

Arguments:

gpio_fd
The file descriptor of a GPIO device.
hdr
The GPIO header identifying a GPIO pin.
info
A pointer to a structure to receive the GPIO information.

Description:

The gpio_get_info() function gets the following GPIO information of a pin:
  • direction
  • logic level
  • enable state
  • pull configuration
  • interrupt trigger type
  • debounce setting
  • function select value

Returns:

0 on success, or -1 if an error occurs (errno is set).

Errors:

EINVAL
The info pointer is NULL.
Note:
If any individual API call fails, its corresponding field in the info structure is set to GPIO_UNSET (-1). Since multiple failures may occur, the errno value associated with individual failures isn't preserved.
Page updated: