Web Camera for mbed-os. When you use this program, we judge you have agreed to the following contents. https://developer.mbed.org/teams/Renesas/wiki/About-LICENSE

Dependencies:   HttpServer_snapshot_mbed-os LWIPBP3595Interface_STA_for_mbed-os RomRamBlockDevice mbed-rpc

Fork of GR-Boards_WebCamera by Renesas

このサンプルは 「GR-LYCHEE」ではじめる電子工作 で紹介しています。
出版時と内容が異ならないよう、各ライブラリはアップデートせずに使用してください。

このサンプルの最新バージョンは下記から入手できます。最新バージョンは本の内容と一部処理が異なります。
https://github.com/d-kato/GR-Boards_WebCamera

Revision:
5:34d84609dd60
Parent:
4:487e6c5bea1e
Child:
6:7ec90cc47dc4
--- a/main.cpp	Tue Oct 20 06:28:50 2015 +0000
+++ b/main.cpp	Fri Oct 23 11:03:49 2015 +0000
@@ -1,5 +1,5 @@
 #if defined(__CC_ARM)
-#pragma Ospace
+#pragma O0
 #endif
 #include "mbed.h"
 #include "DisplayBace.h"
@@ -10,6 +10,7 @@
 #include "mbed_rpc.h"
 #include "RomRamFileSystem.h"
 #include "file_table.h"        //Binary data of web pages
+#include "i2c_setting.h"
 
 RomRamFileSystem romramfs("romram");
 EthernetInterface eth;
@@ -62,6 +63,8 @@
 static int jcu_buf_index_write_done = 0;
 static int jcu_buf_index_read = 0;
 static int jcu_encoding = 0;
+static char recv_web_buffer[RECV_BUF_SIZE];
+static int32_t web_buf_offset;
 
 static void JcuEncodeCallBackFunc(JPEG_Converter::jpeg_conv_error_t err_code) {
     jcu_buf_index_write_done = jcu_buf_index_write;
@@ -290,11 +293,59 @@
     fp = fopen("/romram/led.htm", "w");
     fwrite(led_htm_tbl, sizeof(char), sizeof(led_htm_tbl), fp);
     fclose(fp);
+
+    //i2c_set.htm
+    fp = fopen("/romram/i2c_set.htm", "w");
+    fwrite(i2c_set_htm_tbl, sizeof(char), sizeof(i2c_set_htm_tbl), fp);
+    fclose(fp);
+
+    //web_top.htm
+    fp = fopen("/romram/web_top.htm", "w");
+    fwrite(web_top_htm_tbl, sizeof(char), sizeof(web_top_htm_tbl), fp);
+    fclose(fp);
+
+    //menu.htm
+    fp = fopen("/romram/menu.htm", "w");
+    fwrite(menu_htm_tbl, sizeof(char), sizeof(menu_htm_tbl), fp);
+    fclose(fp);
+
+    //window.htm
+    fp = fopen("/romram/window.htm", "w");
+    fwrite(window_htm_tbl, sizeof(char), sizeof(window_htm_tbl), fp);
+    fclose(fp);
+}
+
+static void SetI2CfromWeb(Arguments* arg, Reply* r) {
+    size_t len_arg[2];
+
+    if (*(arg->argv[0]) != 0) {
+        if (*(arg->argv[1]) != 0) {
+            DEBUGPRINT("%s,%s\n", arg->argv[0], arg->argv[1]);
+        } else {
+            DEBUGPRINT("%s\n", arg->argv[0]);
+        }
+
+        len_arg[0] = strlen(arg->argv[0]);
+        len_arg[1] = strlen(arg->argv[1]);
+
+        web_buf_offset = 0;
+        memcpy(&recv_web_buffer[0], arg->argv[0], len_arg[0]);
+        web_buf_offset = len_arg[0];
+        memset(&recv_web_buffer[web_buf_offset], ',', 1);
+        web_buf_offset++;
+        memcpy(&recv_web_buffer[web_buf_offset], arg->argv[1], len_arg[1]);
+        web_buf_offset += len_arg[1];
+        /* command analysis and execute */
+        analy_and_exe(&recv_web_buffer[0]);
+    }
 }
 
 int main(void) {
     printf("********* PROGRAM START ***********\r\n");
 
+    /* Please enable this line when performing the setting from the Terminal side. */
+//    Thread thread(SetI2CfromTerm, NULL, osPriorityBelowNormal, DEFAULT_STACK_SIZE);
+
     mount_romramfs();   //RomRamFileSystem Mount
     camera_start();     //Camera Start
 
@@ -303,10 +354,11 @@
     RPC::construct<RpcDigitalOut, PinName, const char*>(LED2, "led2");
     RPC::construct<RpcDigitalOut, PinName, const char*>(LED3, "led3");
     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)
+//    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");
         return -1;
     }