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
このサンプルは 「GR-LYCHEE」ではじめる電子工作 で紹介しています。
出版時と内容が異ならないよう、各ライブラリはアップデートせずに使用してください。
このサンプルの最新バージョンは下記から入手できます。最新バージョンは本の内容と一部処理が異なります。
https://github.com/d-kato/GR-Boards_WebCamera
Diff: main.cpp
- Revision:
- 15:eac4c3711aab
- Parent:
- 14:212f66386982
- Child:
- 16:b5469a6226c7
--- a/main.cpp Tue Apr 19 02:22:08 2016 +0000 +++ b/main.cpp Wed Jun 01 07:35:41 2016 +0000 @@ -2,7 +2,6 @@ #include "DisplayBace.h" #include "rtos.h" #include "JPEG_Converter.h" -#include "EthernetInterface.h" #include "HTTPServer.h" #include "mbed_rpc.h" #include "RomRamFileSystem.h" @@ -23,6 +22,12 @@ #define SUBNET_MASK ("255.255.255.0") /* Subnet mask */ #define DEFAULT_GATEWAY ("192.168.0.3") /* Default gateway */ #endif +#define NETWORK_TYPE (0) /* Select 0(EthernetInterface) or 1(GR_PEACH_WlanBP3595) */ +#if (NETWORK_TYPE == 1) + #define WLAN_SSID ("SSIDofYourAP") /* SSID */ + #define WLAN_PSK ("PSKofYourAP") /* PSK(Pre-Shared Key) */ + #define WLAN_SECURITY NSAPI_SECURITY_WPA2 /* NSAPI_SECURITY_NONE, NSAPI_SECURITY_WEP, NSAPI_SECURITY_WPA or NSAPI_SECURITY_WPA2 */ +#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 */ @@ -52,7 +57,16 @@ #define VIDEO_BUFFER_STRIDE (((PIXEL_HW * DATA_SIZE_PER_PIC) + 31u) & ~31u) #define VIDEO_BUFFER_HEIGHT (PIXEL_VW) -EthernetInterface network; +#if (NETWORK_TYPE == 0) + #include "EthernetInterface.h" + EthernetInterface network; +#elif (NETWORK_TYPE == 1) + #include "GR_PEACH_WlanBP3595.h" + GR_PEACH_WlanBP3595 network; + DigitalOut usb1en(P3_8); +#else + #error NETWORK_TYPE error +#endif /* NETWORK_TYPE */ RomRamFileSystem romramfs("romram"); #if defined(__ICCARM__) @@ -280,7 +294,8 @@ } static void TerminalWrite(Arguments* arg, Reply* r) { - printf("%s\n",arg->argv[0]); + printf("touch count=%s, %s\n", arg->argv[0], arg->argv[1]); + r->putData<const char*>("ok"); } static void mount_romramfs(void) { @@ -376,6 +391,14 @@ RPCFunction rpcFunc(TerminalWrite, "TerminalWrite"); RPCFunction rpcSetI2C(SetI2CfromWeb, "SetI2CfromWeb"); +#if (NETWORK_TYPE == 1) + //Audio Camera Shield USB1 enable for WlanBP3595 + usb1en = 1; //Outputs high level + Thread::wait(5); + usb1en = 0; //Outputs low level + Thread::wait(5); +#endif + printf("Network Setting up...\r\n"); #if (USE_DHCP == 1) if (network.init() != 0) { //for DHCP Server @@ -385,7 +408,11 @@ printf("Network Initialize Error \r\n"); return -1; } +#if (NETWORK_TYPE == 0) if (network.connect() != 0) { +#else + if (network.connect(WLAN_SSID, WLAN_PSK, WLAN_SECURITY) != 0) { +#endif printf("Network Connect Error \r\n"); return -1; }