use ArxContainer and ArxTypeTraits

master
Hideaki Tai 4 years ago
parent 532bcf9fbb
commit 1da9205aa8

@ -134,26 +134,16 @@ namespace arduino
static constexpr uint8_t NUM_PIXELS_PER_UNIV { 170 }; static constexpr uint8_t NUM_PIXELS_PER_UNIV { 170 };
using CallbackType = std::function<void(uint8_t* data, uint16_t size)>;
struct Map { uint32_t universe; CallbackType func; };
#if ARX_HAVE_LIBSTDCPLUSPLUS >= 201103L // Have libstdc++11 #if ARX_HAVE_LIBSTDCPLUSPLUS >= 201103L // Have libstdc++11
template <uint16_t SIZE> template <uint16_t SIZE>
using Array = std::array<uint8_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>; using CallbackMap = std::vector<Map>;
#else #else
template <uint16_t SIZE> template <uint16_t SIZE>
class Array using Array = arx::vector<uint8_t, SIZE>;
{
uint8_t buffer[SIZE];
public:
const uint8_t* data() const { return buffer; }
uint8_t* data() { return buffer; }
uint16_t size() const { return SIZE; }
uint8_t operator[] (const size_t i) const { return buffer[i]; }
uint8_t& operator[] (const size_t i) { return buffer[i]; }
};
typedef void (*CallbackType)(uint8_t* data, uint16_t size);
struct Map { uint32_t universe; CallbackType func; };
using CallbackMap = arx::vector<Map, 8>; using CallbackMap = arx::vector<Map, 8>;
#endif #endif

Loading…
Cancel
Save