summaryrefslogtreecommitdiff
path: root/project/Core/Src/Homework/printf.c
blob: 56216ad8fce0467b64f9b07682e45de9f2347121 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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;
}