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.
Dependencies: mbed mbed-rtos Printer EthernetInterface TextLCD keypad Audio TMU220
Diff: const_defines.h
- Revision:
- 0:0d3826561161
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/const_defines.h Fri Feb 07 08:25:06 2020 +0000
@@ -0,0 +1,44 @@
+#ifndef CONST_DEFINES_H
+#define CONST_DEFINES_H
+
+extern Serial dbg;
+
+//delays
+#define delay(n) wait_ms(n) // in milisecond
+#define delay_us(n) wait_us(n) // in microsecond
+
+ // colored terminal output using ANSI escape sequences
+#if 1
+ #define COL(c) "\033[" c
+ #else
+ #define COL(c)
+ #endif
+#define DEF COL("39m")
+#define BLA COL("30m")
+#define RED COL("31m")
+#define GRE COL("32m")
+#define YEL COL("33m")
+#define BLU COL("34m")
+#define MAG COL("35m")
+#define CYA COL("36m")
+#define WHY COL("37m")
+
+void _debugPrint(const char* color, const char* format, ...)
+{
+ va_list args;
+ va_start (args, format);
+ if (color) dbg.printf(color);
+ dbg.vprintf(format, args);
+ if (color) dbg.printf(DEF);
+ va_end (args);
+}
+
+#define ERROR(...) _debugPrint(RED, __VA_ARGS__)
+#define INFO(...) _debugPrint(GRE, __VA_ARGS__)
+#define TRACE(...) _debugPrint(DEF, __VA_ARGS__)
+#define TEST(...) _debugPrint(CYA, __VA_ARGS__)
+#define FLOW(...) _debugPrint(YEL, __VA_ARGS__)
+//==============================================================================
+
+#endif // CONST_DEFINES_H
+