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.
Diff: ConsoleSerial.h
- 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);
+ }
+
+};
+