Version 3: Trying to interleave capture and read
Dependencies: ov7670_lib Project_test
Revision 9:bfd025b059ab, committed 2020-06-22
- Comitter:
- sebbarpar
- Date:
- Mon Jun 22 11:07:45 2020 +0000
- Parent:
- 8:36adb37e976d
- Commit message:
- Coomit
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
ov7670.lib | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Sat Jun 20 11:07:07 2020 +0000 +++ b/main.cpp Mon Jun 22 11:07:45 2020 +0000 @@ -13,8 +13,14 @@ #define columns 160 static char format = ' '; static int resolution = 0; +int capturing=0; EthernetInterface net; UDPSocket sock; +EventFlags signals; +Thread h; +int capt=0; + +#define href_en 0x01 void ether(){ //net.connect(); @@ -23,13 +29,30 @@ sock.open(&net); } +void hrefen(){ + short int pixel[160]; + while(1){ + if(capturing){ + for(int j=0; j<columns; j++){ + camera.ReadOnebyte(); + pixel[j]=camera.ReadOnebyte(); + pc.printf("%d ", pixel[j]); + } + //sock.sendto("192.168.1.4", 1001, pixel, sizeof(pixel)); + capturing=0; + } + } + +} +void OV7670::HrefHandler(void) +{ + if(capt){capturing=1;} +} int main() { char fin[]="Finished"; - int pixel[160]; - int pix[160]; - //uint_8 p[160]; + h.start(hrefen); ether(); camera.Init('y', QQVGA); pc.printf("\r\nCamera initiated\r\n"); @@ -38,24 +61,24 @@ while(1){ t.reset(); t.start(); + camera.ReadStart(); camera.CaptureNext(); - pc.printf("\r\nDone in %f\r\n",t.read()); - while(camera.CaptureDone() == false); - camera.ReadStart(); + while(camera.CaptureDone() == false){capt=1;}; + capt=0; led1=0; + camera.ReadStop(); //wait(1); - for(int x = 0; x<lines; x++){ + /*for(int x = 0; x<lines; x++){ for(int j=0; j<columns; j++){ camera.ReadOnebyte(); pixel[j]=camera.ReadOnebyte(); //pc.printf("%d", pixel[j]); } //sock.sendto("192.168.1.4", 1001, pixel, sizeof(pixel)); - //pc.printf("%d", a); - } + }*/ //sock.sendto("192.168.1.4", 1001, fin, sizeof(fin)); led1=1; - camera.ReadStop(); + pc.printf("\r\nDone in %f\r\n",t.read()); wait(1); } } \ No newline at end of file
--- a/ov7670.lib Sat Jun 20 11:07:07 2020 +0000 +++ b/ov7670.lib Mon Jun 22 11:07:45 2020 +0000 @@ -1,1 +1,1 @@ -https://os.mbed.com/users/sebbarpar/code/ov7670_lib/#b1b77891bddf +https://os.mbed.com/users/sebbarpar/code/ov7670_lib/#2ca4f55b5ac2