Test Code for OV7670 Camera module. The images are sent over ethernet link.

Dependencies:   EthernetInterface mbed-rtos mbed ov7670

You can find more information in this page: https://mbed.org/users/edodm85/notebook/ov7670-camera-and-ethernet-stream/

Committer:
edodm85
Date:
Mon Jul 15 20:51:31 2013 +0000
Revision:
0:2208b72b1ba1
Child:
2:d6b38a4512eb
First Rev

Who changed what in which revision?

UserRevisionLine numberNew contents of line
edodm85 0:2208b72b1ba1 1 #pragma once
edodm85 0:2208b72b1ba1 2 #include "mbed.h"
edodm85 0:2208b72b1ba1 3 #include "ov7670.h"
edodm85 0:2208b72b1ba1 4 #include "EthernetInterface.h"
edodm85 0:2208b72b1ba1 5
edodm85 0:2208b72b1ba1 6
edodm85 0:2208b72b1ba1 7 #define ECHO_SERVER_PORT 2000
edodm85 0:2208b72b1ba1 8
edodm85 0:2208b72b1ba1 9
edodm85 0:2208b72b1ba1 10 Timer t;
edodm85 0:2208b72b1ba1 11 bool new_send = false;
edodm85 0:2208b72b1ba1 12
edodm85 0:2208b72b1ba1 13 DigitalOut led1(LED1);
edodm85 0:2208b72b1ba1 14 DigitalOut led2(LED2);
edodm85 0:2208b72b1ba1 15 DigitalOut led3(LED3);
edodm85 0:2208b72b1ba1 16 DigitalOut led4(LED4);
edodm85 0:2208b72b1ba1 17
edodm85 0:2208b72b1ba1 18 //Camera
edodm85 0:2208b72b1ba1 19 OV7670 camera
edodm85 0:2208b72b1ba1 20 (
edodm85 0:2208b72b1ba1 21 p28,p27, // SDA,SCL(I2C / SCCB)
edodm85 0:2208b72b1ba1 22 p23,p24,p25, // VSYNC,HREF,WEN(FIFO)
edodm85 0:2208b72b1ba1 23 Port0,0x07878000, // PortIn data p18(P0.26),p17(P0.25),p16(P0.24),p15(P0.23),p11(P0.18),p12(P0.17),p14(P0.16),p13(P0.15)
edodm85 0:2208b72b1ba1 24 p26,p29,p30 // RRST,OE,RCLK
edodm85 0:2208b72b1ba1 25 );
edodm85 0:2208b72b1ba1 26
edodm85 0:2208b72b1ba1 27 //ETHERNET
edodm85 0:2208b72b1ba1 28 char* ip = "192.168.153.153"; // ip
edodm85 0:2208b72b1ba1 29 char* mask = "255.255.255.0"; // mask
edodm85 0:2208b72b1ba1 30 char* gateway = "192.168.153.5"; // gateway
edodm85 0:2208b72b1ba1 31 EthernetInterface eth;
edodm85 0:2208b72b1ba1 32 TCPSocketConnection client;
edodm85 0:2208b72b1ba1 33 TCPSocketServer server;
edodm85 0:2208b72b1ba1 34
edodm85 0:2208b72b1ba1 35 //ETHERNET BUFFER
edodm85 0:2208b72b1ba1 36 char bufferRX[20];
edodm85 0:2208b72b1ba1 37 char bufferTX[9600];
edodm85 0:2208b72b1ba1 38
edodm85 0:2208b72b1ba1 39 //RESET
edodm85 0:2208b72b1ba1 40 extern "C" void mbed_reset();
edodm85 0:2208b72b1ba1 41
edodm85 0:2208b72b1ba1 42 //TIMER
edodm85 0:2208b72b1ba1 43 int t1 = 0;
edodm85 0:2208b72b1ba1 44 int t2 = 0;
edodm85 0:2208b72b1ba1 45
edodm85 0:2208b72b1ba1 46 //THREAD
edodm85 0:2208b72b1ba1 47 void net_thread(void const *argument);
edodm85 0:2208b72b1ba1 48 osThreadDef(net_thread, osPriorityNormal, DEFAULT_STACK_SIZE);
edodm85 0:2208b72b1ba1 49
edodm85 0:2208b72b1ba1 50 //FUNCTION
edodm85 0:2208b72b1ba1 51 void Send();
edodm85 0:2208b72b1ba1 52 void parse_cmd();
edodm85 0:2208b72b1ba1 53 void CameraSnap();