From e5b64e746e4114f95b37fc3b4abcd3fc6d57710f Mon Sep 17 00:00:00 2001 From: Sanyog Date: Thu, 7 Nov 2024 13:19:16 +0530 Subject: [PATCH] Add UART1 read function to get GNSS data --- main.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/main.c b/main.c index 6259aae..90f635a 100644 --- a/main.c +++ b/main.c @@ -39,3 +39,9 @@ void GPIO_PORT_B_init(void) UART1_CTL_R |= 0x301; // Enable UART1, RX, and TX } + +char UART1_READ(void) +{ + while (UART1_FR_R & 0x10); // Wait until RX FIFO is not empty + return (char)UART1_DR_R; // Return received data +}