src/gpio.c
/**
 * @breif Assign GPIO pin as INPUT/OUTPUT
 *
 * Assign the given GPIO pin to read either input or output
 *
 * @param gpio GPIO pin number
 * @param direction Direction OUTPUT/INPUT to assign pin
 *
 * @return 0 on success, or -1 on failure and errno is set
 */
@breif Assign GPIO pin as INPUT/OUTPUT
Assign the given GPIO pin to read either input or output

@param gpio GPIO pin number
@param direction Direction OUTPUT/INPUT to assign pin

@return 0 on success, or -1 on failure and errno is set
@breif Assign GPIO pin as INPUT / OUTPUT Assign the given GPIO pin to read either input or output @param gpio GPIO pin number @param direction Direction OUTPUT / INPUT to assign pin @return 0 on success or - 1 on failure and errno is set
int gpio_set_dir(unsigned int gpio, unsigned int direction) {
	int fd = gpio_fd_open(gpio, SYSFS_GPIO_DIRECTION, O_WRONLY);
	if (fd < 0) {
		return fd;
	}
	if (direction == OUTPUT) {
		write(fd, "out", 4);
	} else {
		write(fd, "in", 3);
	}
	close(fd);
	return 0;
}
int gpio_set_dir ( unsigned int gpio , unsigned int direction ) { int fd = gpio_fd_open ( gpio , SYSFS_GPIO_DIRECTION , O_WRONLY ) ; if ( fd < 0 ) { return fd ; } if ( direction == OUTPUT ) { write ( fd , " " , 4 ) ; } else { write ( fd , " " , 3 ) ; } close ( fd ) ; return 0 ; }
@breif Assign GPIO pin as INPUT/OUTPUT
 Assign the given GPIO pin to read either input or output
@breif Assign GPIO pin as INPUT / OUTPUT Assign the given GPIO pin to read either input or output