aboutsummaryrefslogtreecommitdiff
path: root/stm32f091/util.h
diff options
context:
space:
mode:
authorUnavailableDev <69792062+UnavailableDev@users.noreply.github.com>2022-10-30 17:42:03 +0100
committerGitHub <noreply@github.com>2022-10-30 17:42:03 +0100
commitb82a9c44d0112f5433c4482e2e5802969515ce7d (patch)
tree907451385d246dc61b513f3a27043f32b058268a /stm32f091/util.h
parent84341bc53bca3da581ba59f66bf4174420c83d3a (diff)
parentfc95a016d13c1510a024888c1b87bbfe1a7f7601 (diff)
Merge branch 'dev' into qt-settings
Diffstat (limited to 'stm32f091/util.h')
-rw-r--r--stm32f091/util.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/stm32f091/util.h b/stm32f091/util.h
index 9c15f8b..100b877 100644
--- a/stm32f091/util.h
+++ b/stm32f091/util.h
@@ -34,6 +34,7 @@
#define WS_DBG_TTY_COLOR_TX WS_DBG_TTY_COLOR_GRN
#define WS_DBG_TTY_COLOR_RX WS_DBG_TTY_COLOR_RED
+// allow `debugger;` statement like in JS
#define debugger asm("nop")
// unused
@@ -43,12 +44,14 @@
// #define WS_DBG_TTY_COLOR_IPD_LISTENING WS_DBG_TTY_COLOR_GRN
// #define WS_DBG_TTY_COLOR_CIPSEND_LISTENING WS_DBG_TTY_COLOR_RED
+/** @brief `printf()` over uart2 (usb) */
#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); \
}
+/** @brief print VT100 escape code over uart2 to set tty color */
#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); \