librpipGpioConfigPinWrite

uint32_t librpipGpioConfigPinWrite(uint32_t pin, uint32_t flags);

Description

Configures a GPIO pin. There are three different aspects to the configuration. Pin direction, pull up/down and event detection. Note that it is not possible to read back the pull up/down status. They persists across power down when all registers get cleared. It is up to you to manage the pull up/down status.

Parameters

  • uint32_t pin
    The pin number to configure. The pin should be valid.
  • uint32_t flags
    Any of the LIBRPIP_GPIO_FLAG_* constants or’d together.

Returns

0 on failure, 1 on success.

Example

Setup GPIO pin 16 for output, disable pull up/down and disable event detect:

uint32_t feature_set;
feature_set = librpipInit(LIBRPIP_BOARD_DETECT, LIBRPIP_FLAG_DEBUG_ON, 0);
if(feature_set & LIBRPIP_FEATURE_GPIO) { 
        librpipGpioConfigPinWrite(16, LIBRPIP_GPIO_FLAG_FNC_OUT | 
                                      LIBRPIP_GPIO_FLAG_PUD_OFF | 
                                      LIBRPIP_GPIO_FLAG_ED_OFF);

}
librpipClose();