From 6b90c1779fddd35e6a3d68bff0c38e7ac06a4dbc Mon Sep 17 00:00:00 2001 From: BlackMark Date: Mon, 13 Apr 2020 16:43:48 +0200 Subject: [PATCH] Adapt to new interrupt handling interface and change example back to atmega1284p --- uart/main.cpp | 18 ++-- uart/uart | 2 +- uart/uart.cppproj | 221 +++++++++++++++++++++++----------------------- 3 files changed, 123 insertions(+), 118 deletions(-) diff --git a/uart/main.cpp b/uart/main.cpp index aea7316..66424fb 100644 --- a/uart/main.cpp +++ b/uart/main.cpp @@ -8,13 +8,17 @@ #include "io/io.hpp" #include "uart/uart.hpp" -#define UART0_INT_VECTORS -#include "uart/hardware0.hpp" +using uart0_interface_t = + uart::Uart, uart::Driven::INTERRUPT, uart::Mode::ASYNCHRONOUS>>; + +using uart1_interface_t = uart::Uart1<>; + +REGISTER_UART0_INT_VECTORS(uart0_interface_t); +REGISTER_UART1_INT_VECTORS(uart1_interface_t); void doubleSpeedTest() { - using namespace uart; - Uart, Driven::INTERRUPT, Mode::ASYNCHRONOUS>> serial; + uart0_interface_t serial; serial.init(); uint8_t counter = 100; @@ -27,6 +31,8 @@ void doubleSpeedTest() } } + serial << F("\r\n"); + serial.flushTx(); } @@ -62,9 +68,7 @@ void newUartUsage() void newUartUsage2() { - using namespace uart; - - Uart, Driven::INTERRUPT>> serial1; + uart1_interface_t serial1; auto ramString = "Hello World from RAM. "; auto flashString = F("Hello World from flash\r\n"); diff --git a/uart/uart b/uart/uart index bcd18db..dfb076c 160000 --- a/uart/uart +++ b/uart/uart @@ -1 +1 @@ -Subproject commit bcd18db494de771ebe786817e74d3585a94312e9 +Subproject commit dfb076cda8e9f935e51b2c36ae09ad7c9e759b09 diff --git a/uart/uart.cppproj b/uart/uart.cppproj index 40dde9b..0027b44 100644 --- a/uart/uart.cppproj +++ b/uart/uart.cppproj @@ -5,7 +5,7 @@ 7.0 com.Atmel.AVRGCC8.CPP dce6c7e3-ee26-4d79-826b-08594b9ad897 - ATmega328P + ATmega1284P none Executable CPP @@ -28,7 +28,8 @@ 0 0 - com.atmel.avrdbg.tool.atmelice + + J41800099437 0x1E950F @@ -76,119 +77,119 @@ - -mmcu=atmega1284p -B "%24(PackRepoDir)\Atmel\ATmega_DFP\1.3.300\gcc\dev\atmega1284p" - True - True - True - True - True - False - True - True - - - NDEBUG - - - - - %24(PackRepoDir)\Atmel\ATmega_DFP\1.3.300\include - - - Optimize for size (-Os) - True - True - True - True - -fno-threadsafe-statics -std=c11 - True - True - - - NDEBUG - - - - - %24(PackRepoDir)\Atmel\ATmega_DFP\1.3.300\include - - - Optimize for size (-Os) - True - True - True - -fno-threadsafe-statics -Wextra -std=c++17 - - - libm - - - - - %24(PackRepoDir)\Atmel\ATmega_DFP\1.3.300\include - - - + -mmcu=atmega1284p + True + True + True + True + True + False + True + True + + + NDEBUG + + + + + %24(PackRepoDir)\Atmel\ATmega_DFP\1.3.300\include + + + Optimize for size (-Os) + True + True + True + True + -fno-threadsafe-statics -std=c11 + True + True + + + NDEBUG + + + + + %24(PackRepoDir)\Atmel\ATmega_DFP\1.3.300\include + + + Optimize for size (-Os) + True + True + True + -fno-threadsafe-statics -Wextra -std=c++17 + + + libm + + + + + %24(PackRepoDir)\Atmel\ATmega_DFP\1.3.300\include + + + - -mmcu=atmega1284p -B "%24(PackRepoDir)\Atmel\ATmega_DFP\1.3.300\gcc\dev\atmega1284p" - True - True - True - True - True - False - True - True - - - DEBUG - - - - - %24(PackRepoDir)\Atmel\ATmega_DFP\1.3.300\include - - - Optimize (-O1) - True - Maximum (-g3) - True - True - True - -fno-threadsafe-statics -std=c11 - True - True - - - DEBUG - - - - - %24(PackRepoDir)\Atmel\ATmega_DFP\1.3.300\include - - - True - Maximum (-g3) - True - True - -fno-threadsafe-statics -Wextra -std=c++17 - - - libm - - - - - %24(PackRepoDir)\Atmel\ATmega_DFP\1.3.300\include - - - Default (-Wa,-g) - + -mmcu=atmega1284p + True + True + True + True + True + False + True + True + + + DEBUG + + + + + %24(PackRepoDir)\Atmel\ATmega_DFP\1.3.300\include + + + Optimize (-O1) + True + Maximum (-g3) + True + True + True + -fno-threadsafe-statics -std=c11 + True + True + + + DEBUG + + + + + %24(PackRepoDir)\Atmel\ATmega_DFP\1.3.300\include + + + True + Maximum (-g3) + True + True + -fno-threadsafe-statics -Wextra -std=c++17 + + + libm + + + + + %24(PackRepoDir)\Atmel\ATmega_DFP\1.3.300\include + + + Default (-Wa,-g) +