src/gpio.c
/**
 * @brief Set GPIO value to HIGH/LOW
 * 
 * Set the given GPIO pin value to either high or low
 *
 * @param gpio GPIO pin number
 * @param value Pin value to set
 *
 * @return 0 on success, or -1 on failure and errno is set
 */
@brief Set GPIO value to HIGH/LOW

Set the given GPIO pin value to either high or low

@param gpio GPIO pin number
@param value Pin value to set

@return 0 on success, or -1 on failure and errno is set
@brief Set GPIO value to HIGH / LOW Set the given GPIO pin value to either high or low @param gpio GPIO pin number @param value Pin value to set @return 0 on success or - 1 on failure and errno is set
int gpio_write(unsigned int gpio, unsigned int value) {
	int fd = gpio_fd_open(gpio, SYSFS_GPIO_VALUE, O_WRONLY);
	if (fd < 0) {
		return fd;
	}
	if (value == LOW) {
		write(fd, "0", 2);
	} else {
		write(fd, "1", 2);
	}
	close(fd);
	return 0;
}
int gpio_write ( unsigned int gpio , unsigned int value ) { int fd = gpio_fd_open ( gpio , SYSFS_GPIO_VALUE , O_WRONLY ) ; if ( fd < 0 ) { return fd ; } if ( value == LOW ) { write ( fd , " " , 2 ) ; } else { write ( fd , " " , 2 ) ; } close ( fd ) ; return 0 ; }
@brief Set GPIO value to HIGH/LOW
@brief Set GPIO value to HIGH / LOW