Add UART Read function

This commit is contained in:
Sanyog Nevase Nevase 2024-10-10 19:53:36 +05:30
parent 6cabffb9d2
commit 1050494f56
1 changed files with 9 additions and 0 deletions

9
main.c
View File

@ -23,6 +23,15 @@ void UART1_WRITE(char data)
while (UART1_FR_R & 0x20); // Wait until TX FIFO is not full
UART1_DR_R = data; // Write data to UART data register
}
char UART1_READ(void)
{
while (UART1_FR_R & 0x10); // Wait until RX FIFO is not empty
return (char)UART1_DR_R; // Return received data
}
void GPIOF_interruptHandler(void) // Interrupt handler for GPIO Port F
{
//delay(200000); // Debounce delay