My fork of the DGWWebServer (working)
Dependencies: FATFileSystem HTTPServer RingBuffer SDFileSystem mbed
Revision 0:f5e843f0507e, committed 2012-11-20
- Comitter:
- screamer
- Date:
- Tue Nov 20 12:20:01 2012 +0000
- Child:
- 1:1abf87ed75f1
- Commit message:
- initial revision
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/FATFileSystem.lib Tue Nov 20 12:20:01 2012 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_unsupported/code/FatFileSystem/#a3c0bfc113b2
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/HTTPServer.lib Tue Nov 20 12:20:01 2012 +0000 @@ -0,0 +1,1 @@ +HTTPServer#284f2df30cf9
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/RingBuffer.lib Tue Nov 20 12:20:01 2012 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/ykuroda/code/RingBuffer/#1c3a10f2eb04
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/SDFileSystem.lib Tue Nov 20 12:20:01 2012 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_unsupported/code/SDFileSystem/#6afe57e15f1a
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Tue Nov 20 12:20:01 2012 +0000 @@ -0,0 +1,58 @@ +#include "SDFileSystem.h" + +#include "mbed.h" + +#include "HTTPServer.h" + +#include "HTTPRPC.h" +#include "HTTPFS.h" +#include "HTTPStaticPage.h" + +#include "SDFileSystem.h" + +#include <string.h> + +const char content[] = "<HTML><BODY><H1>Hello World</H1></BODY></HTML>"; + +HTTPServer http; +DigitalOut myled1(LED1), myled2(LED2), myled3(LED3), myled4(LED4); +LocalFileSystem local("local"); +SDFileSystem sd(p5, p6, p7, p8, "sd"); + +void SetConsole38400(void) +{ + uint8_t lcrSave = LPC_UART0->LCR; + LPC_UART0->LCR |= 0x80; + uint16_t oldDLValue = LPC_UART0->DLM * 256 + LPC_UART0->DLL; + uint8_t oldFDRValue = LPC_UART0->FDR; + LPC_UART0->DLM = 125 / 256; + LPC_UART0->DLL = 125; + LPC_UART0->LCR = lcrSave; + LPC_UART0->FDR = 0x41; + printf("UART0 old DL %d FDR %d %d\r\n", oldDLValue, oldFDRValue >> 4, oldDLValue & 0x0F); +} + +int main(void) { + myled1 = 1; + printf("\r\n----------------------------------------------------\n\r"); + printf("\r\nWe have ignition - make sure Ethernet is connected!\n\r"); + http.addHandler(new HTTPStaticPage("/test.htm", content, strlen(content))); + printf("HTTPStaticPage added\n\r"); + http.addHandler(new HTTPRPC()); + printf("HTTPRPC added\n\r"); + http.addHandler(new HTTPFileSystemHandler("/", "/local/")); + printf("HTTPFileSystemHandler added for /local/ \n\r"); + http.addHandler(new HTTPFileSystemHandler("/sdcard/", "/sd/")); + printf("HTTPFileSystemHandler added for /sd/ \n\r"); + http.bind(); + printf("bind\n\r"); + NetServer *net = NetServer::get(); + printf("%hhu.%hhu.%hhu.%hhu\n\r", (net->getIPAddr().addr)&0xFF, (net->getIPAddr().addr>>8)&0xFF, (net->getIPAddr().addr>>16)&0xFF, (net->getIPAddr().addr>>24)&0xFF); + while (1) { + //wait_ms(1); + wait_us(100); + http.poll(); + myled2 = !myled2; + // wait(0.1); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Tue Nov 20 12:20:01 2012 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/49a220cc26e0 \ No newline at end of file