From f1de6c3701a1fc0404c433bcee280085decf7d26 Mon Sep 17 00:00:00 2001 From: BlackMark Date: Sat, 27 Jul 2019 10:53:23 +0200 Subject: [PATCH] Renamed library from usart to uart and wiped example to implement new library --- .clang-format | 13 +++ .gitignore | 1 - .gitmodules | 6 -- usart.atsln => uart.atsln | 2 +- uart/main.cpp | 1 + usart/usart.cppproj => uart/uart.cppproj | 113 ++++++++--------------- usart/array | 1 - usart/clock.h | 14 --- usart/main.cpp | 94 ------------------- usart/usart | 1 - 10 files changed, 51 insertions(+), 195 deletions(-) create mode 100644 .clang-format delete mode 100644 .gitmodules rename usart.atsln => uart.atsln (86%) create mode 100644 uart/main.cpp rename usart/usart.cppproj => uart/uart.cppproj (70%) delete mode 160000 usart/array delete mode 100644 usart/clock.h delete mode 100644 usart/main.cpp delete mode 160000 usart/usart diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000..63ebf38 --- /dev/null +++ b/.clang-format @@ -0,0 +1,13 @@ +--- +BasedOnStyle: LLVM +ColumnLimit: 120 +IndentWidth: 4 +TabWidth: 4 +UseTab: ForIndentation +AlignEscapedNewlines: DontAlign +AllowShortFunctionsOnASingleLine: Empty +AlwaysBreakTemplateDeclarations: true +BreakBeforeBraces: Custom +BraceWrapping: + AfterFunction: true +... diff --git a/.gitignore b/.gitignore index 38e936d..edee58b 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,3 @@ Release Debug *.componentinfo.xml -avrdude.bat diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 6196855..0000000 --- a/.gitmodules +++ /dev/null @@ -1,6 +0,0 @@ -[submodule "usart/array"] - path = usart/array - url = git@blackmark.me:array.git -[submodule "usart/usart"] - path = usart/usart - url = git@blackmark.me:usart.git diff --git a/usart.atsln b/uart.atsln similarity index 86% rename from usart.atsln rename to uart.atsln index 3981c17..75f63a9 100644 --- a/usart.atsln +++ b/uart.atsln @@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Atmel Studio Solution File, Format Version 11.00 VisualStudioVersion = 14.0.23107.0 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{E66E83B9-2572-4076-B26E-6BE79FF3018A}") = "usart", "usart\usart.cppproj", "{DCE6C7E3-EE26-4D79-826B-08594B9AD897}" +Project("{E66E83B9-2572-4076-B26E-6BE79FF3018A}") = "uart", "uart\uart.cppproj", "{DCE6C7E3-EE26-4D79-826B-08594B9AD897}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/uart/main.cpp b/uart/main.cpp new file mode 100644 index 0000000..76e8197 --- /dev/null +++ b/uart/main.cpp @@ -0,0 +1 @@ +int main() { return 0; } diff --git a/usart/usart.cppproj b/uart/uart.cppproj similarity index 70% rename from usart/usart.cppproj rename to uart/uart.cppproj index 43b8caa..9ebe460 100644 --- a/usart/usart.cppproj +++ b/uart/uart.cppproj @@ -5,16 +5,16 @@ 7.0 com.Atmel.AVRGCC8.CPP dce6c7e3-ee26-4d79-826b-08594b9ad897 - ATmega328P + ATmega1284P none Executable CPP $(MSBuildProjectName) .elf $(MSBuildProjectDirectory)\$(Configuration) - usart - usart - usart + uart + uart + uart Native true false @@ -25,50 +25,12 @@ true exception_table 2 + 0 0 - - - - - - - - - - - - + com.atmel.avrdbg.tool.jtagicemkii 070000004699 - 0x1E950F - - - - 1843200 - - ISP - - com.atmel.avrdbg.tool.stk500 - - - STK500 - - ISP - 125000 - - - - - - - - com.atmel.avrdbg.tool.simulator - - - Simulator - - 0 - + 0x1E9705 @@ -80,11 +42,28 @@ 070000004699 JTAGICE mkII + ISP + 125000 + + + + \Debug\uart.lss + + + .lss + ^\s*(?<address>[a-f0-9]*):\s*.*$ + true + address + $pc + + + + - -mmcu=atmega328p -B "%24(PackRepoDir)\atmel\ATmega_DFP\1.0.106\gcc\dev\atmega328p" + -mmcu=atmega1284p -B "%24(PackRepoDir)\Atmel\ATmega_DFP\1.3.300\gcc\dev\atmega1284p" True True True @@ -93,33 +72,31 @@ False True True - %24(PackRepoDir)\atmel\ATmega_DFP\1.0.106\include + %24(PackRepoDir)\Atmel\ATmega_DFP\1.3.300\include True True True True True - %24(PackRepoDir)\atmel\ATmega_DFP\1.0.106\include + %24(PackRepoDir)\Atmel\ATmega_DFP\1.3.300\include True True True True - -Wextra -std=c++14 - True - libmlibprintf_flt - %24(PackRepoDir)\atmel\ATmega_DFP\1.0.106\include + -Wextra -std=c++17 + libm + %24(PackRepoDir)\Atmel\ATmega_DFP\1.3.300\include NDEBUG Optimize for size (-Os) NDEBUG Optimize for size (-Os) - echo "C:\bin\avrdude-6.3\avrdude.exe" -v -p$(avrdevice) %%* -Uflash:w:"$(OutputDirectory)\$(Name).hex":i > "$(MSBuildProjectDirectory)\avrdude.bat" - -mmcu=atmega328p -B "%24(PackRepoDir)\atmel\ATmega_DFP\1.0.106\gcc\dev\atmega328p" + -mmcu=atmega1284p -B "%24(PackRepoDir)\Atmel\ATmega_DFP\1.3.300\gcc\dev\atmega1284p" True True True @@ -128,21 +105,20 @@ False True True - %24(PackRepoDir)\atmel\ATmega_DFP\1.0.106\include + %24(PackRepoDir)\Atmel\ATmega_DFP\1.3.300\include True True True True True - %24(PackRepoDir)\atmel\ATmega_DFP\1.0.106\include + %24(PackRepoDir)\Atmel\ATmega_DFP\1.3.300\include True True True True - -Wextra -std=c++14 - True - libmlibprintf_flt - %24(PackRepoDir)\atmel\ATmega_DFP\1.0.106\include + -Wextra -std=c++17 + libm + %24(PackRepoDir)\Atmel\ATmega_DFP\1.3.300\include DEBUG Optimize (-O1) Default (-g2) @@ -152,28 +128,11 @@ Default (-Wa,-g) - echo "C:\bin\avrdude-6.3\avrdude.exe" -v -p$(avrdevice) %%* -Uflash:w:"$(OutputDirectory)\$(Name).hex":i > "$(MSBuildProjectDirectory)\avrdude.bat" - - compile - - - compile - compile - - compile - - - compile - - - - - \ No newline at end of file diff --git a/usart/array b/usart/array deleted file mode 160000 index 0e8e4e5..0000000 --- a/usart/array +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 0e8e4e5ae485284a4bd1d2f96c5fa849f2bd9c3a diff --git a/usart/clock.h b/usart/clock.h deleted file mode 100644 index a04b5ea..0000000 --- a/usart/clock.h +++ /dev/null @@ -1,14 +0,0 @@ -/* -* Copyright (c) by BlackMark 2015 -* Date 24/11/2015 -* Version 1.1 -*/ - -#ifndef CLOCK_H -#define CLOCK_H - -#define F_CPU 8000000 - -#include - -#endif \ No newline at end of file diff --git a/usart/main.cpp b/usart/main.cpp deleted file mode 100644 index 2f8df71..0000000 --- a/usart/main.cpp +++ /dev/null @@ -1,94 +0,0 @@ -/* -* Copyright (c) by BlackMark 2015-2018 -* Date 11/08/2018 -* Version 1.6 -*/ - -#include - -#include "array/array.h" -#include "usart/usart.h" - -#include "clock.h" - -int main() -{ - sei(); - USART0 &cUSART = USART0::inst(); - cUSART.init(); - - uint32_t ui32Counter = 0; - - array arrBuffer; - - cUSART << "\r\nSizes: \r\n"; - - sprintf( arrBuffer.data(), "%d\r\n", sizeof( char ) ); - cUSART << "sizeof( char ) = " << arrBuffer.data(); - - sprintf( arrBuffer.data(), "%d\r\n", sizeof( unsigned char ) ); - cUSART << "sizeof( unsigned char ) = " << arrBuffer.data(); - - sprintf( arrBuffer.data(), "%d\r\n", sizeof( short int ) ); - cUSART << "sizeof( short int ) = " << arrBuffer.data(); - - sprintf( arrBuffer.data(), "%d\r\n", sizeof( unsigned short int ) ); - cUSART << "sizeof( unsigned short int ) = " << arrBuffer.data(); - - sprintf( arrBuffer.data(), "%d\r\n", sizeof( int ) ); - cUSART << "sizeof( int ) = " << arrBuffer.data(); - - sprintf( arrBuffer.data(), "%d\r\n", sizeof( unsigned int ) ); - cUSART << "sizeof( unsigned int ) = " << arrBuffer.data(); - - sprintf( arrBuffer.data(), "%d\r\n", sizeof( long int ) ); - cUSART << "sizeof( long int ) = " << arrBuffer.data(); - - sprintf( arrBuffer.data(), "%d\r\n", sizeof( unsigned long int ) ); - cUSART << "sizeof( unsigned long int ) = " << arrBuffer.data(); - - sprintf( arrBuffer.data(), "%d\r\n", sizeof( long long int ) ); - cUSART << "sizeof( long long int ) = " << arrBuffer.data(); - - sprintf( arrBuffer.data(), "%d\r\n", sizeof( unsigned long long int ) ); - cUSART << "sizeof( unsigned long long int ) = " << arrBuffer.data(); - - sprintf( arrBuffer.data(), "%d\r\n", sizeof( float ) ); - cUSART << "sizeof( float ) = " << arrBuffer.data(); - - sprintf( arrBuffer.data(), "%d\r\n", sizeof( double ) ); - cUSART << "sizeof( double ) = " << arrBuffer.data(); - - sprintf( arrBuffer.data(), "%d\r\n", sizeof( long double ) ); - cUSART << "sizeof( long double ) = " << arrBuffer.data(); - - sprintf( arrBuffer.data(), "%d\r\n\r\n", sizeof( void* ) ); - cUSART << "sizeof( void* ) = " << arrBuffer.data(); - - while( true ) - { - sprintf( arrBuffer.data(), "%lu", ui32Counter++ ); - cUSART << "This has been running for \"" << arrBuffer.data() << "\" seconds!\r\n"; - - if( !cUSART.receiveLine( arrBuffer.data(), arrBuffer.size(), "\r" ) ) - { - cUSART << "Receive error: "; - } - else - { - cUSART << "Echo: "; - } - - cUSART << arrBuffer.data() << "\r\n"; - - uint8_t ui8Byte; - - if( cUSART.receiveByte( ui8Byte, 1000 ) ) - { - cUSART.transmitByte( ui8Byte ); - cUSART << "\r\n"; - } - } - - return 0; -} \ No newline at end of file diff --git a/usart/usart b/usart/usart deleted file mode 160000 index 81e6a9f..0000000 --- a/usart/usart +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 81e6a9fdc0c588712b4a1b1598a927326d282c53