Test serial console demonstrating various API functions of WiConnect library.

Dependencies:   WiConnect mbed

Revision:
0:836c9a6383e0
Child:
1:5137ec8f4c45
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ConsoleSerial.h	Mon Aug 11 11:31:32 2014 +0000
@@ -0,0 +1,75 @@
+/*
+ * Copyright 2014, ACKme Networks
+ * All Rights Reserved.
+ *
+ * This is UNPUBLISHED PROPRIETARY SOURCE CODE of ACKme Networks;
+ * the contents of this file may not be disclosed to third parties, copied
+ * or duplicated in any form, in whole or in part, without the prior
+ * written permission of ACKme Networks.
+ */
+
+#pragma once
+
+#include <stdarg.h>
+
+#include "mbed.h"
+
+
+
+
+class ConsoleSerial : public Serial
+{
+public:
+
+    ConsoleSerial(PinName tx, PinName rx) : Serial(tx, rx)
+    {
+
+    }
+
+    void setBaud(int baud)
+    {
+        this->baud(baud);
+    }
+
+    int read()
+    {
+        return getc();
+    }
+
+    void write(int c)
+    {
+        putc(c);
+    }
+
+    void write(const char *s)
+    {
+        puts(s);
+    }
+
+    void write(char *s)
+    {
+        puts(s);
+    }
+
+    void write(const void *data, int size)
+    {
+        Serial::write(data, size);
+    }
+
+    void printf(const char *fmt, ...)
+    {
+        va_list va;
+        va_start(va, fmt);
+        vprintf(fmt, va);
+        va_end(va);
+    }
+
+    void vprintf(const char *fmt, va_list va)
+    {
+        char buf[512];
+        vsnprintf(buf, sizeof(buf), fmt, va);
+        write(buf);
+    }
+
+};
+