aboutsummaryrefslogtreecommitdiff
path: root/stm32f091/util.h
diff options
context:
space:
mode:
Diffstat (limited to 'stm32f091/util.h')
-rw-r--r--stm32f091/util.h31
1 files changed, 30 insertions, 1 deletions
diff --git a/stm32f091/util.h b/stm32f091/util.h
index 9f5c1ec..dde3677 100644
--- a/stm32f091/util.h
+++ b/stm32f091/util.h
@@ -8,6 +8,35 @@
#include "setup.h"
#include "../shared/util.h"
+#define WS_DBG_TTY_COLOR_BLK 0x0
+#define WS_DBG_TTY_COLOR_RED 0x1
+#define WS_DBG_TTY_COLOR_GRN 0x2
+#define WS_DBG_TTY_COLOR_YLW 0x3
+#define WS_DBG_TTY_COLOR_BLU 0x4
+#define WS_DBG_TTY_COLOR_VLT 0x5
+#define WS_DBG_TTY_COLOR_CYN 0x6
+#define WS_DBG_TTY_COLOR_WHI 0x7
+#define WS_DBG_TTY_COLOR_BR_BLK 0x8
+#define WS_DBG_TTY_COLOR_BR_RED 0x9
+#define WS_DBG_TTY_COLOR_BR_GRN 0xa
+#define WS_DBG_TTY_COLOR_BR_YLW 0xb
+#define WS_DBG_TTY_COLOR_BR_BLU 0xc
+#define WS_DBG_TTY_COLOR_BR_VLT 0xd
+#define WS_DBG_TTY_COLOR_BR_CYN 0xe
+#define WS_DBG_TTY_COLOR_BR_WHI 0xf
+
+// serial debug color scheme
+#define WS_DBG_TTY_COLOR_DBGMSG WS_DBG_TTY_COLOR_BR_BLK
+#define WS_DBG_TTY_COLOR_TX WS_DBG_TTY_COLOR_GRN
+#define WS_DBG_TTY_COLOR_RX WS_DBG_TTY_COLOR_RED
+
+// unused
+// #define WS_DBG_TTY_COLOR_CMD_ECHO WS_DBG_TTY_COLOR_BLK
+// #define WS_DBG_TTY_COLOR_STATUS_CODE WS_DBG_TTY_COLOR_YLW
+// #define WS_DBG_TTY_COLOR_IDLE WS_DBG_TTY_COLOR_VLT
+// #define WS_DBG_TTY_COLOR_IPD_LISTENING WS_DBG_TTY_COLOR_GRN
+// #define WS_DBG_TTY_COLOR_CIPSEND_LISTENING WS_DBG_TTY_COLOR_RED
+
#define ws_usb_printf(fmt, ...) { \
char temp[255]; \
snprintf(temp, 255, fmt, ##__VA_ARGS__); \
@@ -15,6 +44,6 @@
}
#define ws_dbg_set_usart2_tty_color(color) { \
- uint8_t sgr[] = { 0x1b, 0x5b, 0x33, 0x30 + color, 0x6d }; \
+ uint8_t sgr[] = { 0x1b, 0x5b, 0x33 + (color > 7 ? 6 : 0), 0x30 + (color & 0b111), 0x6d }; \
HAL_UART_Transmit(&huart2, sgr, sizeof(sgr), 100); \
}