Changeset 17100
- Timestamp:
- 05/21/11 12:15:51 (2 years ago)
- File:
-
- 1 edited
-
src/router/libutils/gpio.c (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/router/libutils/gpio.c
r16345 r17100 61 61 sprintf(buf, "/proc/gpio/%d_out", gpio); 62 62 } else { 63 sprintf(buf, "/proc/wl0gpio/%d_out", (gpio -GPIOMAX));63 sprintf(buf, "/proc/wl0gpio/%d_out", (gpio - GPIOMAX)); 64 64 } 65 65 #undef GPIOMAX … … 128 128 } 129 129 130 /*130 /* 131 131 * Config bit as output 132 132 */ … … 142 142 return; 143 143 } 144 /*144 /* 145 145 * Write data 146 146 */ … … 154 154 strerror(errno), errno); 155 155 } 156 // fprintf(stderr,"done\n");156 // fprintf(stderr,"done\n"); 157 157 158 158 close(file); … … 701 701 void set_gpio(int pin, int value) 702 702 { 703 int fd;704 if ((fd = open("/dev/misc/gpio", O_RDWR)) < 0) {705 printf("Error whilst opening /dev/gpio\n");706 return;707 }708 703 709 704 switch (pin) { … … 714 709 break; 715 710 default: 711 int fd; 712 if ((fd = open("/dev/misc/gpio", O_RDWR)) < 0) { 713 printf("Error whilst opening /dev/gpio\n"); 714 return; 715 } 716 716 ioctl(fd, GPIO_DIR_OUT, pin); 717 717 if (value) … … 719 719 else 720 720 ioctl(fd, GPIO_CLEAR, pin); 721 break;722 }723 close(fd);721 close(fd); 722 break; 723 } 724 724 } 725 725
Note: See TracChangeset
for help on using the changeset viewer.
