aboutsummaryrefslogtreecommitdiff
path: root/src/core/Print.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/Print.h')
-rw-r--r--src/core/Print.h42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/core/Print.h b/src/core/Print.h
new file mode 100644
index 0000000..3c83abe
--- /dev/null
+++ b/src/core/Print.h
@@ -0,0 +1,42 @@
+/*
+ Print.cpp
+ Base class that provides print() and println()
+ Created on: 2012/03/17
+ */
+#ifndef Print_h
+#define Print_h
+
+#include <string.h>
+#include "LPC11xx.h"
+
+const char radix_bin[] = "01";
+const char radix_oct[] = "01234567";
+const char radix_dec[] = "0123456789";
+const char radix_hex[] = "0123456789ABCDEF";
+
+typedef enum {
+ BYTE = 0x01, /*!< 1バイトのアスキーコードが表示される */
+ BIN = 0x02, /*!< dataで与えられた数値を2進数で表示する */
+ OCT = 0x08, /*!< dataで与えられた数値を8進数で表示する */
+ DEC = 0x0A, /*!< dataで与えられた数値を10進数で表示する */
+ HEX = 0x10
+/*!< dataで与えられた数値を16進数で表示する */
+} RADIX_FORMAT;
+
+
+class Print {
+private:
+ // RADIX_FORMAT format;
+public:
+ virtual void write(const char c) = 0;
+ void write(const char *s,int length);
+ void write(const char *s) { return write((const char *)s, strlen(s)); }
+
+ virtual void println(void);
+ void print(const char *s);
+ void print(int val, RADIX_FORMAT format);
+ void println(const char *s);
+ void println(int val, RADIX_FORMAT format);
+};
+
+#endif