Del via


GPIO_SetValue Function

Header: #include <applibs/gpio.h>

Sets the output value for an output GPIO. Only has an effect on GPIOs opened as outputs.

GPIO functions are thread-safe between calls to different GPIOs; however, it is the caller’s responsibility to ensure thread safety for accesses to the same GPIO.

int GPIO_SetValue(int gpioFd, GPIO_Value_Type value);

Parameters

  • gpioFd The file descriptor for the GPIO.

  • value The GPIO_Value value to set - GPIO_Value_High or GPIO_Value_Low.

Errors

Returns -1 if an error is encountered and sets errno to the error value.

  • EINVAL: the value is not a GPIO_Value.

  • EBADF: the gpioFd is not valid.

Any other errno may also be specified; such errors aren't deterministic and the same behavior might not be retained through system updates.

Return value

Returns 0 for success, or -1 for failure, in which case errno will be set to the error value.

Application manifest requirements

To access individual GPIOs, your application must identify them in the Gpio field of the application manifest.