Function rc_gpio_init_event#

Function Documentation#

int rc_gpio_init_event(int chip, int pin, int handle_flags, int event_flags)#

Initializes a pin for interrupt event polling and normal reading.

Handle flags exists if the user wishes to configure the pic as active-low, open-source, or open-drain. This is usually not necessary and can be left at 0. This function returns the file descriptor used for polling in case the user wants to use a polling method other than rc_gpio_poll.

Parameters:
  • chip[in] The chip number, /dev/gpiochipX

  • pin[in] The pin ID

  • handle_flags[in] Additional pin configuration flags, this can usually be left as 0

  • event_flags[in] The event flags, GPIOEVENT_REQUEST_RISING_EDGE, GPIOEVENT_REQUEST_FALLING_EDGE, or GPIOEVENT_REQUEST_BOTH_EDGES

Returns:

File descriptor for the GPIO event or -1 on failure