diff options
author | lonkaars <loek@pipeframe.xyz> | 2022-10-29 18:01:56 +0200 |
---|---|---|
committer | lonkaars <loek@pipeframe.xyz> | 2022-10-29 18:01:56 +0200 |
commit | 9e9ea9d07ed2a176d6f6e83b5b100da22d8fca50 (patch) | |
tree | a683bde4664dad75c3b5a1efbd4223a4ab3b40dd /stm32f091/util.h | |
parent | ead710db271795380207141f0add7278ba12ada0 (diff) | |
parent | aae57dc32a843351fb2e17721afcd841bedec0a6 (diff) |
Merge branch 'protocol' into dev
Diffstat (limited to 'stm32f091/util.h')
-rw-r--r-- | stm32f091/util.h | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/stm32f091/util.h b/stm32f091/util.h index 92f093f..11bee6f 100644 --- a/stm32f091/util.h +++ b/stm32f091/util.h @@ -8,9 +8,44 @@ #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 + +#define debugger asm("nop") + +// 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__); \ HAL_UART_Transmit(&huart2, (uint8_t*) temp, sizeof(char) * strlen(temp), HAL_MAX_DELAY); \ } +#define ws_dbg_set_usart2_tty_color(color) { \ + uint8_t sgr[] = { 0x1b, 0x5b, 0x33 + (color > 7 ? 6 : 0), 0x30 + (color & 0b111), 0x6d }; \ + HAL_UART_Transmit(&huart2, sgr, sizeof(sgr), 100); \ +} |