/* * File: uart.h * Author: Sebastian H. Gabrielli * * Created on March 6, 2024, 3:19 PM */ #ifndef UART_H #define UART_H #ifdef __cplusplus extern "C" { #endif #include #include #ifndef F_CPU #define F_CPU 4E6 #endif #define USART3_BAUD_RATE(BAUD_RATE) ((float)(F_CPU * 64 / (16 * (float)BAUD_RATE)) + 0.5) void init_uart(uint16_t baud); void USART3_sendChar(char c); int USART3_printChar(char c, FILE *stream); static FILE USART_stream = FDEV_SETUP_STREAM(USART3_printChar, NULL, _FDEV_SETUP_WRITE); #ifdef __cplusplus } #endif #endif /* UART_H */