diff --git a/.gitignore b/.gitignore index 806bcd81..8441530d 100644 --- a/.gitignore +++ b/.gitignore @@ -277,3 +277,4 @@ test/Makefile test/vs2019/enc_temp_folder test/vs2019/.leu test/etl_test_log.txt +temp/create_arduino_library.py diff --git a/arduino/Embedded_Template_Library.h b/arduino/Embedded_Template_Library.h new file mode 100644 index 00000000..df5fdcf4 --- /dev/null +++ b/arduino/Embedded_Template_Library.h @@ -0,0 +1,80 @@ + +#ifndef ETL_EMBEDDED_TEMPLATE_LIBRARY_INCLUDED +#define ETL_EMBEDDED_TEMPLATE_LIBRARY_INCLUDED + +#if defined(TEENSYDUINO) + + #if defined(__AVR_ATmega32U4__) + #define ARDUINO_BOARD "Teensy 2.0" + #elif defined(__AVR_AT90USB1286__) + #define ARDUINO_BOARD "Teensy++ 2.0" + #elif defined(__MK20DX128__) + #define ARDUINO_BOARD "Teensy 3.0" + #elif defined(__MK20DX256__) + #define ARDUINO_BOARD "Teensy 3.2" // and Teensy 3.1 + #elif defined(__MKL26Z64__) + #define ARDUINO_BOARD "Teensy LC" + #elif defined(__MK64FX512__) + #define ARDUINO_BOARD "Teensy 3.5" + #elif defined(__MK66FX1M0__) + #define ARDUINO_BOARD "Teensy 3.6" + #else + #error "Unknown" + #endif + +#else // --------------- Arduino ------------------ + + #if defined(ARDUINO_AVR_ADK) + #define ARDUINO_BOARD "Mega Adk" + #elif defined(ARDUINO_AVR_BT) + #define ARDUINO_BOARD "Bt" + #elif defined(ARDUINO_AVR_DUEMILANOVE) + #define ARDUINO_BOARD "Duemilanove" + #elif defined(ARDUINO_AVR_ESPLORA) + #define ARDUINO_BOARD "Esplora" + #elif defined(ARDUINO_AVR_ETHERNET) + #define ARDUINO_BOARD "Ethernet" + #elif defined(ARDUINO_AVR_FIO) + #define ARDUINO_BOARD "Fio" + #elif defined(ARDUINO_AVR_GEMMA) + #define ARDUINO_BOARD "Gemma" + #elif defined(ARDUINO_AVR_LEONARDO) + #define ARDUINO_BOARD "Leonardo" + #elif defined(ARDUINO_AVR_LILYPAD) + #define ARDUINO_BOARD "Lilypad" + #elif defined(ARDUINO_AVR_LILYPAD_USB) + #define ARDUINO_BOARD "Lilypad Usb" + #elif defined(ARDUINO_AVR_MEGA) + #define ARDUINO_BOARD "Mega" + #elif defined(ARDUINO_AVR_MEGA2560) + #define ARDUINO_BOARD "Mega 2560" + #elif defined(ARDUINO_AVR_MICRO) + #define ARDUINO_BOARD "Micro" + #elif defined(ARDUINO_AVR_MINI) + #define ARDUINO_BOARD "Mini" + #elif defined(ARDUINO_AVR_NANO) + #define ARDUINO_BOARD "Nano" + #elif defined(ARDUINO_AVR_NG) + #define ARDUINO_BOARD "NG" + #elif defined(ARDUINO_AVR_PRO) + #define ARDUINO_BOARD "Pro" + #elif defined(ARDUINO_AVR_ROBOT_CONTROL) + #define ARDUINO_BOARD "Robot Ctrl" + #elif defined(ARDUINO_AVR_ROBOT_MOTOR) + #define ARDUINO_BOARD "Robot Motor" + #elif defined(ARDUINO_AVR_UNO) + #define ARDUINO_BOARD "Uno" + #elif defined(ARDUINO_AVR_YUN) + #define ARDUINO_BOARD "Yun" + #elif defined(ARDUINO_SAM_DUE) + #define ARDUINO_BOARD "Due" + #elif defined(ARDUINO_SAMD_ZERO) + #define ARDUINO_BOARD "Zero" + #elif defined(ARDUINO_ARC32_TOOLS) + #define ARDUINO_BOARD "101" + #else + #error "Unknown" + #endif +#endif + +#endif \ No newline at end of file diff --git a/arduino/create_arduino_library.py b/arduino/create_arduino_library.py new file mode 100644 index 00000000..b2f6f101 --- /dev/null +++ b/arduino/create_arduino_library.py @@ -0,0 +1,47 @@ + +import shutil +import os + +# Get the current Path of the script +arduino_dir = os.path.dirname(__file__) +print('arduino_dir ', arduino_dir) + +etl_dir = os.path.dirname(arduino_dir) +print('etl_dir ', etl_dir) + +etl_include_dir = os.path.join(etl_dir, 'include') +print('etl_include_dir ', etl_include_dir) + +common_dir = os.path.dirname(etl_dir) +print('common_dir ', common_dir) + +etl_arduino_dir = os.path.join(common_dir, 'etl-arduino') +print('etl_arduino_dir ', etl_arduino_dir) + +etl_arduino_src_dir = os.path.join(etl_arduino_dir, 'src') +print('etl_arduino_src_dir ', etl_arduino_src_dir) + +print('') + +# Copy the library properties +filename = 'library.properties' +source = os.path.join(etl_dir, filename) +destination = os.path.join(etl_arduino_dir, filename) +print('source = ', source) +print('destination = ', destination) +shutil.copyfile(source, destination) + +# Copy the Arduino ETL header +filename = 'Embedded_Template_Library.h' +source = os.path.join(arduino_dir, filename) +destination = os.path.join(etl_arduino_src_dir, filename) +print('source = ', source) +print('destination = ', destination) +shutil.copyfile(source, destination) + +# Copy the ETL headers +source = etl_include_dir +destination = etl_arduino_src_dir +print('source = ', source) +print('destination = ', destination) +shutil.copytree(source, destination, dirs_exist_ok = True) diff --git a/include/etl/algorithm.h b/include/etl/algorithm.h index 5debe70e..b01f90d2 100644 --- a/include/etl/algorithm.h +++ b/include/etl/algorithm.h @@ -53,6 +53,8 @@ SOFTWARE. #include #endif +#include "private/minmax_push.h" + namespace etl { // Declare prototypes of the ETL's sort functions @@ -3417,4 +3419,6 @@ namespace etl #endif } +#include "private/minmax_pop.h" + #endif diff --git a/include/etl/private/minmax_pop.h b/include/etl/private/minmax_pop.h index f46e46a1..f7ee5c0e 100644 --- a/include/etl/private/minmax_pop.h +++ b/include/etl/private/minmax_pop.h @@ -33,7 +33,6 @@ SOFTWARE. * This file is intended to evaluated multiple times by design. */ -#if defined(ETL_COMPILER_MICROSOFT) - #pragma pop_macro("min") - #pragma pop_macro("max") -#endif +#pragma pop_macro("min") +#pragma pop_macro("max") + diff --git a/include/etl/private/minmax_push.h b/include/etl/private/minmax_push.h index 290a2024..465b6189 100644 --- a/include/etl/private/minmax_push.h +++ b/include/etl/private/minmax_push.h @@ -33,9 +33,7 @@ SOFTWARE. * This file is intended to evaluated multiple times by design. */ -#if defined(ETL_COMPILER_MICROSOFT) - #pragma push_macro("min") - #pragma push_macro("max") - #undef min - #undef max -#endif +#pragma push_macro("min") +#pragma push_macro("max") +#undef min +#undef max diff --git a/include/etl/version.h b/include/etl/version.h index 306423b4..be5b7221 100644 --- a/include/etl/version.h +++ b/include/etl/version.h @@ -39,7 +39,7 @@ SOFTWARE. #define ETL_VERSION_MAJOR 19 #define ETL_VERSION_MINOR 3 -#define ETL_VERSION_PATCH 5 +#define ETL_VERSION_PATCH 6 #define ETL_VERSION ETL_STRINGIFY(ETL_VERSION_MAJOR) "." ETL_STRINGIFY(ETL_VERSION_MINOR) "." ETL_STRINGIFY(ETL_VERSION_PATCH) #define ETL_VERSION_W ETL_STRINGIFY(ETL_VERSION_MAJOR) L"." ETL_STRINGIFY(ETL_VERSION_MINOR) L"." ETL_STRINGIFY(ETL_VERSION_PATCH) #define ETL_VERSION_U16 ETL_STRINGIFY(ETL_VERSION_MAJOR) u"." ETL_STRINGIFY(ETL_VERSION_MINOR) u"." ETL_STRINGIFY(ETL_VERSION_PATCH) diff --git a/library.json b/library.json index 9baacb26..de037bb3 100644 --- a/library.json +++ b/library.json @@ -1,13 +1,13 @@ { - "name": "Embedded Template Library", - "version": "19.3.5", + "name": "ETL Embedded Template Library", + "version": "19.3.6", "author s": { "name": "John Wellbelove", "email": "john.wellbelove@etlcpp.com" }, "homepage": "https://www.etlcpp.com/", "license": "MIT", - "description": "A C++ template library tailored for embedded systems.", + "description": "ETL. A C++ template library tailored for embedded systems.", "repository": { "type": "git", "url": "https://github.com/ETLCPP/etl.git" diff --git a/library.properties b/library.properties index a0d9a127..45f6c180 100644 --- a/library.properties +++ b/library.properties @@ -1,9 +1,9 @@ -name=Embedded Template Library -version=19.3.5 +name=Embedded Template Library ETL +version=19.3.6 author= John Wellbelove maintainer=John Wellbelove license=MIT -sentence=A C++ template library tailored for embedded systems. +sentence=ETL. A C++ template library tailored for embedded systems. paragraph= category=Other url=https://www.etlcpp.com/ diff --git a/support/Release notes.txt b/support/Release notes.txt index 7fe529ca..18bb0267 100644 --- a/support/Release notes.txt +++ b/support/Release notes.txt @@ -1,3 +1,7 @@ +=============================================================================== +19.3.6 +Arduino compatibility mods. + =============================================================================== 19.3.5 Change std::move to etl::move in etl::forward_list diff --git a/test/vs2019/etl.vcxproj b/test/vs2019/etl.vcxproj index 4c5a0dbf..554808e7 100644 --- a/test/vs2019/etl.vcxproj +++ b/test/vs2019/etl.vcxproj @@ -1240,6 +1240,7 @@ + @@ -1983,6 +1984,7 @@ + diff --git a/test/vs2019/etl.vcxproj.filters b/test/vs2019/etl.vcxproj.filters index 1d896976..20cf7365 100644 --- a/test/vs2019/etl.vcxproj.filters +++ b/test/vs2019/etl.vcxproj.filters @@ -85,6 +85,9 @@ {74399f00-a7a3-47e3-9b27-d01fb2b5ce87} + + {afc65d0e-d846-4e30-8723-06c8cefa3a36} + @@ -900,6 +903,9 @@ ETL\Utilities\Mutex + + ETL\Arduino + @@ -1510,6 +1516,9 @@ Resource Files + + ETL\Arduino + @@ -1548,4 +1557,4 @@ Resource Files\Images - + \ No newline at end of file