funtional testing (#593)

functional optional moved to common location
topology signed warnings cleaned up
This commit is contained in:
Michael Miller
2022-08-12 10:44:05 -07:00
committed by GitHub
parent fe42327867
commit b32f719e95
9 changed files with 49 additions and 36 deletions
-16
View File
@@ -27,22 +27,6 @@ License along with NeoPixel. If not, see
#include <Arduino.h>
// some platforms do not come with STL or properly defined one, specifically functional
// if you see...
// undefined reference to `std::__throw_bad_function_call()'
// ...then you can either add the platform symbol to the list so NEOPIXEBUS_NO_STL gets defined or
// go to boards.txt and enable c++ by adding (teensy31.build.flags.libs=-lstdc++) and set to "smallest code" option in Arduino
//
#if defined(ARDUINO_ARCH_AVR) || defined(ARDUINO_ARCH_MEGAAVR) || defined(STM32L432xx) || defined(STM32L476xx) || defined(ARDUINO_ARCH_SAM)
#define NEOPIXEBUS_NO_STL 1
#endif
// some platforms do not define this standard progmem type for some reason
//
#ifndef PGM_VOID_P
#define PGM_VOID_P const void *
#endif
// '_state' flags for internal state
#define NEO_DIRTY 0x80 // a change was made to pixel data that requires a show
+2
View File
@@ -26,6 +26,8 @@ License along with NeoPixel. If not, see
#pragma once
#include "internal/NeoUtil.h"
#if defined(NEOPIXEBUS_NO_STL)
typedef float(*AnimEaseFunction)(float unitValue);
+4 -3
View File
@@ -58,7 +58,7 @@ public:
uint16_t totalWidth = getWidth();
uint16_t totalHeight = getHeight();
if (x >= totalWidth)
if (x >= static_cast<int16_t>(totalWidth))
{
x = totalWidth - 1;
}
@@ -67,7 +67,7 @@ public:
x = 0;
}
if (y >= totalHeight)
if (y >= static_cast<int16_t>(totalHeight))
{
y = totalHeight - 1;
}
@@ -107,7 +107,8 @@ public:
uint16_t totalWidth = getWidth();
uint16_t totalHeight = getHeight();
if (x < 0 || x >= totalWidth || y < 0 || y >= totalHeight)
if (x < 0 || x >= static_cast<int16_t>(totalWidth) ||
y < 0 || y >= static_cast<int16_t>(totalHeight))
{
return NeoTopologyHint_OutOfBounds;
}
+4 -3
View File
@@ -52,7 +52,7 @@ public:
uint16_t totalWidth = getWidth();
uint16_t totalHeight = getHeight();
if (x >= totalWidth)
if (x >= static_cast<int16_t>(totalWidth))
{
x = totalWidth - 1;
}
@@ -61,7 +61,7 @@ public:
x = 0;
}
if (y >= totalHeight)
if (y >= static_cast<int16_t>(totalHeight))
{
y = totalHeight - 1;
}
@@ -101,7 +101,8 @@ public:
uint16_t totalWidth = getWidth();
uint16_t totalHeight = getHeight();
if (x < 0 || x >= totalWidth || y < 0 || y >= totalHeight)
if (x < 0 || x >= static_cast<int16_t>(totalWidth) ||
y < 0 || y >= static_cast<int16_t>(totalHeight))
{
return NeoTopologyHint_OutOfBounds;
}
+2 -2
View File
@@ -47,7 +47,7 @@ public:
uint16_t Map(int16_t x, int16_t y) const
{
if (x >= _width)
if (x >= static_cast<int16_t>(_width))
{
x = _width - 1;
}
@@ -55,7 +55,7 @@ public:
{
x = 0;
}
if (y >= _height)
if (y >= static_cast<int16_t>(_height))
{
y = _height - 1;
}
+16
View File
@@ -26,6 +26,22 @@ License along with NeoPixel. If not, see
#pragma once
// some platforms do not come with STL or properly defined one, specifically functional
// if you see...
// undefined reference to `std::__throw_bad_function_call()'
// ...then you can either add the platform symbol to the list so NEOPIXEBUS_NO_STL gets defined or
// go to boards.txt and enable c++ by adding (teensy31.build.flags.libs=-lstdc++) and set to "smallest code" option in Arduino
//
#if defined(ARDUINO_ARCH_AVR) || defined(ARDUINO_ARCH_MEGAAVR) || defined(STM32L432xx) || defined(STM32L476xx) || defined(ARDUINO_ARCH_SAM)
#define NEOPIXEBUS_NO_STL 1
#endif
// some platforms do not define this standard progmem type for some reason
//
#ifndef PGM_VOID_P
#define PGM_VOID_P const void *
#endif
#ifndef countof
#define countof(array) (sizeof(array)/sizeof(array[0]))
#endif