update namespace and compile flag based on new arx

master
Hideaki Tai 4 years ago
parent 91dd8bc6fa
commit cb5f49d20e

@ -7,14 +7,8 @@
// Packet Definition : https://art-net.org.uk/structure/streaming-packets/artdmx-packet-definition/ // Packet Definition : https://art-net.org.uk/structure/streaming-packets/artdmx-packet-definition/
#include <Arduino.h> #include <Arduino.h>
#include "util/ArxTypeTraits/ArxTypeTraits.h"
#if defined(ARDUINO_ARCH_AVR)\ #include "util/ArxContainer/ArxContainer.h"
|| defined(ARDUINO_ARCH_MEGAAVR)\
|| defined(ARDUINO_ARCH_SAM)\
|| defined(ARDUINO_ARCH_SAMD)\
|| defined(ARDUINO_spresense_ast)
#define ARTNET_DISABLE_STL
#endif
#if defined(ESP_PLATFORM)\ #if defined(ESP_PLATFORM)\
|| defined(ESP8266)\ || defined(ESP8266)\
@ -26,15 +20,13 @@
#define ARTNET_ENABLE_WIFI #define ARTNET_ENABLE_WIFI
#endif #endif
#if defined(TEENSYDUINO)\ #if defined(ESP8266)\
|| defined(ESP8266)\ || !defined(ARTNET_ENABLE_WIFI)
|| defined(ARTNET_DISABLE_STL)
#define ARTNET_ENABLE_ETHER #define ARTNET_ENABLE_ETHER
#endif #endif
#if !defined (ARTNET_ENABLE_WIFI)\ #if !defined (ARTNET_ENABLE_WIFI)\
&& !defined (ARTNET_ENABLE_ETHER)\ && !defined (ARTNET_ENABLE_ETHER)
&& !defined (ARTNET_DISABLE_STL)
#error THIS PLATFORM HAS NO WIFI OR ETHERNET OR NOT SUPPORTED ARCHITECTURE. PLEASE LET ME KNOW! #error THIS PLATFORM HAS NO WIFI OR ETHERNET OR NOT SUPPORTED ARCHITECTURE. PLEASE LET ME KNOW!
#endif #endif
@ -65,14 +57,6 @@
#include "util/TeensyDirtySTLErrorSolution/TeensyDirtySTLErrorSolution.h" #include "util/TeensyDirtySTLErrorSolution/TeensyDirtySTLErrorSolution.h"
#endif // ARTNET_ENABLE_ETHER #endif // ARTNET_ENABLE_ETHER
#ifdef ARTNET_DISABLE_STL
#include "util/ArxContainer/ArxContainer.h"
#else
#include <array>
#include <vector>
#include <functional>
#endif
namespace arduino namespace arduino
{ {
@ -150,7 +134,13 @@ namespace arduino
static constexpr uint8_t NUM_PIXELS_PER_UNIV { 170 }; static constexpr uint8_t NUM_PIXELS_PER_UNIV { 170 };
#ifdef ARTNET_DISABLE_STL #if ARX_HAVE_LIBSTDCPLUSPLUS >= 201103L // Have libstdc++11
template <uint16_t SIZE>
using Array = std::array<uint8_t, SIZE>;
using CallbackType = std::function<void(uint8_t* data, uint16_t size)>;
struct Map { uint32_t universe; CallbackType func; };
using CallbackMap = std::vector<Map>;
#else
template <uint16_t SIZE> template <uint16_t SIZE>
class Array class Array
{ {
@ -165,12 +155,6 @@ namespace arduino
typedef void (*CallbackType)(uint8_t* data, uint16_t size); typedef void (*CallbackType)(uint8_t* data, uint16_t size);
struct Map { uint32_t universe; CallbackType func; }; struct Map { uint32_t universe; CallbackType func; };
using CallbackMap = arx::vector<Map, 8>; using CallbackMap = arx::vector<Map, 8>;
#else
template <uint16_t SIZE>
using Array = std::array<uint8_t, SIZE>;
using CallbackType = std::function<void(uint8_t* data, uint16_t size)>;
struct Map { uint32_t universe; CallbackType func; };
using CallbackMap = std::vector<Map>;
#endif #endif
template <typename S> template <typename S>

Loading…
Cancel
Save