aboutsummaryrefslogtreecommitdiff
path: root/stm32f091/util.h
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2022-10-14 14:11:23 +0200
committerlonkaars <loek@pipeframe.xyz>2022-10-14 14:11:23 +0200
commit0b05974d6462780030802a2991a9c929059b722a (patch)
tree0e33b7ef21f485a04bc2886704261ad2b43f0b94 /stm32f091/util.h
parent1032c63bae663d8ed8736020b60a4ba8744062ee (diff)
add printf macro util.h
Diffstat (limited to 'stm32f091/util.h')
-rw-r--r--stm32f091/util.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/stm32f091/util.h b/stm32f091/util.h
new file mode 100644
index 0000000..8e3258f
--- /dev/null
+++ b/stm32f091/util.h
@@ -0,0 +1,15 @@
+#pragma once
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <stm32f0xx_hal.h>
+#include <string.h>
+
+#include "setup.h"
+
+#define ws_usb_printf(fmt, ...) { \
+ char temp[255]; \
+ sprintf(temp, fmt, ##__VA_ARGS__); \
+ HAL_UART_Transmit(&huart2, (uint8_t*) temp, sizeof(char) * strlen(temp), HAL_MAX_DELAY); \
+}
+