aboutsummaryrefslogtreecommitdiffstats
path: root/src/serial.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/serial.c')
-rw-r--r--src/serial.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/serial.c b/src/serial.c
index 692faf0..32fcb95 100644
--- a/src/serial.c
+++ b/src/serial.c
@@ -25,3 +25,15 @@ char serial_get(void)
while (!(USART2->ISR & USART_ISR_RXNE));
return USART2->RDR & 0xFF;
}
+
+void serial_gets(char *buf)
+{
+ uint16_t index = 0;
+
+ do {
+ buf[index] = serial_get();
+ } while (buf[index++] != '\r');
+
+ buf[index - 1] = '\0';
+ //return buf;
+}