Fx0とLCDを使用するサンプルです。Ethernet用です。

Dependencies:   EthernetNetIf HTTPServer RPCInterface2 TextLCD mbed

Fork of ethernet_test_http_2 by Yasushi TAUCHI

Files at this revision

API Documentation at this revision

Comitter:
yueee_yt
Date:
Mon May 09 12:34:17 2011 +0000
Child:
1:e20fecacd8f6
Commit message:

Changed in this revision

EthernetNetIf.lib Show annotated file Show diff for this revision Revisions of this file
HTTPServer.lib Show annotated file Show diff for this revision Revisions of this file
RPCInterface.lib Show annotated file Show diff for this revision Revisions of this file
TextLCD.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.bld Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/EthernetNetIf.lib	Mon May 09 12:34:17 2011 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/donatien/code/EthernetNetIf/#bc7df6da7589
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/HTTPServer.lib	Mon May 09 12:34:17 2011 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/donatien/code/HTTPServer/#d753966e4d97
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/RPCInterface.lib	Mon May 09 12:34:17 2011 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/MichaelW/code/RPCInterface/#a9e2c45097c8
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TextLCD.lib	Mon May 09 12:34:17 2011 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/simon/code/TextLCD/#44f34c09bd37
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Mon May 09 12:34:17 2011 +0000
@@ -0,0 +1,64 @@
+#include "mbed.h"
+#include "TextLCD.h"
+#include "EthernetNetIf.h"
+#include "HTTPServer.h"
+#include "RPCFunction.h"
+
+DigitalOut led1(LED1,"led1");
+DigitalOut led2(LED2,"led2");
+DigitalOut led3(LED3,"led3");
+DigitalOut led4(LED4,"led4");
+
+TextLCD lcd(p24, p26, p27, p28, p29, p30);
+
+#if 1
+/*
+ * Use DHCP
+ */
+        EthernetNetIf ethif;
+#else
+/*
+ * Use "static IP address" (Parameters:IP, Subnet mask, Gateway, DNS)
+ */
+        EthernetNetIf ethif(IpAddr(xxx,xxx,xxx,xxx), IpAddr(xxx,xxx,xxx,xxx), IpAddr(xxx,xxx,xxx,xxx), IpAddr(xxx,xxx,xxx,xxx));
+#endif
+    
+    HTTPServer server;
+    LocalFileSystem local("local");
+    void LcdWrite(char *input,char *output);
+    RPCFunction rpcFunc(&LcdWrite, "LcdWrite");
+
+int main(void) {
+
+    Base::add_rpc_class<DigitalOut>();
+
+    lcd.cls();
+    lcd.locate(0,0);
+    lcd.printf("Program init..  ");
+
+    if (ethif.setup()) {
+        error("Ethernet setup failed.");
+        return 1;
+    }
+    IpAddr ethIp=ethif.getIp();
+    
+    lcd.locate(0,1);
+    lcd.printf("%d.%d.%d.%d", ethIp[0], ethIp[1], ethIp[2], ethIp[3]);
+    led1=1;
+    wait(1);
+    server.addHandler<SimpleHandler>("/hello");
+    server.addHandler<RPCHandler>("/rpc");
+    FSHandler::mount("/local", "/");
+    server.addHandler<FSHandler>("/");
+    server.bind(80);
+    while (1) {
+        Net::poll();
+    }
+    return 0;
+}
+void LcdWrite(char *input , char *output)
+{
+    lcd.locate(0,1);
+    lcd.printf("%s",input);
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Mon May 09 12:34:17 2011 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/63bcd7ba4912