summaryrefslogtreecommitdiff
path: root/src/uart.h
diff options
context:
space:
mode:
authorGravatar Jonas Gunz <himself@jonasgunz.de> 2021-06-04 19:09:07 +0200
committerGravatar Jonas Gunz <himself@jonasgunz.de> 2021-06-04 19:09:07 +0200
commit27321e05de35b494c2b282652e1c40a18435b68b (patch)
tree517ac03ec78902c608e6522ba1f58aebfff41d84 /src/uart.h
parent3ead2db8d979bab8fd8848d24de430979698b16f (diff)
downloadanalog_instruments-27321e05de35b494c2b282652e1c40a18435b68b.tar.gz
implement uart
Diffstat (limited to 'src/uart.h')
-rw-r--r--src/uart.h36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/uart.h b/src/uart.h
new file mode 100644
index 0000000..c709487
--- /dev/null
+++ b/src/uart.h
@@ -0,0 +1,36 @@
+/*
+ * src/uart.h
+ * (c) 2021 Jonas Gunz <himself@jonasgunz.de>
+ * License: All rights reserved.
+ */
+
+/*
+ * Interrupt controlled UART
+ */
+
+#ifndef _UART_H_
+#define _UART_H_
+
+#include <avr/io.h>
+#include <avr/interrupt.h>
+#include <stdint.h>
+#include <string.h>
+
+#ifndef BAUD
+#warning BAUD "BAUD not defined. Dafaulting to 9600"
+#define BAUD 9600
+#endif
+
+#ifndef F_CPU
+#error "F_CPU not defined"
+#endif
+
+#define UBRR F_CPU/16/BAUD-1
+
+void uart_init();
+
+uint8_t uart_putchar(char _c);
+
+uint8_t uart_getchar(char *_c);
+
+#endif