/*
 * hw4.c
 *
 *  Created on: Oct 4, 2025
 *      Author: sowgro
 */

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


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

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