aboutsummaryrefslogtreecommitdiff
path: root/stm32f091/util.h
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2022-10-28 14:31:56 +0200
committerlonkaars <loek@pipeframe.xyz>2022-10-28 14:31:56 +0200
commitbabb6dc29a5c4af60292ffad5216317d13e2a685 (patch)
treed5de3240e0112310c5ffc90ead6935333d5f9f78 /stm32f091/util.h
parent4cd465332087e4ab12709f28fae55df10e1a1154 (diff)
fix off-by-one error and create macro for switching serial debug print color
Diffstat (limited to 'stm32f091/util.h')
-rw-r--r--stm32f091/util.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/stm32f091/util.h b/stm32f091/util.h
index 92f093f..9f5c1ec 100644
--- a/stm32f091/util.h
+++ b/stm32f091/util.h
@@ -14,3 +14,7 @@
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, 0x30 + color, 0x6d }; \
+ HAL_UART_Transmit(&huart2, sgr, sizeof(sgr), 100); \
+}