From cb5f49d20ef2ca3c9913b6e66c14e20e939770e6 Mon Sep 17 00:00:00 2001 From: Hideaki Tai Date: Tue, 29 Sep 2020 21:09:25 +0900 Subject: [PATCH] update namespace and compile flag based on new arx --- Artnet.h | 40 ++++++++++++---------------------------- 1 file changed, 12 insertions(+), 28 deletions(-) diff --git a/Artnet.h b/Artnet.h index 8223710..ec8cd2e 100644 --- a/Artnet.h +++ b/Artnet.h @@ -7,14 +7,8 @@ // Packet Definition : https://art-net.org.uk/structure/streaming-packets/artdmx-packet-definition/ #include - -#if defined(ARDUINO_ARCH_AVR)\ - || defined(ARDUINO_ARCH_MEGAAVR)\ - || defined(ARDUINO_ARCH_SAM)\ - || defined(ARDUINO_ARCH_SAMD)\ - || defined(ARDUINO_spresense_ast) - #define ARTNET_DISABLE_STL -#endif +#include "util/ArxTypeTraits/ArxTypeTraits.h" +#include "util/ArxContainer/ArxContainer.h" #if defined(ESP_PLATFORM)\ || defined(ESP8266)\ @@ -26,15 +20,13 @@ #define ARTNET_ENABLE_WIFI #endif -#if defined(TEENSYDUINO)\ - || defined(ESP8266)\ - || defined(ARTNET_DISABLE_STL) +#if defined(ESP8266)\ + || !defined(ARTNET_ENABLE_WIFI) #define ARTNET_ENABLE_ETHER #endif #if !defined (ARTNET_ENABLE_WIFI)\ - && !defined (ARTNET_ENABLE_ETHER)\ - && !defined (ARTNET_DISABLE_STL) + && !defined (ARTNET_ENABLE_ETHER) #error THIS PLATFORM HAS NO WIFI OR ETHERNET OR NOT SUPPORTED ARCHITECTURE. PLEASE LET ME KNOW! #endif @@ -65,14 +57,6 @@ #include "util/TeensyDirtySTLErrorSolution/TeensyDirtySTLErrorSolution.h" #endif // ARTNET_ENABLE_ETHER -#ifdef ARTNET_DISABLE_STL - #include "util/ArxContainer/ArxContainer.h" -#else - #include - #include - #include -#endif - namespace arduino { @@ -150,7 +134,13 @@ namespace arduino static constexpr uint8_t NUM_PIXELS_PER_UNIV { 170 }; -#ifdef ARTNET_DISABLE_STL +#if ARX_HAVE_LIBSTDCPLUSPLUS >= 201103L // Have libstdc++11 + template + using Array = std::array; + using CallbackType = std::function; + struct Map { uint32_t universe; CallbackType func; }; + using CallbackMap = std::vector; +#else template class Array { @@ -165,12 +155,6 @@ namespace arduino typedef void (*CallbackType)(uint8_t* data, uint16_t size); struct Map { uint32_t universe; CallbackType func; }; using CallbackMap = arx::vector; -#else - template - using Array = std::array; - using CallbackType = std::function; - struct Map { uint32_t universe; CallbackType func; }; - using CallbackMap = std::vector; #endif template