aboutsummaryrefslogtreecommitdiff
path: root/stm32f091/util.h
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2022-10-30 16:52:29 +0100
committerlonkaars <loek@pipeframe.xyz>2022-10-30 16:52:29 +0100
commit64d742443bfacf5b1fad29f44642780b623f9a15 (patch)
tree176f2f65cdbfb13a4236e7964e21cb62e2d1e6c3 /stm32f091/util.h
parent0c8e3c7e6cdc99a14b38edd747d07d7b03fb294c (diff)
add documentation in header files
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); \