for OV5642

Dependencies:   EthernetInterface FATFileSystem GR-PEACH_video GraphicsFramework HttpServer_snapshot R_BSP mbed-rpc mbed-rtos mbed

Files at this revision

API Documentation at this revision

Comitter:
dkato
Date:
Thu Mar 03 10:13:39 2016 +0000
Parent:
10:3a176dc33f74
Child:
12:6c002b871c4d
Commit message:
Add the "Network setting" to "User Selection".

Changed in this revision

EthernetInterface.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed-rtos.lib Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- a/EthernetInterface.lib	Wed Jan 27 09:05:19 2016 +0000
+++ b/EthernetInterface.lib	Thu Mar 03 10:13:39 2016 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/mbed_official/code/EthernetInterface/#2fc406e2553f
+http://mbed.org/users/mbed_official/code/EthernetInterface/#4d7bff17a592
--- a/main.cpp	Wed Jan 27 09:05:19 2016 +0000
+++ b/main.cpp	Thu Mar 03 10:13:39 2016 +0000
@@ -9,9 +9,6 @@
 #include "file_table.h"        //Binary data of web pages
 #include "i2c_setting.h"
 
-RomRamFileSystem romramfs("romram");
-EthernetInterface eth;
-
 #define VIDEO_CVBS             (0)                 /* Analog  Video Signal */
 #define VIDEO_CMOS_CAMERA      (1)                 /* Digital Video Signal */
 #define VIDEO_YCBCR422         (0)
@@ -19,6 +16,14 @@
 #define VIDEO_RGB565           (2)
 
 /**** User Selection *********/
+/** Network setting **/
+#define USE_DHCP               (1)                 /* Select  0(static configuration) or 1(use DHCP) */
+#if (USE_DHCP == 0)
+  #define IP_ADDRESS           ("192.168.0.2")     /* IP address      */
+  #define SUBNET_MASK          ("255.255.255.0")   /* Subnet mask     */
+  #define DEFAULT_GATEWAY      ("192.168.0.3")     /* Default gateway */
+#endif
+/** Camera setting **/
 #define VIDEO_INPUT_METHOD     (VIDEO_CMOS_CAMERA) /* Select  VIDEO_CVBS or VIDEO_CMOS_CAMERA                       */
 #define VIDEO_INPUT_FORMAT     (VIDEO_YCBCR422)    /* Select  VIDEO_YCBCR422 or VIDEO_RGB888 or VIDEO_RGB565        */
 #define USE_VIDEO_CH           (0)                 /* Select  0 or 1            If selecting VIDEO_CMOS_CAMERA, should be 0.)               */
@@ -47,7 +52,8 @@
 #define VIDEO_BUFFER_STRIDE    (((PIXEL_HW * DATA_SIZE_PER_PIC) + 31u) & ~31u)
 #define VIDEO_BUFFER_HEIGHT    (PIXEL_VW)
 
-DigitalIn  button(USER_BUTTON0);
+EthernetInterface network;
+RomRamFileSystem romramfs("romram");
 
 static uint8_t FrameBuffer_Video[VIDEO_BUFFER_STRIDE * VIDEO_BUFFER_HEIGHT]__attribute((section("NC_BSS"),aligned(16)));  //16 bytes aligned!;
 static volatile int32_t vsync_count = 0;
@@ -353,20 +359,24 @@
     RPCFunction rpcFunc(TerminalWrite, "TerminalWrite");
     RPCFunction rpcSetI2C(SetI2CfromWeb, "SetI2CfromWeb");
 
-    printf("EthernetInterface Setting up...\r\n");
-    if (eth.init() != 0) {                             //for DHCP Server
-//    if (eth.init("192.168.0.2","255.255.255.0","192.168.0.3") != 0) { //for Static IP Address (IPAddress, NetMasks, Gateway)
-        printf("EthernetInterface Initialize Error \r\n");
+    printf("Network Setting up...\r\n");
+#if (USE_DHCP == 1)
+    if (network.init() != 0) {                             //for DHCP Server
+#else
+    if (network.init(IP_ADDRESS, SUBNET_MASK, DEFAULT_GATEWAY) != 0) { //for Static IP Address (IPAddress, NetMasks, Gateway)
+#endif
+        printf("Network Initialize Error \r\n");
         return -1;
     }
-    if (eth.connect() != 0) {
-        printf("EthernetInterface Connect Error \r\n");
+    if (network.connect() != 0) {
+        printf("Network Connect Error \r\n");
         return -1;
     }
-    printf("IP Address is %s\r\n", eth.getIPAddress());
-    printf("NetMask is %s\r\n", eth.getNetworkMask());
-    printf("Gateway Address is %s\r\n", eth.getGateway());
-    printf("Ethernet Setup OK\r\n");
+    printf("MAC Address is %s\r\n", network.getMACAddress());
+    printf("IP Address is %s\r\n", network.getIPAddress());
+    printf("NetMask is %s\r\n", network.getNetworkMask());
+    printf("Gateway Address is %s\r\n", network.getGateway());
+    printf("Network Setup OK\r\n");
 
     SnapshotHandler::attach_req(&snapshot_req);
     HTTPServerAddHandler<SnapshotHandler>("/camera"); //Camera
--- a/mbed-rtos.lib	Wed Jan 27 09:05:19 2016 +0000
+++ b/mbed-rtos.lib	Thu Mar 03 10:13:39 2016 +0000
@@ -1,1 +1,1 @@
-http://developer.mbed.org/users/mbed_official/code/mbed-rtos/#3d9d2b8b8f17
+http://developer.mbed.org/users/mbed_official/code/mbed-rtos/#dfc27975e193
--- a/mbed.bld	Wed Jan 27 09:05:19 2016 +0000
+++ b/mbed.bld	Thu Mar 03 10:13:39 2016 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/mbed_official/code/mbed/builds/6f327212ef96
\ No newline at end of file
+http://mbed.org/users/mbed_official/code/mbed/builds/87f2f5183dfb
\ No newline at end of file