summaryrefslogtreecommitdiff
path: root/src/arch/lora32u4ii/driver
diff options
context:
space:
mode:
Diffstat (limited to 'src/arch/lora32u4ii/driver')
-rw-r--r--src/arch/lora32u4ii/driver/gpio.cc25
-rw-r--r--src/arch/lora32u4ii/driver/stdout.cc36
-rw-r--r--src/arch/lora32u4ii/driver/uptime.cc3
3 files changed, 64 insertions, 0 deletions
diff --git a/src/arch/lora32u4ii/driver/gpio.cc b/src/arch/lora32u4ii/driver/gpio.cc
new file mode 100644
index 0000000..2e3eb1d
--- /dev/null
+++ b/src/arch/lora32u4ii/driver/gpio.cc
@@ -0,0 +1,25 @@
+#include "driver/gpio.h"
+#include <avr/io.h>
+#include <avr/interrupt.h>
+
+GPIO gpio;
+
+#ifndef __acweaving
+/*
+ISR(PCINT0_vect)
+{
+}
+*/
+
+/*
+ISR(PCINT1_vect)
+{
+}
+*/
+
+/*
+ISR(PCINT2_vect)
+{
+}
+*/
+#endif
diff --git a/src/arch/lora32u4ii/driver/stdout.cc b/src/arch/lora32u4ii/driver/stdout.cc
new file mode 100644
index 0000000..afe6ff8
--- /dev/null
+++ b/src/arch/lora32u4ii/driver/stdout.cc
@@ -0,0 +1,36 @@
+#include "driver/stdout.h"
+#include <avr/io.h>
+#include <avr/interrupt.h>
+
+#ifndef BAUD
+#define BAUD 9600UL
+#endif
+
+#include <util/setbaud.h>
+
+void StandardOutput::setup()
+{
+ UBRR1H = UBRRH_VALUE;
+ UBRR1L = UBRRL_VALUE;
+
+#if USE_2X
+ UCSR1A |= _BV(U2X1);
+#else
+ UCSR1A &= ~_BV(U2X1);
+#endif
+
+ UCSR1B |= _BV(RXEN1) | _BV(TXEN1);
+ UCSR1C = _BV(UCSZ11) | _BV(UCSZ10); // async UART, 8N1
+ //UCSR1D = 0;
+}
+
+void StandardOutput::put(char c)
+{
+ while (!(UCSR1A & _BV(UDRE1)));
+ UDR1 = c;
+ if (c == '\n') {
+ put('\r');
+ }
+}
+
+StandardOutput kout;
diff --git a/src/arch/lora32u4ii/driver/uptime.cc b/src/arch/lora32u4ii/driver/uptime.cc
new file mode 100644
index 0000000..388edb6
--- /dev/null
+++ b/src/arch/lora32u4ii/driver/uptime.cc
@@ -0,0 +1,3 @@
+#include "driver/uptime.h"
+
+Uptime uptime;