diff options
Diffstat (limited to 'stm32f091/util.h')
-rw-r--r-- | stm32f091/util.h | 3 |
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); \ |