My private SerialConsole. This is little uncode.

Dependencies:   PowerControl mbed

Files at this revision

API Documentation at this revision

Comitter:
lelect
Date:
Tue Apr 01 06:13:27 2014 +0000
Commit message:
My SerialConsole

Changed in this revision

PowerControl.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/PowerControl.lib	Tue Apr 01 06:13:27 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/JST2011/code/PowerControl/#d0fa2aeb02a4
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Tue Apr 01 06:13:27 2014 +0000
@@ -0,0 +1,44 @@
+#include "mbed.h"
+#include "PowerControl.h"
+#include "EthernetPowerControl.h"
+Serial pc(USBTX, USBRX); // tx, rx
+Serial device(p9, p10);  // tx, rx
+PinName cts=p11;//CTS
+PinName rts=p12;//RTS
+
+DigitalOut _TX(LED1);//TX access lamp
+DigitalOut _RX(LED2);//RX access lamp
+
+void pc_rx ()
+{
+    _TX=1;
+    int buff=pc.getc();
+    switch(buff) {
+        case 'H':
+            device.printf("Hello World!");
+            break;
+        default:
+            device.putc(buff);
+            break;
+    }
+    _TX=0;
+}
+void dev_rx ()
+{
+    _RX=1;
+    pc.putc(device.getc());
+    _RX=0;
+}
+int main()
+{
+    pc.baud(230400);
+    device.baud(115200);
+    device.set_flow_control(Serial::RTSCTS,rts,cts);
+
+    pc.attach(&pc_rx,Serial::RxIrq);
+    device.attach(&dev_rx,Serial::RxIrq);
+    PHY_PowerDown();
+    while(1) {
+        sleep();
+    };
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Tue Apr 01 06:13:27 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/824293ae5e43
\ No newline at end of file