summaryrefslogtreecommitdiff
path: root/project/Core/Src/Homework/hw4.c
blob: 2154cd4f6d8fbc06a8be6e94f8b44e67b85a77f6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/*
 * hw4.c
 *
 *  Created on: Oct 4, 2025
 *      Author: sowgro
 */

#include "UART.h"
#include "systick.h"
#include "LED.h"
#include <stdio.h>


void read_and_print_char_nonblocking() {
	uint8_t ch = USART_Read_Nonblocking(USART2);
	printf("%c", ch);
	if (ch == '\r') {
		printf("\n");
	}
}

void hw4_run() {
	init_systick();
	for (;;) {
		delay_systick();
		LED_Toggle();
		read_and_print_char_nonblocking();
	}
}