From 4f6973b8500418abf83c2377d09396b8588f7746 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Sat, 18 Sep 2021 21:07:30 +0200 Subject: New architecture: lora32u4ii Very limited support at the moment. No I2C/SPI, no USB bootloader or USB UART. --- src/arch/lora32u4ii/driver/stdout.cc | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 src/arch/lora32u4ii/driver/stdout.cc (limited to 'src/arch/lora32u4ii/driver/stdout.cc') 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 +#include + +#ifndef BAUD +#define BAUD 9600UL +#endif + +#include + +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; -- cgit v1.2.3