Zoltan Hudak / Mbed 2 deprecated Manchester_Receiver

Dependencies:   Manchester mbed CRC16 ManchesterMsg

Files at this revision

API Documentation at this revision

Comitter:
hudakz
Date:
Wed May 17 07:59:46 2017 +0000
Child:
1:2ce05484e526
Commit message:
Initial issue.

Changed in this revision

Manchester.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/Manchester.lib	Wed May 17 07:59:46 2017 +0000
@@ -0,0 +1,1 @@
+http://developer.mbed.org/users/hudakz/code/Manchester/#d5c75b0e5708
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Wed May 17 07:59:46 2017 +0000
@@ -0,0 +1,32 @@
+#include "mbed.h"
+#include "Manchester.h"
+
+DigitalOut      led(LED1);
+Manchester      man(p11, p12, 9600);    // Tx pin, Rx pin, speed [bps]
+ManchesterMsg   msg(255);               // Message container (max bytes)
+char            str[255];               // Array of char
+uint32_t        val;
+
+int main(void) {
+
+    while(1) {
+        if(man.receive(msg)) {      // Receive message
+            // Print data length and raw data
+            printf("\r\n----------------------\r\n");
+            printf("len = %d\r\n", msg.len);
+            printf("raw data :\r\n");
+            for(int i = 0; i < msg.len; i++)
+                printf("\t0x%.2x\r\n", msg.data[i]);
+                
+            // Extract data from message and print
+            msg >> str >> val;
+            printf("data :\r\n");
+            printf("\tstr = %s\r\n", str);
+            printf("\tval = 0x%x\r\n", val);
+        }
+        else
+            printf("Error\r\n");
+
+        led = !led;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Wed May 17 07:59:46 2017 +0000
@@ -0,0 +1,1 @@
+https://mbed.org/users/mbed_official/code/mbed/builds/4eea097334d6
\ No newline at end of file