summaryrefslogtreecommitdiff
path: root/project/Core/Src/Homework/printf.c
diff options
context:
space:
mode:
Diffstat (limited to 'project/Core/Src/Homework/printf.c')
-rw-r--r--project/Core/Src/Homework/printf.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/project/Core/Src/Homework/printf.c b/project/Core/Src/Homework/printf.c
new file mode 100644
index 0000000..56216ad
--- /dev/null
+++ b/project/Core/Src/Homework/printf.c
@@ -0,0 +1,21 @@
+/*
+ * printf.c
+ *
+ * Created on: Sep 5, 2025
+ * Author: sowgro
+ */
+
+#include <stdio.h>
+#include <stdarg.h>
+#include "UART.h"
+#include "printf.h"
+
+char buffer[80];
+int printf(const char *format, ...) {
+ va_list args;
+ va_start(args, format);
+ int n = vsprintf(buffer, format, args);
+ va_end(args);
+ USART_Write(USART2, (unsigned char *) buffer, n);
+ return n;
+}