Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Revision 0:9d92ed28d5a7, committed 2013-11-19
- Comitter:
- mazgch
- Date:
- Tue Nov 19 16:00:33 2013 +0000
- Commit message:
- loopback ETH/CAN helper for Production Test Sw
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/C027.lib Tue Nov 19 16:00:33 2013 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/teams/ublox/code/C027/#fb30e9923a7b
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Tue Nov 19 16:00:33 2013 +0000
@@ -0,0 +1,48 @@
+#include "mbed.h"
+#include "C027.h"
+
+#define NL      "\r\n"
+#define T_RETRY 1
+
+int main() {
+    C027 c027;
+    Serial pc(USBTXD, USBRXD); 
+    pc.baud(115200);
+    
+    CAN can(CANRD, CANTD);
+    can.frequency(500000);
+    DigitalOut canS(CANS);
+    canS = 0;
+    CANMessage msg;
+    
+    Ethernet eth;
+    bool ethLink = false;
+    int len;
+    
+    printf(NL NL);
+    printf("TestVer = \"" __DATE__ " " __TIME__ "\"" NL);
+     
+    while (1)
+    {
+        if (can.read(msg))
+        {
+            printf("Can: id %03X, len %d, data \"%.*s\"" NL, msg.id, msg.len, msg.len, msg.data);
+            can.write(msg);
+        }
+        bool link = eth.link();
+        if (ethLink ^ link)
+        {
+            printf("Eth: link %s" NL, link ? "OK" : "ERROR");
+            ethLink = link;
+        }
+        if (link && ((len = eth.receive()) > 0))
+        {
+            char data[256];
+            len = eth.read(data,len);
+            printf("Eth: len %d, data \"%.*s\"" NL, len, len, data);
+            eth.write(data, len);
+            eth.send();
+        }
+        wait_ms(1);
+    }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Tue Nov 19 16:00:33 2013 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/a9913a65894f \ No newline at end of file