FILE *bin;
  bin=fopen("header.bmp", "a");
  int fd_22=open("/sys/class/gpio/gpio22/value", O_WRONLY);

for(k=0; k<153600; k++){
   fd_45=open("/sys/class/gpio/gpio45/value", O_RDONLY);
   fd_44=open("/sys/class/gpio/gpio44/value", O_RDONLY);
   fd_23=open("/sys/class/gpio/gpio23/value", O_RDONLY);
   fd_26=open("/sys/class/gpio/gpio26/value", O_RDONLY);
   fd_47=open("/sys/class/gpio/gpio47/value", O_RDONLY);
   fd_46=open("/sys/class/gpio/gpio46/value", O_RDONLY);
   fd_27=open("/sys/class/gpio/gpio27/value", O_RDONLY);
   fd_65=open("/sys/class/gpio/gpio65/value", O_RDONLY);
   write(fd_22, "0", 1);
   write(fd_22, "1", 1);
   bit_value=0;
   read(fd_45, &ch0, 1);
   read(fd_44, &ch1, 1);
   read(fd_23, &ch2, 1);
   read(fd_26, &ch3, 1);
   read(fd_47, &ch4, 1);
   read(fd_46, &ch5, 1);
   read(fd_27, &ch6, 1);
   read(fd_65, &ch7, 1);
   ch0 -= '0';
   ch1 -= '0';
   ch2 -= '0';
   ch3 -= '0';
   ch4 -= '0';
   ch5 -= '0';
   ch6 -= '0';
   ch7 -= '0';
   if(ch0) {bit_value |= (1<<0);}
   if(ch1) {bit_value |= (1<<1);}
   if(ch2) {bit_value |= (1<<2);}
   if(ch3) {bit_value |= (1<<3);}
   if(ch4) {bit_value |= (1<<4);}
   if(ch5) {bit_value |= (1<<5);}
   if(ch6) {bit_value |= (1<<6);}
   if(ch7) {bit_value |= (1<<7);}

   fprintf(bin , "%c", bit_value);
  close(fd_45);
  close(fd_44);
  close(fd_23);
  close(fd_26);
  close(fd_47);
  close(fd_46);
  close(fd_27);
  close(fd_65);
  }


I making the camera from the Beagle bone black
but, My source is very slow 

fopen fclose is because repeat in for(; ; ) 
So I want to improve the speed.

what should i do ?

-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to beagleboard+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to