전시회용

Dependencies:   PWM_Tone_Library SDFileSystem WIZnetInterface httpServer_orgel mbed

Fork of Internet_Orgel by justin kim

Committer:
justinkim
Date:
Fri Oct 21 04:02:53 2016 +0000
Revision:
28:f87145f80660
Parent:
27:47ba03e9786b
dz

Who changed what in which revision?

UserRevisionLine numberNew contents of line
justinkim 8:f837e0d255e8 1 #include "mbed.h"
justinkim 8:f837e0d255e8 2 #include "EthernetInterface.h"
hjjeon 14:9202a7785974 3 #include "FsHandler.h"
hjjeon 14:9202a7785974 4 #include "HTTPServer.h"
hjjeon 14:9202a7785974 5 #include "SDFileSystem.h"
hjjeon 9:a63ff95c354b 6
justinkim 27:47ba03e9786b 7 #define DHCP
justinkim 27:47ba03e9786b 8
justinkim 27:47ba03e9786b 9 #if defined(TARGET_WIZWIKI_W7500)||defined(TARGET_WIZWIKI_W7500P)||defined(TARGET_WIZWIKI_W7500ECO)
hjjeon 17:be86c9b2cbda 10 //Choose one of file system.
hjjeon 14:9202a7785974 11 SDFileSystem local(SD_MOSI, SD_MISO, SD_CLK, SD_SEL, "local");//PB_3, PB_2, PB_1, PB_0
hjjeon 17:be86c9b2cbda 12 //LocalFileSystem local("local");
hjjeon 14:9202a7785974 13 #endif
hjjeon 9:a63ff95c354b 14
justinkim 27:47ba03e9786b 15 #if defined(TARGET_WIZWIKI_W7500)||defined(TARGET_WIZWIKI_W7500P)||defined(TARGET_WIZWIKI_W7500ECO)
justinkim 27:47ba03e9786b 16 uint8_t mac_addr[6] = {0x00, 0x08, 0xDC, 0xff, 0xff, 0x11};
hjjeon 14:9202a7785974 17 #endif
hjjeon 14:9202a7785974 18
hjjeon 14:9202a7785974 19 EthernetInterface eth;
hjjeon 14:9202a7785974 20 HTTPServer svr;
justinkim 27:47ba03e9786b 21 char ip_addr[] = "192.168.240.112";
hjjeon 14:9202a7785974 22 char subnet_mask[] = "255.255.255.0";
irinakim 21:a5e91b90d7a3 23 char gateway_addr[] = "192.168.240.1";
hjjeon 14:9202a7785974 24
hjjeon 15:0091888ada99 25 //#define DHCP //If uncomment, W7500 runs DHCP
hjjeon 14:9202a7785974 26
hjjeon 14:9202a7785974 27 int main()
justinkim 8:f837e0d255e8 28 {
justinkim 19:0ea7e7a9ebae 29 HTTPFsRequestHandler::mount_eth(&eth);
hjjeon 14:9202a7785974 30 HTTPFsRequestHandler::mount("/local/", "/");
hjjeon 14:9202a7785974 31 svr.addHandler<HTTPFsRequestHandler>("/");
hjjeon 14:9202a7785974 32
justinkim 27:47ba03e9786b 33 #if defined(TARGET_WIZWIKI_W7500)||defined(TARGET_WIZWIKI_W7500ECO)||defined(TARGET_WIZWIKI_W7500P)
hjjeon 14:9202a7785974 34
hjjeon 14:9202a7785974 35 #ifdef DHCP
hjjeon 14:9202a7785974 36 eth.init(mac_addr); //Use DHCP
hjjeon 14:9202a7785974 37 #else
hjjeon 14:9202a7785974 38 eth.init(mac_addr, ip_addr, subnet_mask, gateway_addr); //Not Use DHCP
hjjeon 14:9202a7785974 39 #endif
hjjeon 14:9202a7785974 40
hjjeon 14:9202a7785974 41 #else
hjjeon 14:9202a7785974 42
hjjeon 14:9202a7785974 43 #ifdef DHCP
hjjeon 14:9202a7785974 44 eth.init(); //Use DHCP
hjjeon 14:9202a7785974 45 #else
hjjeon 14:9202a7785974 46 eth.init(ip_addr, subnet_mask, gateway_addr); //Not Use DHCP
hjjeon 14:9202a7785974 47 #endif
hjjeon 14:9202a7785974 48
hjjeon 14:9202a7785974 49 #endif
hjjeon 14:9202a7785974 50
hjjeon 18:5d96484995cf 51 printf("Check Ethernet Link\r\n");
hjjeon 18:5d96484995cf 52 while(1) //Wait link up
hjjeon 18:5d96484995cf 53 {
hjjeon 18:5d96484995cf 54 if(eth.link() == true)
hjjeon 18:5d96484995cf 55 break;
hjjeon 18:5d96484995cf 56 }
hjjeon 18:5d96484995cf 57 printf("Link up\r\n");
hjjeon 14:9202a7785974 58
justinkim 8:f837e0d255e8 59 eth.connect();
justinkim 8:f837e0d255e8 60 printf("Server IP Address is %s\r\n", eth.getIPAddress());
hjjeon 14:9202a7785974 61
hjjeon 14:9202a7785974 62 if (!svr.start(80, &eth)) {
hjjeon 14:9202a7785974 63
hjjeon 14:9202a7785974 64 error("Server not starting !");
hjjeon 14:9202a7785974 65 exit(0);
hjjeon 14:9202a7785974 66 }
hjjeon 14:9202a7785974 67
hjjeon 14:9202a7785974 68 while(1) {
hjjeon 14:9202a7785974 69 svr.poll();
hjjeon 14:9202a7785974 70 }
hjjeon 12:d1e2995ca5f6 71
justinkim 8:f837e0d255e8 72 }
justinkim 8:f837e0d255e8 73