forked from Makuna/NeoPixelBus
Tm1814 continued (#330)
* EspBitBang * Esp32I2s * Esp8266Dma * esp8266UartTm1814 * Nrf52x and DotStars
This commit is contained in:
26
keywords.txt
26
keywords.txt
@ -48,11 +48,13 @@ NeoLc8812InvertedMethod KEYWORD1
|
||||
NeoApa106InvertedMethod KEYWORD1
|
||||
NeoEsp8266DmaWs2812xMethod KEYWORD1
|
||||
NeoEsp8266DmaSk6812Method KEYWORD1
|
||||
NeoEsp8266DmaTm1814Method KEYWORD1
|
||||
NeoEsp8266DmaApa106Method KEYWORD1
|
||||
NeoEsp8266Dma800KbpsMethod KEYWORD1
|
||||
NeoEsp8266Dma400KbpsMethod KEYWORD1
|
||||
NeoEsp8266DmaInvertedWs2812xMethod KEYWORD1
|
||||
NeoEsp8266DmaInvertedSk6812Method KEYWORD1
|
||||
NeoEsp8266DmaInvertedTm1814Method KEYWORD1
|
||||
NeoEsp8266DmaInvertedApa106Method KEYWORD1
|
||||
NeoEsp8266DmaInverted800KbpsMethod KEYWORD1
|
||||
NeoEsp8266DmaInverted400KbpsMethod KEYWORD1
|
||||
@ -61,6 +63,7 @@ NeoEsp8266Uart0Ws2812xMethod KEYWORD1
|
||||
NeoEsp8266Uart0Ws2812Method KEYWORD1
|
||||
NeoEsp8266Uart0Ws2811Method KEYWORD1
|
||||
NeoEsp8266Uart0Sk6812Method KEYWORD1
|
||||
NeoEsp8266Uart0Tm1814Method KEYWORD1
|
||||
NeoEsp8266Uart0Lc8812Method KEYWORD1
|
||||
NeoEsp8266Uart0Apa106Method KEYWORD1
|
||||
NeoEsp8266Uart0800KbpsMethod KEYWORD1
|
||||
@ -70,6 +73,7 @@ NeoEsp8266AsyncUart0Ws2812xMethod KEYWORD1
|
||||
NeoEsp8266AsyncUart0Ws2812Method KEYWORD1
|
||||
NeoEsp8266AsyncUart0Ws2811Method KEYWORD1
|
||||
NeoEsp8266AsyncUart0Sk6812Method KEYWORD1
|
||||
NeoEsp8266AsyncUart0Tm1814Method KEYWORD1
|
||||
NeoEsp8266AsyncUart0Lc8812Method KEYWORD1
|
||||
NeoEsp8266AsyncUart0Apa106Method KEYWORD1
|
||||
NeoEsp8266AsyncUart0800KbpsMethod KEYWORD1
|
||||
@ -79,6 +83,7 @@ NeoEsp8266Uart1Ws2812xMethod KEYWORD1
|
||||
NeoEsp8266Uart1Ws2812Method KEYWORD1
|
||||
NeoEsp8266Uart1Ws2811Method KEYWORD1
|
||||
NeoEsp8266Uart1Sk6812Method KEYWORD1
|
||||
NeoEsp8266Uart1Tm1814 KEYWORD1
|
||||
NeoEsp8266Uart1Lc8812Method KEYWORD1
|
||||
NeoEsp8266Uart1Apa106Method KEYWORD1
|
||||
NeoEsp8266Uart1800KbpsMethod KEYWORD1
|
||||
@ -88,6 +93,7 @@ NeoEsp8266AsyncUart1Ws2812xMethod KEYWORD1
|
||||
NeoEsp8266AsyncUart1Ws2812Method KEYWORD1
|
||||
NeoEsp8266AsyncUart1Ws2811Method KEYWORD1
|
||||
NeoEsp8266AsyncUart1Sk6812Method KEYWORD1
|
||||
NeoEsp8266AsyncUart1Tm1814 KEYWORD1
|
||||
NeoEsp8266AsyncUart1Lc8812Method KEYWORD1
|
||||
NeoEsp8266AsyncUart1Apa106Method KEYWORD1
|
||||
NeoEsp8266AsyncUart1800KbpsMethod KEYWORD1
|
||||
@ -97,6 +103,7 @@ NeoEsp8266Uart0Ws2812xInvertedMethod KEYWORD1
|
||||
NeoEsp8266Uart0Ws2812InvertedMethod KEYWORD1
|
||||
NeoEsp8266Uart0Ws2811InvertedMethod KEYWORD1
|
||||
NeoEsp8266Uart0Sk6812InvertedMethod KEYWORD1
|
||||
NeoEsp8266Uart0Tm1814InvertedMethod KEYWORD1
|
||||
NeoEsp8266Uart0Lc8812InvertedMethod KEYWORD1
|
||||
NeoEsp8266Uart0Apa106InvertedMethod KEYWORD1
|
||||
NeoEsp8266Uart0800KbpsInvertedMethod KEYWORD1
|
||||
@ -106,6 +113,7 @@ NeoEsp8266AsyncUart0Ws2812xInvertedMethod KEYWORD1
|
||||
NeoEsp8266AsyncUart0Ws2812InvertedMethod KEYWORD1
|
||||
NeoEsp8266AsyncUart0Ws2811InvertedMethod KEYWORD1
|
||||
NeoEsp8266AsyncUart0Sk6812InvertedMethod KEYWORD1
|
||||
NeoEsp8266AsyncUart0Tm1814InvertedMethod KEYWORD1
|
||||
NeoEsp8266AsyncUart0Lc8812InvertedMethod KEYWORD1
|
||||
NeoEsp8266AsyncUart0Apa106InvertedMethod KEYWORD1
|
||||
NeoEsp8266AsyncUart0800KbpsInvertedMethod KEYWORD1
|
||||
@ -115,6 +123,7 @@ NeoEsp8266Uart1Ws2812xInvertedMethod KEYWORD1
|
||||
NeoEsp8266Uart1Ws2812InvertedMethod KEYWORD1
|
||||
NeoEsp8266Uart1Ws2811InvertedMethod KEYWORD1
|
||||
NeoEsp8266Uart1Sk6812InvertedMethod KEYWORD1
|
||||
NeoEsp8266Uart1Tm1814InvertedMethod KEYWORD1
|
||||
NeoEsp8266Uart1Lc8812InvertedMethod KEYWORD1
|
||||
NeoEsp8266Uart1Apa106InvertedMethod KEYWORD1
|
||||
NeoEsp8266Uart1800KbpsInvertedMethod KEYWORD1
|
||||
@ -124,6 +133,7 @@ NeoEsp8266AsyncUart1Ws2812xInvertedMethod KEYWORD1
|
||||
NeoEsp8266AsyncUart1Ws2812InvertedMethod KEYWORD1
|
||||
NeoEsp8266AsyncUart1Ws2811InvertedMethod KEYWORD1
|
||||
NeoEsp8266AsyncUart1Sk6812InvertedMethod KEYWORD1
|
||||
NeoEsp8266AsyncUart1Tm1814InvertedMethod KEYWORD1
|
||||
NeoEsp8266AsyncUart1Lc8812InvertedMethod KEYWORD1
|
||||
NeoEsp8266AsyncUart1Apa106InvertedMethod KEYWORD1
|
||||
NeoEsp8266AsyncUart1800KbpsInvertedMethod KEYWORD1
|
||||
@ -133,6 +143,7 @@ NeoEsp8266BitBangWs2812xMethod KEYWORD1
|
||||
NeoEsp8266BitBangWs2812Method KEYWORD1
|
||||
NeoEsp8266BitBangWs2811Method KEYWORD1
|
||||
NeoEsp8266BitBangSk6812Method KEYWORD1
|
||||
NeoEsp8266BitBangTm1814Method KEYWORD1
|
||||
NeoEsp8266BitBangLc8812Method KEYWORD1
|
||||
NeoEsp8266BitBangApa106Method KEYWORD1
|
||||
NeoEsp8266BitBang800KbpsMethod KEYWORD1
|
||||
@ -142,27 +153,32 @@ NeoEsp8266BitBangWs2812xInvertedMethod KEYWORD1
|
||||
NeoEsp8266BitBangWs2812InvertedMethod KEYWORD1
|
||||
NeoEsp8266BitBangWs2811InvertedMethod KEYWORD1
|
||||
NeoEsp8266BitBangSk6812InvertedMethod KEYWORD1
|
||||
NeoEsp8266BitBangTm1814InvertedMethod KEYWORD1
|
||||
NeoEsp8266BitBangLc8812InvertedMethod KEYWORD1
|
||||
NeoEsp8266BitBangApa106InvertedMethod KEYWORD1
|
||||
NeoEsp8266BitBang800KbpsInvertedMethod KEYWORD1
|
||||
NeoEsp8266BitBang400KbpsInvertedMethod KEYWORD1
|
||||
NeoEsp32I2s0Ws2812xMethod KEYWORD1
|
||||
NeoEsp32I2s0Sk6812Method KEYWORD1
|
||||
NeoEsp32I2s0Tm1814Method KEYWORD1
|
||||
NeoEsp32I2s0800KbpsMethod KEYWORD1
|
||||
NeoEsp32I2s0400KbpsMethod KEYWORD1
|
||||
NeoEsp32I2s0Apa106Method KEYWORD1
|
||||
NeoEsp32I2s1Ws2812xMethod KEYWORD1
|
||||
NeoEsp32I2s1Sk6812Method KEYWORD1
|
||||
NeoEsp32I2s1Tm1814Method KEYWORD1
|
||||
NeoEsp32I2s1800KbpsMethod KEYWORD1
|
||||
NeoEsp32I2s1400KbpsMethod KEYWORD1
|
||||
NeoEsp32I2s1Apa106Method KEYWORD1
|
||||
NeoEsp32I2s0Ws2812xInvertedMethod KEYWORD1
|
||||
NeoEsp32I2s0Sk6812InvertedMethod KEYWORD1
|
||||
NeoEsp32I2s0Tm1814InvertedMethod KEYWORD1
|
||||
NeoEsp32I2s0800KbpsInvertedMethod KEYWORD1
|
||||
NeoEsp32I2s0400KbpsInvertedMethod KEYWORD1
|
||||
NeoEsp32I2s0Apa106InvertedMethod KEYWORD1
|
||||
NeoEsp32I2s1Ws2812xInvertedMethod KEYWORD1
|
||||
NeoEsp32I2s1Sk6812InvertedMethod KEYWORD1
|
||||
NeoEsp32I2s1Tm1814InvertedMethod KEYWORD1
|
||||
NeoEsp32I2s1800KbpsInvertedMethod KEYWORD1
|
||||
NeoEsp32I2s1400KbpsInvertedMethod KEYWORD1
|
||||
NeoEsp32I2s1Apa106InvertedMethod KEYWORD1
|
||||
@ -283,6 +299,7 @@ NeoEsp32BitBangWs2812xMethod KEYWORD1
|
||||
NeoEsp32BitBangWs2812Method KEYWORD1
|
||||
NeoEsp32BitBangWs2811Method KEYWORD1
|
||||
NeoEsp32BitBangSk6812Method KEYWORD1
|
||||
NeoEsp32BitBangTm1814Method KEYWORD1
|
||||
NeoEsp32BitBangLc8812Method KEYWORD1
|
||||
NeoEsp32BitBangApa106Method KEYWORD1
|
||||
NeoEsp32BitBang800KbpsMethod KEYWORD1
|
||||
@ -292,47 +309,56 @@ NeoEsp32BitBangWs2812xInvertedMethod KEYWORD1
|
||||
NeoEsp32BitBangWs2812InvertedMethod KEYWORD1
|
||||
NeoEsp32BitBangWs2811InvertedMethod KEYWORD1
|
||||
NeoEsp32BitBangSk6812InvertedMethod KEYWORD1
|
||||
NeoEsp32BitBangTm1814InvertedMethod KEYWORD1
|
||||
NeoEsp32BitBangLc8812InvertedMethod KEYWORD1
|
||||
NeoEsp32BitBangApa106InvertedMethod KEYWORD1
|
||||
NeoEsp32BitBang800KbpsInvertedMethod KEYWORD1
|
||||
NeoEsp32BitBang400KbpsInvertedMethod KEYWORD1
|
||||
NeoNrf52xPwm0Ws2812xMethod KEYWORD1
|
||||
NeoNrf52xPwm0Sk6812Method KEYWORD1
|
||||
NeoNrf52xPwm0Tm1814Method KEYWORD1
|
||||
NeoNrf52xPwm0800KbpsMethod KEYWORD1
|
||||
NeoNrf52xPwm0400KbpsMethod KEYWORD1
|
||||
NeoNrf52xPwm0Apa106Method KEYWORD1
|
||||
NeoNrf52xPwm1Ws2812xMethod KEYWORD1
|
||||
NeoNrf52xPwm1Sk6812Method KEYWORD1
|
||||
NeoNrf52xPwm1Tm1814Method KEYWORD1
|
||||
NeoNrf52xPwm1800KbpsMethod KEYWORD1
|
||||
NeoNrf52xPwm1400KbpsMethod KEYWORD1
|
||||
NeoNrf52xPwm1Apa106Method KEYWORD1
|
||||
NeoNrf52xPwm2Ws2812xMethod KEYWORD1
|
||||
NeoNrf52xPwm2Sk6812Method KEYWORD1
|
||||
NeoNrf52xPwm2Tm1814Method KEYWORD1
|
||||
NeoNrf52xPwm2800KbpsMethod KEYWORD1
|
||||
NeoNrf52xPwm2400KbpsMethod KEYWORD1
|
||||
NeoNrf52xPwm2Apa106Method KEYWORD1
|
||||
NeoNrf52xPwm3Ws2812xMethod KEYWORD1
|
||||
NeoNrf52xPwm3Sk6812Method KEYWORD1
|
||||
NeoNrf52xPwm3Tm1814Method KEYWORD1
|
||||
NeoNrf52xPwm3800KbpsMethod KEYWORD1
|
||||
NeoNrf52xPwm3400KbpsMethod KEYWORD1
|
||||
NeoNrf52xPwm3Apa106Method KEYWORD1
|
||||
NeoNrf52xPwm0Ws2812xInvertedMethod KEYWORD1
|
||||
NeoNrf52xPwm0Sk6812InvertedMethod KEYWORD1
|
||||
NeoNrf52xPwm0Tm1814InvertedMethod KEYWORD1
|
||||
NeoNrf52xPwm0800KbpsInvertedMethod KEYWORD1
|
||||
NeoNrf52xPwm0400KbpsInvertedMethod KEYWORD1
|
||||
NeoNrf52xPwm0Apa106InvertedMethod KEYWORD1
|
||||
NeoNrf52xPwm1Ws2812xInvertedMethod KEYWORD1
|
||||
NeoNrf52xPwm1Sk6812InvertedMethod KEYWORD1
|
||||
NeoNrf52xPwm1Tm1814InvertedMethod KEYWORD1
|
||||
NeoNrf52xPwm1800KbpsInvertedMethod KEYWORD1
|
||||
NeoNrf52xPwm1400KbpsInvertedMethod KEYWORD1
|
||||
NeoNrf52xPwm1Apa106InvertedMethod KEYWORD1
|
||||
NeoNrf52xPwm2Ws2812xInvertedMethod KEYWORD1
|
||||
NeoNrf52xPwm2Sk6812InvertedMethod KEYWORD1
|
||||
NeoNrf52xPwm2Tm1814InvertedMethod KEYWORD1
|
||||
NeoNrf52xPwm2800KbpsInvertedMethod KEYWORD1
|
||||
NeoNrf52xPwm2400KbpsInvertedMethod KEYWORD1
|
||||
NeoNrf52xPwm2Apa106InvertedMethod KEYWORD1
|
||||
NeoNrf52xPwm3Ws2812xInvertedMethod KEYWORD1
|
||||
NeoNrf52xPwm3Sk6812InvertedMethod KEYWORD1
|
||||
NeoNrf52xPwm3Tm1814InvertedMethod KEYWORD1
|
||||
NeoNrf52xPwm3800KbpsInvertedMethod KEYWORD1
|
||||
NeoNrf52xPwm3400KbpsInvertedMethod KEYWORD1
|
||||
NeoNrf52xPwm3Apa106InvertedMethod KEYWORD1
|
||||
|
@ -160,7 +160,40 @@ public:
|
||||
typedef RgbwColor ColorObject;
|
||||
};
|
||||
|
||||
class DotStarBgrFeature : public DotStar3Elements
|
||||
|
||||
class DotStar3ElementsNoSettings : public DotStar3Elements
|
||||
{
|
||||
public:
|
||||
typedef NeoNoSettings SettingsObject;
|
||||
static const size_t SettingsSize = 0;
|
||||
|
||||
static void applySettings(uint8_t* pData, const SettingsObject& settings)
|
||||
{
|
||||
}
|
||||
|
||||
static uint8_t* pixels(uint8_t* pData)
|
||||
{
|
||||
return pData;
|
||||
}
|
||||
};
|
||||
|
||||
class DotStar4ElementsNoSettings : public DotStar4Elements
|
||||
{
|
||||
public:
|
||||
typedef NeoNoSettings SettingsObject;
|
||||
static const size_t SettingsSize = 0;
|
||||
|
||||
static void applySettings(uint8_t* pData, const SettingsObject& settings)
|
||||
{
|
||||
}
|
||||
|
||||
static uint8_t* pixels(uint8_t* pData)
|
||||
{
|
||||
return pData;
|
||||
}
|
||||
};
|
||||
|
||||
class DotStarBgrFeature : public DotStar3ElementsNoSettings
|
||||
{
|
||||
public:
|
||||
static void applyPixelColor(uint8_t* pPixels, uint16_t indexPixel, ColorObject color)
|
||||
@ -201,7 +234,7 @@ public:
|
||||
|
||||
};
|
||||
|
||||
class DotStarLbgrFeature : public DotStar4Elements
|
||||
class DotStarLbgrFeature : public DotStar4ElementsNoSettings
|
||||
{
|
||||
public:
|
||||
static void applyPixelColor(uint8_t* pPixels, uint16_t indexPixel, ColorObject color)
|
||||
@ -242,7 +275,7 @@ public:
|
||||
|
||||
};
|
||||
|
||||
class DotStarGrbFeature : public DotStar3Elements
|
||||
class DotStarGrbFeature : public DotStar3ElementsNoSettings
|
||||
{
|
||||
public:
|
||||
static void applyPixelColor(uint8_t* pPixels, uint16_t indexPixel, ColorObject color)
|
||||
@ -283,7 +316,7 @@ public:
|
||||
|
||||
};
|
||||
|
||||
class DotStarLgrbFeature : public DotStar4Elements
|
||||
class DotStarLgrbFeature : public DotStar4ElementsNoSettings
|
||||
{
|
||||
public:
|
||||
static void applyPixelColor(uint8_t* pPixels, uint16_t indexPixel, ColorObject color)
|
||||
@ -325,7 +358,7 @@ public:
|
||||
};
|
||||
|
||||
/* RGB Feature -- Some APA102s ship in RGB order */
|
||||
class DotStarRgbFeature : public DotStar3Elements
|
||||
class DotStarRgbFeature : public DotStar3ElementsNoSettings
|
||||
{
|
||||
public:
|
||||
static void applyPixelColor(uint8_t* pPixels, uint16_t indexPixel, ColorObject color)
|
||||
@ -366,7 +399,7 @@ public:
|
||||
|
||||
};
|
||||
|
||||
class DotStarLrgbFeature : public DotStar4Elements
|
||||
class DotStarLrgbFeature : public DotStar4ElementsNoSettings
|
||||
{
|
||||
public:
|
||||
static void applyPixelColor(uint8_t* pPixels, uint16_t indexPixel, ColorObject color)
|
||||
@ -407,7 +440,7 @@ public:
|
||||
|
||||
};
|
||||
/* RBG Feature -- Some APA102s ship in RBG order */
|
||||
class DotStarRbgFeature : public DotStar3Elements
|
||||
class DotStarRbgFeature : public DotStar3ElementsNoSettings
|
||||
{
|
||||
public:
|
||||
static void applyPixelColor(uint8_t* pPixels, uint16_t indexPixel, ColorObject color)
|
||||
@ -448,7 +481,7 @@ public:
|
||||
|
||||
};
|
||||
|
||||
class DotStarLrbgFeature : public DotStar4Elements
|
||||
class DotStarLrbgFeature : public DotStar4ElementsNoSettings
|
||||
{
|
||||
public:
|
||||
static void applyPixelColor(uint8_t* pPixels, uint16_t indexPixel, ColorObject color)
|
||||
@ -490,7 +523,7 @@ public:
|
||||
};
|
||||
|
||||
/* GBR Feature -- Some APA102s ship in GBR order */
|
||||
class DotStarGbrFeature : public DotStar3Elements
|
||||
class DotStarGbrFeature : public DotStar3ElementsNoSettings
|
||||
{
|
||||
public:
|
||||
static void applyPixelColor(uint8_t* pPixels, uint16_t indexPixel, ColorObject color)
|
||||
@ -531,7 +564,7 @@ public:
|
||||
|
||||
};
|
||||
|
||||
class DotStarLgbrFeature : public DotStar4Elements
|
||||
class DotStarLgbrFeature : public DotStar4ElementsNoSettings
|
||||
{
|
||||
public:
|
||||
static void applyPixelColor(uint8_t* pPixels, uint16_t indexPixel, ColorObject color)
|
||||
@ -572,7 +605,7 @@ public:
|
||||
|
||||
};
|
||||
/* BRG Feature -- Some APA102s ship in BRG order */
|
||||
class DotStarBrgFeature : public DotStar3Elements
|
||||
class DotStarBrgFeature : public DotStar3ElementsNoSettings
|
||||
{
|
||||
public:
|
||||
static void applyPixelColor(uint8_t* pPixels, uint16_t indexPixel, ColorObject color)
|
||||
@ -613,7 +646,7 @@ public:
|
||||
|
||||
};
|
||||
|
||||
class DotStarLbrgFeature : public DotStar4Elements
|
||||
class DotStarLbrgFeature : public DotStar4ElementsNoSettings
|
||||
{
|
||||
public:
|
||||
static void applyPixelColor(uint8_t* pPixels, uint16_t indexPixel, ColorObject color)
|
||||
|
@ -37,25 +37,25 @@ License along with NeoPixel. If not, see
|
||||
template<typename T_TWOWIRE> class DotStarMethodBase
|
||||
{
|
||||
public:
|
||||
DotStarMethodBase(uint8_t pinClock, uint8_t pinData, uint16_t pixelCount, size_t elementSize) :
|
||||
_sizePixels(pixelCount * elementSize),
|
||||
DotStarMethodBase(uint8_t pinClock, uint8_t pinData, uint16_t pixelCount, size_t elementSize, size_t settingsSize) :
|
||||
_sizeData(pixelCount * elementSize + settingsSize),
|
||||
_sizeEndFrame((pixelCount + 15) / 16), // 16 = div 2 (bit for every two pixels) div 8 (bits to bytes)
|
||||
_wire(pinClock, pinData)
|
||||
{
|
||||
_pixels = (uint8_t*)malloc(_sizePixels);
|
||||
memset(_pixels, 0, _sizePixels);
|
||||
_data = static_cast<uint8_t*>(malloc(_sizeData));
|
||||
memset(_data, 0, _sizeData);
|
||||
}
|
||||
|
||||
#if !defined(__AVR_ATtiny85__) && !defined(ARDUINO_attiny)
|
||||
DotStarMethodBase(uint16_t pixelCount, size_t elementSize) :
|
||||
DotStarMethodBase(SCK, MOSI, pixelCount, elementSize)
|
||||
DotStarMethodBase(uint16_t pixelCount, size_t elementSize, size_t settingsSize) :
|
||||
DotStarMethodBase(SCK, MOSI, pixelCount, elementSize, settingsSize)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
~DotStarMethodBase()
|
||||
{
|
||||
free(_pixels);
|
||||
free(_data);
|
||||
}
|
||||
|
||||
bool IsReadyToUpdate() const
|
||||
@ -85,7 +85,7 @@ public:
|
||||
_wire.transmitBytes(startFrame, sizeof(startFrame));
|
||||
|
||||
// data
|
||||
_wire.transmitBytes(_pixels, _sizePixels);
|
||||
_wire.transmitBytes(_data, _sizeData);
|
||||
|
||||
// end frame
|
||||
// one bit for every two pixels with no less than 1 byte
|
||||
@ -97,22 +97,22 @@ public:
|
||||
_wire.endTransaction();
|
||||
}
|
||||
|
||||
uint8_t* getPixels() const
|
||||
uint8_t* getData() const
|
||||
{
|
||||
return _pixels;
|
||||
return _data;
|
||||
};
|
||||
|
||||
size_t getPixelsSize() const
|
||||
size_t getDataSize() const
|
||||
{
|
||||
return _sizePixels;
|
||||
return _sizeData;
|
||||
};
|
||||
|
||||
private:
|
||||
const size_t _sizePixels; // Size of '_pixels' buffer below
|
||||
const size_t _sizeData; // Size of '_data' buffer below
|
||||
const size_t _sizeEndFrame;
|
||||
|
||||
T_TWOWIRE _wire;
|
||||
uint8_t* _pixels; // Holds LED color values
|
||||
uint8_t* _data; // Holds LED color values
|
||||
};
|
||||
|
||||
typedef DotStarMethodBase<TwoWireBitBangImple> DotStarMethod;
|
||||
|
@ -37,18 +37,18 @@ License along with NeoPixel. If not, see
|
||||
template<typename T_TWOWIRE> class Lpd8806MethodBase
|
||||
{
|
||||
public:
|
||||
Lpd8806MethodBase(uint8_t pinClock, uint8_t pinData, uint16_t pixelCount, size_t elementSize) :
|
||||
_sizePixels(pixelCount * elementSize),
|
||||
Lpd8806MethodBase(uint8_t pinClock, uint8_t pinData, uint16_t pixelCount, size_t elementSize, size_t settingsSize) :
|
||||
_sizeData(pixelCount * elementSize + settingsSize),
|
||||
_sizeFrame((pixelCount + 31) / 32),
|
||||
_wire(pinClock, pinData)
|
||||
{
|
||||
_pixels = (uint8_t*)malloc(_sizePixels);
|
||||
memset(_pixels, 0, _sizePixels);
|
||||
_data = static_cast<uint8_t*>(malloc(_sizeData));
|
||||
memset(_data, 0, _sizeData);
|
||||
}
|
||||
|
||||
#if !defined(__AVR_ATtiny85__) && !defined(ARDUINO_attiny)
|
||||
Lpd8806MethodBase(uint16_t pixelCount, size_t elementSize) :
|
||||
Lpd8806MethodBase(SCK, MOSI, pixelCount, elementSize)
|
||||
Lpd8806MethodBase(uint16_t pixelCount, size_t elementSize, size_t settingsSize) :
|
||||
Lpd8806MethodBase(SCK, MOSI, pixelCount, elementSize, settingsSize)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
@ -56,7 +56,7 @@ public:
|
||||
|
||||
~Lpd8806MethodBase()
|
||||
{
|
||||
free(_pixels);
|
||||
free(_data);
|
||||
}
|
||||
|
||||
bool IsReadyToUpdate() const
|
||||
@ -87,7 +87,7 @@ public:
|
||||
}
|
||||
|
||||
// data
|
||||
_wire.transmitBytes(_pixels, _sizePixels);
|
||||
_wire.transmitBytes(_data, _sizeData);
|
||||
|
||||
// end frame
|
||||
for (size_t frameByte = 0; frameByte < _sizeFrame; frameByte++)
|
||||
@ -98,22 +98,22 @@ public:
|
||||
_wire.endTransaction();
|
||||
}
|
||||
|
||||
uint8_t* getPixels() const
|
||||
uint8_t* getData() const
|
||||
{
|
||||
return _pixels;
|
||||
return _data;
|
||||
};
|
||||
|
||||
size_t getPixelsSize() const
|
||||
size_t getDataSize() const
|
||||
{
|
||||
return _sizePixels;
|
||||
return _sizeData;
|
||||
};
|
||||
|
||||
private:
|
||||
const size_t _sizePixels; // Size of '_pixels' buffer below
|
||||
const size_t _sizeData; // Size of '_data' buffer below
|
||||
const size_t _sizeFrame;
|
||||
|
||||
T_TWOWIRE _wire;
|
||||
uint8_t* _pixels; // Holds LED color values
|
||||
uint8_t* _data; // Holds LED color values
|
||||
};
|
||||
|
||||
typedef Lpd8806MethodBase<TwoWireBitBangImple> Lpd8806Method;
|
||||
|
@ -35,21 +35,21 @@ License along with NeoPixel. If not, see
|
||||
template<typename T_SPEED> class NeoArmMethodBase
|
||||
{
|
||||
public:
|
||||
NeoArmMethodBase(uint8_t pin, uint16_t pixelCount, size_t elementSize) :
|
||||
NeoArmMethodBase(uint8_t pin, uint16_t pixelCount, size_t elementSize, size_t settingsSize) :
|
||||
_sizeData(pixelCount * elementSize + settingsSize),
|
||||
_pin(pin)
|
||||
{
|
||||
pinMode(pin, OUTPUT);
|
||||
|
||||
_sizePixels = pixelCount * elementSize;
|
||||
_pixels = (uint8_t*)malloc(_sizePixels);
|
||||
memset(_pixels, 0, _sizePixels);
|
||||
_data = static_cast<uint8_t*>(malloc(_sizeData));
|
||||
memset(_data, 0, _sizeData);
|
||||
}
|
||||
|
||||
~NeoArmMethodBase()
|
||||
{
|
||||
pinMode(_pin, INPUT);
|
||||
|
||||
free(_pixels);
|
||||
free(_data);
|
||||
}
|
||||
|
||||
bool IsReadyToUpdate() const
|
||||
@ -81,7 +81,7 @@ public:
|
||||
|
||||
noInterrupts(); // Need 100% focus on instruction timing
|
||||
|
||||
T_SPEED::send_pixels(_pixels, _sizePixels, _pin);
|
||||
T_SPEED::send_pixels(_data, _sizeData, _pin);
|
||||
|
||||
interrupts();
|
||||
|
||||
@ -89,20 +89,21 @@ public:
|
||||
_endTime = micros();
|
||||
}
|
||||
|
||||
uint8_t* getPixels() const
|
||||
uint8_t* getData() const
|
||||
{
|
||||
return _pixels;
|
||||
return _data;
|
||||
};
|
||||
|
||||
size_t getPixelsSize() const
|
||||
size_t getDataSize() const
|
||||
{
|
||||
return _sizePixels;
|
||||
return _sizeData;
|
||||
};
|
||||
|
||||
private:
|
||||
const size_t _sizeData; // Size of '_data' buffer below
|
||||
|
||||
uint32_t _endTime; // Latch timing reference
|
||||
size_t _sizePixels; // Size of '_pixels' buffer below
|
||||
uint8_t* _pixels; // Holds LED color values
|
||||
uint8_t* _data; // Holds LED color values
|
||||
uint8_t _pin; // output pin number
|
||||
};
|
||||
|
||||
@ -129,6 +130,12 @@ public:
|
||||
static const uint32_t ResetTimeUs = 80;
|
||||
};
|
||||
|
||||
class NeoArmMk20dxSpeedPropsTm1814 : public NeoArmMk20dxSpeedProps800KbpsBase
|
||||
{
|
||||
public:
|
||||
static const uint32_t ResetTimeUs = 200;
|
||||
};
|
||||
|
||||
class NeoArmMk20dxSpeedProps800Kbps : public NeoArmMk20dxSpeedProps800KbpsBase
|
||||
{
|
||||
public:
|
||||
@ -199,6 +206,7 @@ public:
|
||||
|
||||
typedef NeoArmMethodBase<NeoArmMk20dxSpeedBase<NeoArmMk20dxSpeedPropsWs2812x>> NeoArmWs2812xMethod;
|
||||
typedef NeoArmMethodBase<NeoArmMk20dxSpeedBase<NeoArmMk20dxSpeedPropsSk6812>> NeoArmSk6812Method;
|
||||
typedef NeoArmMethodBase<NeoArmMk20dxSpeedBase<NeoArmMk20dxSpeedPropsTm1814>> NeoArmTm1814InvertedMethod;
|
||||
typedef NeoArmMethodBase<NeoArmMk20dxSpeedBase<NeoArmMk20dxSpeedPropsApa106>> NeoArmApa106Method;
|
||||
typedef NeoArmMethodBase<NeoArmMk20dxSpeedBase<NeoArmMk20dxSpeedProps800Kbps>> NeoArm800KbpsMethod;
|
||||
typedef NeoArmMethodBase<NeoArmMk20dxSpeedBase<NeoArmMk20dxSpeedProps400Kbps>> NeoArm400KbpsMethod;
|
||||
@ -310,6 +318,12 @@ public:
|
||||
const static uint32_t ResetTimeUs = 80;
|
||||
};
|
||||
|
||||
class NeoArmMk26z64SpeedTm1814 : public NeoArmMk26z64Speed800KbpsBase
|
||||
{
|
||||
public:
|
||||
const static uint32_t ResetTimeUs = 200;
|
||||
};
|
||||
|
||||
class NeoArmMk26z64Speed800Kbps : public NeoArmMk26z64Speed800KbpsBase
|
||||
{
|
||||
public:
|
||||
@ -318,6 +332,7 @@ public:
|
||||
|
||||
typedef NeoArmMethodBase<NeoArmMk26z64SpeedWs2812x> NeoArmWs2812xMethod;
|
||||
typedef NeoArmMethodBase<NeoArmMk26z64SpeedSk6812> NeoArmSk6812Method;
|
||||
typedef NeoArmMethodBase<NeoArmMk26z64SpeedTm1814> NeoArmTm1814InvertedMethod;
|
||||
typedef NeoArmMethodBase<NeoArmMk26z64Speed800Kbps> NeoArm800KbpsMethod;
|
||||
typedef NeoArm800KbpsMethod NeoArmApa106Method
|
||||
|
||||
@ -365,6 +380,12 @@ public:
|
||||
static const uint32_t ResetTimeUs = 80;
|
||||
};
|
||||
|
||||
class NeoArmSamd21g18aSpeedPropsTm1814 : public NeoArmSamd21g18aSpeedProps800KbpsBase
|
||||
{
|
||||
public:
|
||||
static const uint32_t ResetTimeUs = 200;
|
||||
};
|
||||
|
||||
class NeoArmSamd21g18aSpeedProps800Kbps : public NeoArmSamd21g18aSpeedProps800KbpsBase
|
||||
{
|
||||
public:
|
||||
@ -453,6 +474,7 @@ public:
|
||||
|
||||
typedef NeoArmMethodBase<NeoArmSamd21g18aSpeedBase<NeoArmSamd21g18aSpeedPropsWs2812x>> NeoArmWs2812xMethod;
|
||||
typedef NeoArmMethodBase<NeoArmSamd21g18aSpeedBase<NeoArmSamd21g18aSpeedPropsSk6812>> NeoArmSk6812Method;
|
||||
typedef NeoArmMethodBase<NeoArmSamd21g18aSpeedBase<NeoArmSamd21g18aSpeedPropsTm1814>> NeoArmTm1814InvertedMethod;
|
||||
typedef NeoArmMethodBase<NeoArmSamd21g18aSpeedBase<NeoArmSamd21g18aSpeedProps800Kbps>> NeoArm800KbpsMethod;
|
||||
typedef NeoArmMethodBase<NeoArmSamd21g18aSpeedBase<NeoArmSamd21g18aSpeedProps400Kbps>> NeoArm400KbpsMethod;
|
||||
typedef NeoArm400KbpsMethod NeoArmApa106Method;
|
||||
@ -523,6 +545,12 @@ public:
|
||||
static const uint32_t ResetTimeUs = 80;
|
||||
};
|
||||
|
||||
class NeoArmStm32SpeedPropsTm1814 : public NeoArmStm32SpeedProps800KbpsBase
|
||||
{
|
||||
public:
|
||||
static const uint32_t ResetTimeUs = 200;
|
||||
};
|
||||
|
||||
class NeoArmStm32SpeedProps800Kbps : public NeoArmStm32SpeedProps800KbpsBase
|
||||
{
|
||||
public:
|
||||
@ -634,6 +662,7 @@ public:
|
||||
|
||||
typedef NeoArmMethodBase<NeoArmStm32SpeedBase<NeoArmStm32SpeedPropsWs2812x>> NeoArmWs2812xMethod;
|
||||
typedef NeoArmMethodBase<NeoArmStm32SpeedBase<NeoArmStm32SpeedPropsSk6812>> NeoArmSk6812Method;
|
||||
typedef NeoArmMethodBase<NeoArmStm32SpeedBase<NeoArmStm32SpeedPropstm1814>> NeoArmTm1814InvertedMethod;
|
||||
typedef NeoArmMethodBase<NeoArmStm32SpeedBase<NeoArmStm32SpeedProps800Kbps>> NeoArm800KbpsMethod;
|
||||
typedef NeoArm800KbpsMethod NeoArmApa106Method;
|
||||
|
||||
@ -663,6 +692,12 @@ public:
|
||||
static const uint32_t ResetTimeUs = 80;
|
||||
};
|
||||
|
||||
class NeoArmOtherSpeedPropsTm1814 : public NeoArmOtherSpeedProps800KbpsBase
|
||||
{
|
||||
public:
|
||||
static const uint32_t ResetTimeUs = 200;
|
||||
};
|
||||
|
||||
class NeoArmOtherSpeedProps800Kbps : public NeoArmOtherSpeedProps800KbpsBase
|
||||
{
|
||||
public:
|
||||
@ -756,6 +791,7 @@ public:
|
||||
|
||||
typedef NeoArmMethodBase<NeoArmOtherSpeedBase<NeoArmOtherSpeedPropsWs2812x>> NeoArmWs2812xMethod;
|
||||
typedef NeoArmMethodBase<NeoArmOtherSpeedBase<NeoArmOtherSpeedPropsSk6812>> NeoArmSk6812Method;
|
||||
typedef NeoArmMethodBase<NeoArmOtherSpeedBase<NeoArmOtherSpeedPropsTm1814>> NeoArmTm1814InvertedMethod;
|
||||
typedef NeoArmMethodBase<NeoArmOtherSpeedBase<NeoArmOtherSpeedProps800Kbps>> NeoArm800KbpsMethod;
|
||||
typedef NeoArmMethodBase<NeoArmOtherSpeedBase<NeoArmOtherSpeedProps400Kbps>> NeoArm400KbpsMethod;
|
||||
typedef NeoArm400KbpsMethod NeoArmApa106Method;
|
||||
@ -775,6 +811,8 @@ typedef NeoArmWs2812xMethod Neo800KbpsMethod;
|
||||
#ifdef NeoArm400KbpsMethod // this is needed due to missing 400Kbps for some platforms
|
||||
typedef NeoArm400KbpsMethod Neo400KbpsMethod;
|
||||
#endif
|
||||
// there is no invert methods for arm, but the norm for TM1814 is inverted, so
|
||||
typedef NeoArmTm1814InvertedMethod NeoTm1814InvertedMethod;
|
||||
|
||||
#endif // defined(__arm__)
|
||||
|
||||
|
@ -83,6 +83,12 @@ public:
|
||||
static const uint32_t ResetTimeUs = 80;
|
||||
};
|
||||
|
||||
class NeoAvrSpeedTm1814 : public NeoAvrSpeed800KbpsBase
|
||||
{
|
||||
public:
|
||||
static const uint32_t ResetTimeUs = 200;
|
||||
};
|
||||
|
||||
class NeoAvrSpeed800Kbps: public NeoAvrSpeed800KbpsBase
|
||||
{
|
||||
public:
|
||||
@ -120,7 +126,7 @@ public:
|
||||
{
|
||||
pinMode(pin, OUTPUT);
|
||||
|
||||
_data = (uint8_t*)malloc(_sizeData);
|
||||
_data = static_cast<uint8_t*>(malloc(_sizeData));
|
||||
memset(_data, 0, _sizeData);
|
||||
|
||||
_port = portOutputRegister(digitalPinToPort(pin));
|
||||
@ -197,6 +203,7 @@ private:
|
||||
|
||||
typedef NeoAvrMethodBase<NeoAvrSpeedWs2812x> NeoAvrWs2812xMethod;
|
||||
typedef NeoAvrMethodBase<NeoAvrSpeedSk6812> NeoAvrSk6812Method;
|
||||
typedef NeoAvrMethodBase<NeoAvrSpeedTm1814> NeoAvrTm1814InvertedMethod;
|
||||
typedef NeoAvrMethodBase<NeoAvrSpeed800Kbps> NeoAvr800KbpsMethod;
|
||||
typedef NeoAvrMethodBase<NeoAvrSpeed400Kbps> NeoAvr400KbpsMethod;
|
||||
|
||||
@ -212,5 +219,6 @@ typedef NeoAvr400KbpsMethod NeoApa106Method;
|
||||
typedef NeoAvrWs2812xMethod Neo800KbpsMethod;
|
||||
typedef NeoAvr400KbpsMethod Neo400KbpsMethod;
|
||||
|
||||
typedef NeoAvrTm1814InvertedMethod NeoTm1814InvertedMethod;
|
||||
#endif
|
||||
|
||||
|
@ -52,6 +52,14 @@ public:
|
||||
const static uint16_t ResetTimeUs = 80;
|
||||
};
|
||||
|
||||
class NeoEsp32I2sSpeedTm1814
|
||||
{
|
||||
public:
|
||||
const static uint32_t I2sSampleRate = 100000;
|
||||
const static uint16_t ByteSendTimeUs = 10;
|
||||
const static uint16_t ResetTimeUs = 200;
|
||||
};
|
||||
|
||||
class NeoEsp32I2sSpeed800Kbps
|
||||
{
|
||||
public:
|
||||
@ -103,14 +111,15 @@ public:
|
||||
template<typename T_SPEED, typename T_BUS, typename T_INVERT> class NeoEsp32I2sMethodBase
|
||||
{
|
||||
public:
|
||||
NeoEsp32I2sMethodBase(uint8_t pin, uint16_t pixelCount, size_t elementSize) :
|
||||
NeoEsp32I2sMethodBase(uint8_t pin, uint16_t pixelCount, size_t elementSize, size_t settingsSize) :
|
||||
_sizeData(pixelCount * elementSize + settingsSize),
|
||||
_pin(pin)
|
||||
{
|
||||
uint16_t dmaSettingsSize = c_dmaBytesPerPixelBytes * settingsSize;
|
||||
uint16_t dmaPixelSize = c_dmaBytesPerPixelBytes * elementSize;
|
||||
uint16_t resetSize = c_dmaBytesPerPixelBytes * T_SPEED::ResetTimeUs / T_SPEED::ByteSendTimeUs;
|
||||
|
||||
_pixelsSize = pixelCount * elementSize;
|
||||
_i2sBufferSize = pixelCount * dmaPixelSize + resetSize;
|
||||
_i2sBufferSize = pixelCount * dmaPixelSize + dmaSettingsSize + resetSize;
|
||||
|
||||
// must have a 4 byte aligned buffer for i2s
|
||||
uint32_t alignment = _i2sBufferSize % 4;
|
||||
@ -119,8 +128,8 @@ public:
|
||||
_i2sBufferSize += 4 - alignment;
|
||||
}
|
||||
|
||||
_pixels = static_cast<uint8_t*>(malloc(_pixelsSize));
|
||||
memset(_pixels, 0x00, _pixelsSize);
|
||||
_data = static_cast<uint8_t*>(malloc(_sizeData));
|
||||
memset(_data, 0x00, _sizeData);
|
||||
|
||||
_i2sBuffer = static_cast<uint8_t*>(malloc(_i2sBufferSize));
|
||||
memset(_i2sBuffer, 0x00, _i2sBufferSize);
|
||||
@ -135,7 +144,7 @@ public:
|
||||
|
||||
pinMode(_pin, INPUT);
|
||||
|
||||
free(_pixels);
|
||||
free(_data);
|
||||
free(_i2sBuffer);
|
||||
}
|
||||
|
||||
@ -164,21 +173,21 @@ public:
|
||||
i2sWrite(T_BUS::I2sBusNumber, _i2sBuffer, _i2sBufferSize, false, false);
|
||||
}
|
||||
|
||||
uint8_t* getPixels() const
|
||||
uint8_t* getData() const
|
||||
{
|
||||
return _pixels;
|
||||
return _data;
|
||||
};
|
||||
|
||||
size_t getPixelsSize() const
|
||||
size_t getDataSize() const
|
||||
{
|
||||
return _pixelsSize;
|
||||
return _sizeData;
|
||||
}
|
||||
|
||||
private:
|
||||
const size_t _sizeData; // Size of '_data' buffer
|
||||
const uint8_t _pin; // output pin number
|
||||
|
||||
size_t _pixelsSize; // Size of '_pixels' buffer
|
||||
uint8_t* _pixels; // Holds LED color values
|
||||
|
||||
uint8_t* _data; // Holds LED color values
|
||||
|
||||
uint32_t _i2sBufferSize; // total size of _i2sBuffer
|
||||
uint8_t* _i2sBuffer; // holds the DMA buffer that is referenced by _i2sBufDesc
|
||||
@ -194,8 +203,8 @@ private:
|
||||
};
|
||||
|
||||
uint16_t* pDma = reinterpret_cast<uint16_t*>(_i2sBuffer);
|
||||
uint8_t* pPixelsEnd = _pixels + _pixelsSize;
|
||||
for (uint8_t* pPixel = _pixels; pPixel < pPixelsEnd; pPixel++)
|
||||
uint8_t* pEnd = _data + _sizeData;
|
||||
for (uint8_t* pPixel = _data; pPixel < pEnd; pPixel++)
|
||||
{
|
||||
*(pDma++) = bitpatterns[((*pPixel) & 0x0f)];
|
||||
*(pDma++) = bitpatterns[((*pPixel) >> 4) & 0x0f];
|
||||
@ -205,24 +214,28 @@ private:
|
||||
|
||||
typedef NeoEsp32I2sMethodBase<NeoEsp32I2sSpeedWs2812x, NeoEsp32I2sBusZero, NeoEsp32I2sNotInverted> NeoEsp32I2s0Ws2812xMethod;
|
||||
typedef NeoEsp32I2sMethodBase<NeoEsp32I2sSpeedSk6812, NeoEsp32I2sBusZero, NeoEsp32I2sNotInverted> NeoEsp32I2s0Sk6812Method;
|
||||
typedef NeoEsp32I2sMethodBase<NeoEsp32I2sSpeedTm1814, NeoEsp32I2sBusZero, NeoEsp32I2sInverted> NeoEsp32I2s0Tm1814Method;
|
||||
typedef NeoEsp32I2sMethodBase<NeoEsp32I2sSpeed800Kbps, NeoEsp32I2sBusZero, NeoEsp32I2sNotInverted> NeoEsp32I2s0800KbpsMethod;
|
||||
typedef NeoEsp32I2sMethodBase<NeoEsp32I2sSpeed400Kbps, NeoEsp32I2sBusZero, NeoEsp32I2sNotInverted> NeoEsp32I2s0400KbpsMethod;
|
||||
typedef NeoEsp32I2sMethodBase<NeoEsp32I2sSpeedApa106, NeoEsp32I2sBusZero, NeoEsp32I2sNotInverted> NeoEsp32I2s0Apa106Method;
|
||||
|
||||
typedef NeoEsp32I2sMethodBase<NeoEsp32I2sSpeedWs2812x, NeoEsp32I2sBusOne, NeoEsp32I2sNotInverted> NeoEsp32I2s1Ws2812xMethod;
|
||||
typedef NeoEsp32I2sMethodBase<NeoEsp32I2sSpeedSk6812, NeoEsp32I2sBusOne, NeoEsp32I2sNotInverted> NeoEsp32I2s1Sk6812Method;
|
||||
typedef NeoEsp32I2sMethodBase<NeoEsp32I2sSpeedTm1814, NeoEsp32I2sBusOne, NeoEsp32I2sInverted> NeoEsp32I2s1Tm1814Method;
|
||||
typedef NeoEsp32I2sMethodBase<NeoEsp32I2sSpeed800Kbps, NeoEsp32I2sBusOne, NeoEsp32I2sNotInverted> NeoEsp32I2s1800KbpsMethod;
|
||||
typedef NeoEsp32I2sMethodBase<NeoEsp32I2sSpeed400Kbps, NeoEsp32I2sBusOne, NeoEsp32I2sNotInverted> NeoEsp32I2s1400KbpsMethod;
|
||||
typedef NeoEsp32I2sMethodBase<NeoEsp32I2sSpeedApa106, NeoEsp32I2sBusOne, NeoEsp32I2sNotInverted> NeoEsp32I2s1Apa106Method;
|
||||
|
||||
typedef NeoEsp32I2sMethodBase<NeoEsp32I2sSpeedWs2812x, NeoEsp32I2sBusZero, NeoEsp32I2sInverted> NeoEsp32I2s0Ws2812xInvertedMethod;
|
||||
typedef NeoEsp32I2sMethodBase<NeoEsp32I2sSpeedSk6812, NeoEsp32I2sBusZero, NeoEsp32I2sInverted> NeoEsp32I2s0Sk6812InvertedMethod;
|
||||
typedef NeoEsp32I2sMethodBase<NeoEsp32I2sSpeedTm1814, NeoEsp32I2sBusZero, NeoEsp32I2sNotInverted> NeoEsp32I2s0Tm1814InvertedMethod;
|
||||
typedef NeoEsp32I2sMethodBase<NeoEsp32I2sSpeed800Kbps, NeoEsp32I2sBusZero, NeoEsp32I2sInverted> NeoEsp32I2s0800KbpsInvertedMethod;
|
||||
typedef NeoEsp32I2sMethodBase<NeoEsp32I2sSpeed400Kbps, NeoEsp32I2sBusZero, NeoEsp32I2sInverted> NeoEsp32I2s0400KbpsInvertedMethod;
|
||||
typedef NeoEsp32I2sMethodBase<NeoEsp32I2sSpeedApa106, NeoEsp32I2sBusZero, NeoEsp32I2sInverted> NeoEsp32I2s0Apa106InvertedMethod;
|
||||
|
||||
typedef NeoEsp32I2sMethodBase<NeoEsp32I2sSpeedWs2812x, NeoEsp32I2sBusOne, NeoEsp32I2sInverted> NeoEsp32I2s1Ws2812xInvertedMethod;
|
||||
typedef NeoEsp32I2sMethodBase<NeoEsp32I2sSpeedSk6812, NeoEsp32I2sBusOne, NeoEsp32I2sInverted> NeoEsp32I2s1Sk6812InvertedMethod;
|
||||
typedef NeoEsp32I2sMethodBase<NeoEsp32I2sSpeedTm1814, NeoEsp32I2sBusOne, NeoEsp32I2sNotInverted> NeoEsp32I2s1Tm1814InvertedMethod;
|
||||
typedef NeoEsp32I2sMethodBase<NeoEsp32I2sSpeed800Kbps, NeoEsp32I2sBusOne, NeoEsp32I2sInverted> NeoEsp32I2s1800KbpsInvertedMethod;
|
||||
typedef NeoEsp32I2sMethodBase<NeoEsp32I2sSpeed400Kbps, NeoEsp32I2sBusOne, NeoEsp32I2sInverted> NeoEsp32I2s1400KbpsInvertedMethod;
|
||||
typedef NeoEsp32I2sMethodBase<NeoEsp32I2sSpeedApa106, NeoEsp32I2sBusOne, NeoEsp32I2sInverted> NeoEsp32I2s1Apa106InvertedMethod;
|
||||
@ -234,6 +247,7 @@ typedef NeoEsp32I2s1Ws2812xMethod NeoWs2812xMethod;
|
||||
typedef NeoEsp32I2s1800KbpsMethod NeoWs2812Method;
|
||||
typedef NeoEsp32I2s1Ws2812xMethod NeoWs2811Method;
|
||||
typedef NeoEsp32I2s1Sk6812Method NeoSk6812Method;
|
||||
typedef NeoEsp32I2s1Tm1814Method NeoTm1814Method;
|
||||
typedef NeoEsp32I2s1Sk6812Method NeoLc8812Method;
|
||||
typedef NeoEsp32I2s1Apa106Method NeoApa106Method;
|
||||
|
||||
@ -245,6 +259,7 @@ typedef NeoEsp32I2s1Ws2812xInvertedMethod NeoWs2812xInvertedMethod;
|
||||
typedef NeoEsp32I2s1Ws2812xInvertedMethod NeoWs2811InvertedMethod;
|
||||
typedef NeoEsp32I2s1800KbpsInvertedMethod NeoWs2812InvertedMethod;
|
||||
typedef NeoEsp32I2s1Sk6812InvertedMethod NeoSk6812InvertedMethod;
|
||||
typedef NeoEsp32I2s1Tm1814InvertedMethod NeoTm1814InvertedMethod;
|
||||
typedef NeoEsp32I2s1Sk6812InvertedMethod NeoLc8812InvertedMethod;
|
||||
typedef NeoEsp32I2s1Apa106InvertedMethod NeoApa106InvertedMethod;
|
||||
|
||||
|
@ -121,6 +121,12 @@ public:
|
||||
const static uint32_t ResetTimeUs = 80;
|
||||
};
|
||||
|
||||
class NeoEsp8266DmaInvertedSpeedTm1814 : public NeoEsp8266DmaSpeed800KbpsBase
|
||||
{
|
||||
public:
|
||||
const static uint32_t ResetTimeUs = 200;
|
||||
};
|
||||
|
||||
class NeoEsp8266DmaSpeed800Kbps : public NeoEsp8266DmaSpeed800KbpsBase
|
||||
{
|
||||
public:
|
||||
@ -167,6 +173,12 @@ public:
|
||||
const static uint32_t ResetTimeUs = 80;
|
||||
};
|
||||
|
||||
class NeoEsp8266DmaSpeedTm1814 : public NeoEsp8266DmaInvertedSpeed800KbpsBase
|
||||
{
|
||||
public:
|
||||
const static uint32_t ResetTimeUs = 200;
|
||||
};
|
||||
|
||||
class NeoEsp8266DmaInvertedSpeed800Kbps : public NeoEsp8266DmaInvertedSpeed800KbpsBase
|
||||
{
|
||||
public:
|
||||
@ -205,17 +217,18 @@ const uint8_t c_I2sPin = 3; // due to I2S hardware, the pin used is restricted t
|
||||
template<typename T_SPEED> class NeoEsp8266DmaMethodBase
|
||||
{
|
||||
public:
|
||||
NeoEsp8266DmaMethodBase(uint16_t pixelCount, size_t elementSize)
|
||||
NeoEsp8266DmaMethodBase(uint16_t pixelCount, size_t elementSize, size_t settingsSize) :
|
||||
_sizeData(pixelCount * elementSize + settingsSize)
|
||||
{
|
||||
uint16_t dmaPixelSize = c_dmaBytesPerPixelBytes * elementSize;
|
||||
uint16_t dmaSettingsSize = c_dmaBytesPerPixelBytes * settingsSize;
|
||||
|
||||
_pixelsSize = pixelCount * elementSize;
|
||||
_i2sBufferSize = pixelCount * dmaPixelSize;
|
||||
_i2sBufferSize = pixelCount * dmaPixelSize + dmaSettingsSize;
|
||||
|
||||
_pixels = (uint8_t*)malloc(_pixelsSize);
|
||||
memset(_pixels, 0x00, _pixelsSize);
|
||||
_data = static_cast<uint8_t*>(malloc(_sizeData));
|
||||
memset(_data, 0x00, _sizeData);
|
||||
|
||||
_i2sBuffer = (uint8_t*)malloc(_i2sBufferSize);
|
||||
_i2sBuffer = static_cast<uint8_t*>(malloc(_i2sBufferSize));
|
||||
memset(_i2sBuffer, T_SPEED::Level, _i2sBufferSize);
|
||||
|
||||
// _i2sBuffer[0] = 0b11101000; // debug, 1 bit then 0 bit
|
||||
@ -230,7 +243,8 @@ public:
|
||||
s_this = this; // store this for the ISR
|
||||
}
|
||||
|
||||
NeoEsp8266DmaMethodBase(uint8_t pin, uint16_t pixelCount, size_t elementSize) : NeoEsp8266DmaMethodBase(pixelCount, elementSize)
|
||||
NeoEsp8266DmaMethodBase(uint8_t pin, uint16_t pixelCount, size_t elementSize, size_t settingsSize) :
|
||||
NeoEsp8266DmaMethodBase(pixelCount, elementSize, settingsSize)
|
||||
{
|
||||
}
|
||||
|
||||
@ -256,7 +270,7 @@ public:
|
||||
s_this = nullptr;
|
||||
pinMode(c_I2sPin, INPUT);
|
||||
|
||||
free(_pixels);
|
||||
free(_data);
|
||||
free(_i2sBuffer);
|
||||
free(_i2sBufDesc);
|
||||
}
|
||||
@ -389,23 +403,23 @@ public:
|
||||
_dmaState = NeoDmaState_Pending;
|
||||
}
|
||||
|
||||
uint8_t* getPixels() const
|
||||
uint8_t* getData() const
|
||||
{
|
||||
return _pixels;
|
||||
return _data;
|
||||
};
|
||||
|
||||
size_t getPixelsSize() const
|
||||
size_t getDataSize() const
|
||||
{
|
||||
return _pixelsSize;
|
||||
return _sizeData;
|
||||
}
|
||||
|
||||
private:
|
||||
static NeoEsp8266DmaMethodBase* s_this; // for the ISR
|
||||
|
||||
size_t _pixelsSize; // Size of '_pixels' buffer
|
||||
uint8_t* _pixels; // Holds LED color values
|
||||
const size_t _sizeData; // Size of '_data' buffer
|
||||
uint8_t* _data; // Holds LED color values
|
||||
|
||||
uint32_t _i2sBufferSize; // total size of _i2sBuffer
|
||||
size_t _i2sBufferSize; // total size of _i2sBuffer
|
||||
uint8_t* _i2sBuffer; // holds the DMA buffer that is referenced by _i2sBufDesc
|
||||
|
||||
// normally 24 bytes creates the minimum 50us latch per spec, but
|
||||
@ -475,11 +489,11 @@ private:
|
||||
void FillBuffers()
|
||||
{
|
||||
uint16_t* pDma = (uint16_t*)_i2sBuffer;
|
||||
uint8_t* pPixelsEnd = _pixels + _pixelsSize;
|
||||
for (uint8_t* pPixel = _pixels; pPixel < pPixelsEnd; pPixel++)
|
||||
uint8_t* pEnd = _data + _sizeData;
|
||||
for (uint8_t* pData = _data; pData < pEnd; pData++)
|
||||
{
|
||||
*(pDma++) = T_SPEED::Convert(((*pPixel) & 0x0f));
|
||||
*(pDma++) = T_SPEED::Convert(((*pPixel) >> 4) & 0x0f);
|
||||
*(pDma++) = T_SPEED::Convert(((*pData) & 0x0f));
|
||||
*(pDma++) = T_SPEED::Convert(((*pData) >> 4) & 0x0f);
|
||||
}
|
||||
}
|
||||
|
||||
@ -506,7 +520,7 @@ private:
|
||||
|
||||
uint32_t getPixelTime() const
|
||||
{
|
||||
return (T_SPEED::ByteSendTimeUs * this->_pixelsSize);
|
||||
return (T_SPEED::ByteSendTimeUs * this->_sizeData);
|
||||
};
|
||||
|
||||
};
|
||||
@ -518,6 +532,7 @@ NeoEsp8266DmaMethodBase<T_SPEED>* NeoEsp8266DmaMethodBase<T_SPEED>::s_this;
|
||||
// normal
|
||||
typedef NeoEsp8266DmaMethodBase<NeoEsp8266DmaSpeedWs2812x> NeoEsp8266DmaWs2812xMethod;
|
||||
typedef NeoEsp8266DmaMethodBase<NeoEsp8266DmaSpeedSk6812> NeoEsp8266DmaSk6812Method;
|
||||
typedef NeoEsp8266DmaMethodBase<NeoEsp8266DmaSpeedTm1814> NeoEsp8266DmaTm1814Method;
|
||||
typedef NeoEsp8266DmaMethodBase<NeoEsp8266DmaSpeed800Kbps> NeoEsp8266Dma800KbpsMethod;
|
||||
typedef NeoEsp8266DmaMethodBase<NeoEsp8266DmaSpeed400Kbps> NeoEsp8266Dma400KbpsMethod;
|
||||
typedef NeoEsp8266DmaMethodBase<NeoEsp8266DmaSpeedApa106> NeoEsp8266DmaApa106Method;
|
||||
@ -525,6 +540,7 @@ typedef NeoEsp8266DmaMethodBase<NeoEsp8266DmaSpeedApa106> NeoEsp8266DmaApa106Met
|
||||
// inverted
|
||||
typedef NeoEsp8266DmaMethodBase<NeoEsp8266DmaInvertedSpeedWs2812x> NeoEsp8266DmaInvertedWs2812xMethod;
|
||||
typedef NeoEsp8266DmaMethodBase<NeoEsp8266DmaInvertedSpeedSk6812> NeoEsp8266DmaInvertedSk6812Method;
|
||||
typedef NeoEsp8266DmaMethodBase<NeoEsp8266DmaInvertedSpeedTm1814> NeoEsp8266DmaInvertedTm1814Method;
|
||||
typedef NeoEsp8266DmaMethodBase<NeoEsp8266DmaInvertedSpeed800Kbps> NeoEsp8266DmaInverted800KbpsMethod;
|
||||
typedef NeoEsp8266DmaMethodBase<NeoEsp8266DmaInvertedSpeed400Kbps> NeoEsp8266DmaInverted400KbpsMethod;
|
||||
typedef NeoEsp8266DmaMethodBase<NeoEsp8266DmaInvertedSpeedApa106> NeoEsp8266DmaInvertedApa106Method;
|
||||
@ -535,6 +551,7 @@ typedef NeoEsp8266DmaWs2812xMethod NeoWs2812xMethod;
|
||||
typedef NeoEsp8266Dma800KbpsMethod NeoWs2812Method;
|
||||
typedef NeoEsp8266DmaWs2812xMethod NeoWs2811Method;
|
||||
typedef NeoEsp8266DmaSk6812Method NeoSk6812Method;
|
||||
typedef NeoEsp8266DmaTm1814Method NeoTm1814Method;
|
||||
typedef NeoEsp8266DmaSk6812Method NeoLc8812Method;
|
||||
typedef NeoEsp8266DmaApa106Method NeoApa106Method;
|
||||
|
||||
@ -547,6 +564,7 @@ typedef NeoEsp8266DmaInvertedWs2812xMethod NeoWs2812xInvertedMethod;
|
||||
typedef NeoEsp8266DmaInverted800KbpsMethod NeoWs2812InvertedMethod;
|
||||
typedef NeoEsp8266DmaInvertedWs2812xMethod NeoWs2811InvertedMethod;
|
||||
typedef NeoEsp8266DmaInvertedSk6812Method NeoSk6812InvertedMethod;
|
||||
typedef NeoEsp8266DmaInvertedTm1814Method NeoTm1814InvertedMethod;
|
||||
typedef NeoEsp8266DmaInvertedSk6812Method NeoLc8812InvertedMethod;
|
||||
typedef NeoEsp8266DmaInvertedApa106Method NeoApa106InvertedMethod;
|
||||
|
||||
|
@ -33,7 +33,7 @@ extern "C"
|
||||
}
|
||||
|
||||
const volatile uint8_t* ICACHE_RAM_ATTR NeoEsp8266UartContext::FillUartFifo(uint8_t uartNum,
|
||||
const volatile uint8_t* pixels,
|
||||
const volatile uint8_t* start,
|
||||
const volatile uint8_t* end)
|
||||
{
|
||||
// Remember: UARTs send less significant bit (LSB) first so
|
||||
@ -47,19 +47,19 @@ const volatile uint8_t* ICACHE_RAM_ATTR NeoEsp8266UartContext::FillUartFifo(uint
|
||||
0b000100, // On wire: 1 110 111 0 [NeoPixel reads 11]
|
||||
};
|
||||
uint8_t avail = (UART_TX_FIFO_SIZE - GetTxFifoLength(uartNum)) / 4;
|
||||
if (end - pixels > avail)
|
||||
if (end - start > avail)
|
||||
{
|
||||
end = pixels + avail;
|
||||
end = start + avail;
|
||||
}
|
||||
while (pixels < end)
|
||||
while (start < end)
|
||||
{
|
||||
uint8_t subpix = *pixels++;
|
||||
uint8_t subpix = *start++;
|
||||
Enqueue(uartNum, _uartData[(subpix >> 6) & 0x3]);
|
||||
Enqueue(uartNum, _uartData[(subpix >> 4) & 0x3]);
|
||||
Enqueue(uartNum, _uartData[(subpix >> 2) & 0x3]);
|
||||
Enqueue(uartNum, _uartData[subpix & 0x3]);
|
||||
}
|
||||
return pixels;
|
||||
return start;
|
||||
}
|
||||
|
||||
volatile NeoEsp8266UartInterruptContext* NeoEsp8266UartInterruptContext::s_uartInteruptContext[] = { nullptr, nullptr };
|
||||
|
@ -48,7 +48,7 @@ public:
|
||||
}
|
||||
|
||||
static const volatile uint8_t* ICACHE_RAM_ATTR FillUartFifo(uint8_t uartNum,
|
||||
const volatile uint8_t* pixels,
|
||||
const volatile uint8_t* start,
|
||||
const volatile uint8_t* end);
|
||||
};
|
||||
|
||||
@ -142,20 +142,20 @@ public:
|
||||
class NeoEsp8266UartBase
|
||||
{
|
||||
protected:
|
||||
size_t _sizePixels; // Size of '_pixels' buffer below
|
||||
uint8_t* _pixels; // Holds LED color values
|
||||
const size_t _sizeData; // Size of '_data' buffer below
|
||||
uint8_t* _data; // Holds LED color values
|
||||
uint32_t _startTime; // Microsecond count when last update started
|
||||
|
||||
NeoEsp8266UartBase(uint16_t pixelCount, size_t elementSize)
|
||||
NeoEsp8266UartBase(uint16_t pixelCount, size_t elementSize, size_t settingsSize) :
|
||||
_sizeData(pixelCount * elementSize + settingsSize)
|
||||
{
|
||||
_sizePixels = pixelCount * elementSize;
|
||||
_pixels = (uint8_t*)malloc(_sizePixels);
|
||||
memset(_pixels, 0x00, _sizePixels);
|
||||
_data = static_cast<uint8_t*>(malloc(_sizeData));
|
||||
memset(_data, 0x00, _sizeData);
|
||||
}
|
||||
|
||||
~NeoEsp8266UartBase()
|
||||
{
|
||||
free(_pixels);
|
||||
free(_data);
|
||||
}
|
||||
|
||||
};
|
||||
@ -168,9 +168,8 @@ protected:
|
||||
template<typename T_UARTFEATURE, typename T_UARTCONTEXT> class NeoEsp8266Uart : public NeoEsp8266UartBase
|
||||
{
|
||||
protected:
|
||||
|
||||
NeoEsp8266Uart(uint16_t pixelCount, size_t elementSize) :
|
||||
NeoEsp8266UartBase(pixelCount, elementSize)
|
||||
NeoEsp8266Uart(uint16_t pixelCount, size_t elementSize, size_t settingsSize) :
|
||||
NeoEsp8266UartBase(pixelCount, elementSize, settingsSize)
|
||||
{
|
||||
}
|
||||
|
||||
@ -198,8 +197,8 @@ protected:
|
||||
_startTime = micros();
|
||||
|
||||
// Then keep filling the FIFO until done
|
||||
const uint8_t* ptr = _pixels;
|
||||
const uint8_t* end = ptr + _sizePixels;
|
||||
const uint8_t* ptr = _data;
|
||||
const uint8_t* end = ptr + _sizeData;
|
||||
while (ptr != end)
|
||||
{
|
||||
ptr = const_cast<uint8_t*>(T_UARTCONTEXT::FillUartFifo(T_UARTFEATURE::Index, ptr, end));
|
||||
@ -223,15 +222,15 @@ protected:
|
||||
template<typename T_UARTFEATURE, typename T_UARTCONTEXT> class NeoEsp8266AsyncUart : public NeoEsp8266UartBase
|
||||
{
|
||||
protected:
|
||||
NeoEsp8266AsyncUart(uint16_t pixelCount, size_t elementSize) :
|
||||
NeoEsp8266UartBase(pixelCount, elementSize)
|
||||
NeoEsp8266AsyncUart(uint16_t pixelCount, size_t elementSize, size_t settingsSize) :
|
||||
NeoEsp8266UartBase(pixelCount, elementSize, settingsSize)
|
||||
{
|
||||
_pixelsSending = (uint8_t*)malloc(_sizePixels);
|
||||
_dataSending = static_cast<uint8_t*>(malloc(_sizeData));
|
||||
}
|
||||
|
||||
~NeoEsp8266AsyncUart()
|
||||
{
|
||||
// Remember: the UART interrupt can be sending data from _pixelsSending in the background
|
||||
// Remember: the UART interrupt can be sending data from _dataSending in the background
|
||||
while (_context.IsSending())
|
||||
{
|
||||
yield();
|
||||
@ -239,7 +238,7 @@ protected:
|
||||
// detach context, which will disable intr, may disable ISR
|
||||
_context.Detach(T_UARTFEATURE::Index);
|
||||
|
||||
free(_pixelsSending);
|
||||
free(_dataSending);
|
||||
}
|
||||
|
||||
void ICACHE_RAM_ATTR InitializeUart(uint32_t uartBaud, bool invert)
|
||||
@ -254,8 +253,8 @@ protected:
|
||||
{
|
||||
// Instruct ESP8266 hardware uart to send the pixels asynchronously
|
||||
_context.StartSending(T_UARTFEATURE::Index,
|
||||
_pixels,
|
||||
_pixels + _sizePixels);
|
||||
_data,
|
||||
_data + _sizeData);
|
||||
|
||||
// Annotate when we started to send bytes, so we can calculate when we are ready to send again
|
||||
_startTime = micros();
|
||||
@ -265,17 +264,17 @@ protected:
|
||||
// copy editing to sending,
|
||||
// this maintains the contract that "colors present before will
|
||||
// be the same after", otherwise GetPixelColor will be inconsistent
|
||||
memcpy(_pixelsSending, _pixels, _sizePixels);
|
||||
memcpy(_dataSending, _data, _sizeData);
|
||||
}
|
||||
|
||||
// swap so the user can modify without affecting the async operation
|
||||
std::swap(_pixelsSending, _pixels);
|
||||
std::swap(_dataSending, _data);
|
||||
}
|
||||
|
||||
private:
|
||||
T_UARTCONTEXT _context;
|
||||
|
||||
uint8_t* _pixelsSending; // Holds a copy of LED color values taken when UpdateUart began
|
||||
uint8_t* _dataSending; // Holds a copy of LED color values taken when UpdateUart began
|
||||
};
|
||||
|
||||
class NeoEsp8266UartSpeed800KbpsBase
|
||||
@ -298,6 +297,12 @@ public:
|
||||
static const uint32_t ResetTimeUs = 80; // us between data send bursts to reset for next update
|
||||
};
|
||||
|
||||
class NeoEsp8266UartSpeedTm1814 : public NeoEsp8266UartSpeed800KbpsBase
|
||||
{
|
||||
public:
|
||||
static const uint32_t ResetTimeUs = 200; // us between data send bursts to reset for next update
|
||||
};
|
||||
|
||||
// NeoEsp8266UartSpeed800Kbps contains the timing constant used to get NeoPixelBus running at 800Khz
|
||||
class NeoEsp8266UartSpeed800Kbps : public NeoEsp8266UartSpeed800KbpsBase
|
||||
{
|
||||
@ -342,12 +347,12 @@ template<typename T_SPEED, typename T_BASE, typename T_INVERT>
|
||||
class NeoEsp8266UartMethodBase: public T_BASE
|
||||
{
|
||||
public:
|
||||
NeoEsp8266UartMethodBase(uint16_t pixelCount, size_t elementSize)
|
||||
: T_BASE(pixelCount, elementSize)
|
||||
NeoEsp8266UartMethodBase(uint16_t pixelCount, size_t elementSize, size_t settingsSize)
|
||||
: T_BASE(pixelCount, elementSize, settingsSize)
|
||||
{
|
||||
}
|
||||
NeoEsp8266UartMethodBase(uint8_t pin, uint16_t pixelCount, size_t elementSize)
|
||||
: T_BASE(pixelCount, elementSize)
|
||||
NeoEsp8266UartMethodBase(uint8_t pin, uint16_t pixelCount, size_t elementSize, size_t settingsSize)
|
||||
: T_BASE(pixelCount, elementSize, settingsSize)
|
||||
{
|
||||
}
|
||||
|
||||
@ -383,26 +388,27 @@ public:
|
||||
this->UpdateUart(maintainBufferConsistency);
|
||||
}
|
||||
|
||||
uint8_t* getPixels() const
|
||||
uint8_t* getData() const
|
||||
{
|
||||
return this->_pixels;
|
||||
return this->_data;
|
||||
};
|
||||
|
||||
size_t getPixelsSize() const
|
||||
size_t getDataSize() const
|
||||
{
|
||||
return this->_sizePixels;
|
||||
return this->_sizeData;
|
||||
};
|
||||
|
||||
private:
|
||||
uint32_t getPixelTime() const
|
||||
{
|
||||
return (T_SPEED::ByteSendTimeUs * this->_sizePixels);
|
||||
return (T_SPEED::ByteSendTimeUs * this->_sizeData);
|
||||
};
|
||||
};
|
||||
|
||||
// uart 0
|
||||
typedef NeoEsp8266UartMethodBase<NeoEsp8266UartSpeedWs2812x, NeoEsp8266Uart<UartFeature0, NeoEsp8266UartContext>, NeoEsp8266UartNotInverted> NeoEsp8266Uart0Ws2812xMethod;
|
||||
typedef NeoEsp8266UartMethodBase<NeoEsp8266UartSpeedSk6812, NeoEsp8266Uart<UartFeature0, NeoEsp8266UartContext>, NeoEsp8266UartNotInverted> NeoEsp8266Uart0Sk6812Method;
|
||||
typedef NeoEsp8266UartMethodBase<NeoEsp8266UartSpeedTm1814, NeoEsp8266Uart<UartFeature0, NeoEsp8266UartContext>, NeoEsp8266UartInverted> NeoEsp8266Uart0Tm1814Method;
|
||||
typedef NeoEsp8266UartMethodBase<NeoEsp8266UartSpeedApa106, NeoEsp8266Uart<UartFeature0, NeoEsp8266UartContext>, NeoEsp8266UartNotInverted> NeoEsp8266Uart0Apa106Method;
|
||||
typedef NeoEsp8266UartMethodBase<NeoEsp8266UartSpeed800Kbps, NeoEsp8266Uart<UartFeature0, NeoEsp8266UartContext>, NeoEsp8266UartNotInverted> NeoEsp8266Uart0800KbpsMethod;
|
||||
typedef NeoEsp8266UartMethodBase<NeoEsp8266UartSpeed400Kbps, NeoEsp8266Uart<UartFeature0, NeoEsp8266UartContext>, NeoEsp8266UartNotInverted> NeoEsp8266Uart0400KbpsMethod;
|
||||
@ -415,6 +421,7 @@ typedef NeoEsp8266Uart0Sk6812Method NeoEsp8266Uart0Lc8812Method;
|
||||
// uart 1
|
||||
typedef NeoEsp8266UartMethodBase<NeoEsp8266UartSpeedWs2812x, NeoEsp8266Uart<UartFeature1, NeoEsp8266UartContext>, NeoEsp8266UartNotInverted> NeoEsp8266Uart1Ws2812xMethod;
|
||||
typedef NeoEsp8266UartMethodBase<NeoEsp8266UartSpeedSk6812, NeoEsp8266Uart<UartFeature1, NeoEsp8266UartContext>, NeoEsp8266UartNotInverted> NeoEsp8266Uart1Sk6812Method;
|
||||
typedef NeoEsp8266UartMethodBase<NeoEsp8266UartSpeedTm1814, NeoEsp8266Uart<UartFeature1, NeoEsp8266UartContext>, NeoEsp8266UartInverted> NeoEsp8266Uart1Tm1814Method;
|
||||
typedef NeoEsp8266UartMethodBase<NeoEsp8266UartSpeedApa106, NeoEsp8266Uart<UartFeature1, NeoEsp8266UartContext>, NeoEsp8266UartNotInverted> NeoEsp8266Uart1Apa106Method;
|
||||
typedef NeoEsp8266UartMethodBase<NeoEsp8266UartSpeed800Kbps, NeoEsp8266Uart<UartFeature1, NeoEsp8266UartContext>, NeoEsp8266UartNotInverted> NeoEsp8266Uart1800KbpsMethod;
|
||||
typedef NeoEsp8266UartMethodBase<NeoEsp8266UartSpeed400Kbps, NeoEsp8266Uart<UartFeature1, NeoEsp8266UartContext>, NeoEsp8266UartNotInverted> NeoEsp8266Uart1400KbpsMethod;
|
||||
@ -427,6 +434,7 @@ typedef NeoEsp8266Uart1Sk6812Method NeoEsp8266Uart1Lc8812Method;
|
||||
// uart 0 async
|
||||
typedef NeoEsp8266UartMethodBase<NeoEsp8266UartSpeedWs2812x, NeoEsp8266AsyncUart<UartFeature0, NeoEsp8266UartInterruptContext>, NeoEsp8266UartNotInverted> NeoEsp8266AsyncUart0Ws2812xMethod;
|
||||
typedef NeoEsp8266UartMethodBase<NeoEsp8266UartSpeedSk6812, NeoEsp8266AsyncUart<UartFeature0, NeoEsp8266UartInterruptContext>, NeoEsp8266UartNotInverted> NeoEsp8266AsyncUart0Sk6812Method;
|
||||
typedef NeoEsp8266UartMethodBase<NeoEsp8266UartSpeedTm1814, NeoEsp8266AsyncUart<UartFeature0, NeoEsp8266UartInterruptContext>, NeoEsp8266UartInverted> NeoEsp8266AsyncUart0Tm1814Method;
|
||||
typedef NeoEsp8266UartMethodBase<NeoEsp8266UartSpeedApa106, NeoEsp8266AsyncUart<UartFeature0, NeoEsp8266UartInterruptContext>, NeoEsp8266UartNotInverted> NeoEsp8266AsyncUart0Apa106Method;
|
||||
typedef NeoEsp8266UartMethodBase<NeoEsp8266UartSpeed800Kbps, NeoEsp8266AsyncUart<UartFeature0, NeoEsp8266UartInterruptContext>, NeoEsp8266UartNotInverted> NeoEsp8266AsyncUart0800KbpsMethod;
|
||||
typedef NeoEsp8266UartMethodBase<NeoEsp8266UartSpeed400Kbps, NeoEsp8266AsyncUart<UartFeature0, NeoEsp8266UartInterruptContext>, NeoEsp8266UartNotInverted> NeoEsp8266AsyncUart0400KbpsMethod;
|
||||
@ -439,6 +447,7 @@ typedef NeoEsp8266AsyncUart0Sk6812Method NeoEsp8266AsyncUart0Lc8812Method;
|
||||
// uart 1 async
|
||||
typedef NeoEsp8266UartMethodBase<NeoEsp8266UartSpeedWs2812x, NeoEsp8266AsyncUart<UartFeature1, NeoEsp8266UartInterruptContext>, NeoEsp8266UartNotInverted> NeoEsp8266AsyncUart1Ws2812xMethod;
|
||||
typedef NeoEsp8266UartMethodBase<NeoEsp8266UartSpeedSk6812, NeoEsp8266AsyncUart<UartFeature1, NeoEsp8266UartInterruptContext>, NeoEsp8266UartNotInverted> NeoEsp8266AsyncUart1Sk6812Method;
|
||||
typedef NeoEsp8266UartMethodBase<NeoEsp8266UartSpeedTm1814, NeoEsp8266AsyncUart<UartFeature1, NeoEsp8266UartInterruptContext>, NeoEsp8266UartInverted> NeoEsp8266AsyncUart1Tm1814Method;
|
||||
typedef NeoEsp8266UartMethodBase<NeoEsp8266UartSpeedApa106, NeoEsp8266AsyncUart<UartFeature1, NeoEsp8266UartInterruptContext>, NeoEsp8266UartNotInverted> NeoEsp8266AsyncUart1Apa106Method;
|
||||
typedef NeoEsp8266UartMethodBase<NeoEsp8266UartSpeed800Kbps, NeoEsp8266AsyncUart<UartFeature1, NeoEsp8266UartInterruptContext>, NeoEsp8266UartNotInverted> NeoEsp8266AsyncUart1800KbpsMethod;
|
||||
typedef NeoEsp8266UartMethodBase<NeoEsp8266UartSpeed400Kbps, NeoEsp8266AsyncUart<UartFeature1, NeoEsp8266UartInterruptContext>, NeoEsp8266UartNotInverted> NeoEsp8266AsyncUart1400KbpsMethod;
|
||||
@ -453,6 +462,7 @@ typedef NeoEsp8266AsyncUart1Sk6812Method NeoEsp8266AsyncUart1Lc8812Method;
|
||||
// uart 0
|
||||
typedef NeoEsp8266UartMethodBase<NeoEsp8266UartSpeedWs2812x, NeoEsp8266Uart<UartFeature0, NeoEsp8266UartContext>, NeoEsp8266UartInverted> NeoEsp8266Uart0Ws2812xInvertedMethod;
|
||||
typedef NeoEsp8266UartMethodBase<NeoEsp8266UartSpeedSk6812, NeoEsp8266Uart<UartFeature0, NeoEsp8266UartContext>, NeoEsp8266UartInverted> NeoEsp8266Uart0Sk6812InvertedMethod;
|
||||
typedef NeoEsp8266UartMethodBase<NeoEsp8266UartSpeedTm1814, NeoEsp8266Uart<UartFeature0, NeoEsp8266UartContext>, NeoEsp8266UartNotInverted> NeoEsp8266Uart0Tm1814InvertedMethod;
|
||||
typedef NeoEsp8266UartMethodBase<NeoEsp8266UartSpeedApa106, NeoEsp8266Uart<UartFeature0, NeoEsp8266UartContext>, NeoEsp8266UartInverted> NeoEsp8266Uart0Apa106InvertedMethod;
|
||||
typedef NeoEsp8266UartMethodBase<NeoEsp8266UartSpeed800Kbps, NeoEsp8266Uart<UartFeature0, NeoEsp8266UartContext>, NeoEsp8266UartInverted> NeoEsp8266Uart0800KbpsInvertedMethod;
|
||||
typedef NeoEsp8266UartMethodBase<NeoEsp8266UartSpeed400Kbps, NeoEsp8266Uart<UartFeature0, NeoEsp8266UartContext>, NeoEsp8266UartInverted> NeoEsp8266Uart0400KbpsInvertedMethod;
|
||||
@ -465,6 +475,7 @@ typedef NeoEsp8266Uart0Sk6812InvertedMethod NeoEsp8266Uart0Lc8812InvertedMethod;
|
||||
// uart 1
|
||||
typedef NeoEsp8266UartMethodBase<NeoEsp8266UartSpeedWs2812x, NeoEsp8266Uart<UartFeature1, NeoEsp8266UartContext>, NeoEsp8266UartInverted> NeoEsp8266Uart1Ws2812xInvertedMethod;
|
||||
typedef NeoEsp8266UartMethodBase<NeoEsp8266UartSpeedSk6812, NeoEsp8266Uart<UartFeature1, NeoEsp8266UartContext>, NeoEsp8266UartInverted> NeoEsp8266Uart1Sk6812InvertedMethod;
|
||||
typedef NeoEsp8266UartMethodBase<NeoEsp8266UartSpeedTm1814, NeoEsp8266Uart<UartFeature1, NeoEsp8266UartContext>, NeoEsp8266UartNotInverted> NeoEsp8266Uart1Tm1814InvertedMethod;
|
||||
typedef NeoEsp8266UartMethodBase<NeoEsp8266UartSpeedApa106, NeoEsp8266Uart<UartFeature1, NeoEsp8266UartContext>, NeoEsp8266UartInverted> NeoEsp8266Uart1Apa106InvertedMethod;
|
||||
typedef NeoEsp8266UartMethodBase<NeoEsp8266UartSpeed800Kbps, NeoEsp8266Uart<UartFeature1, NeoEsp8266UartContext>, NeoEsp8266UartInverted> NeoEsp8266Uart1800KbpsInvertedMethod;
|
||||
typedef NeoEsp8266UartMethodBase<NeoEsp8266UartSpeed400Kbps, NeoEsp8266Uart<UartFeature1, NeoEsp8266UartContext>, NeoEsp8266UartInverted> NeoEsp8266Uart1400KbpsInvertedMethod;
|
||||
@ -477,6 +488,7 @@ typedef NeoEsp8266Uart1Sk6812InvertedMethod NeoEsp8266Uart1Lc8812InvertedMethod;
|
||||
// uart 0 async
|
||||
typedef NeoEsp8266UartMethodBase<NeoEsp8266UartSpeedWs2812x, NeoEsp8266AsyncUart<UartFeature0, NeoEsp8266UartInterruptContext>, NeoEsp8266UartInverted> NeoEsp8266AsyncUart0Ws2812xInvertedMethod;
|
||||
typedef NeoEsp8266UartMethodBase<NeoEsp8266UartSpeedSk6812, NeoEsp8266AsyncUart<UartFeature0, NeoEsp8266UartInterruptContext>, NeoEsp8266UartInverted> NeoEsp8266AsyncUart0Sk6812InvertedMethod;
|
||||
typedef NeoEsp8266UartMethodBase<NeoEsp8266UartSpeedTm1814, NeoEsp8266AsyncUart<UartFeature0, NeoEsp8266UartInterruptContext>, NeoEsp8266UartNotInverted> NeoEsp8266AsyncUart0Tm1814InvertedMethod;
|
||||
typedef NeoEsp8266UartMethodBase<NeoEsp8266UartSpeedApa106, NeoEsp8266AsyncUart<UartFeature0, NeoEsp8266UartInterruptContext>, NeoEsp8266UartInverted> NeoEsp8266AsyncUart0Apa106InvertedMethod;
|
||||
typedef NeoEsp8266UartMethodBase<NeoEsp8266UartSpeed800Kbps, NeoEsp8266AsyncUart<UartFeature0, NeoEsp8266UartInterruptContext>, NeoEsp8266UartInverted> NeoEsp8266AsyncUart0800KbpsInvertedMethod;
|
||||
typedef NeoEsp8266UartMethodBase<NeoEsp8266UartSpeed400Kbps, NeoEsp8266AsyncUart<UartFeature0, NeoEsp8266UartInterruptContext>, NeoEsp8266UartInverted> NeoEsp8266AsyncUart0400KbpsInvertedMethod;
|
||||
@ -489,6 +501,7 @@ typedef NeoEsp8266AsyncUart0Sk6812InvertedMethod NeoEsp8266AsyncUart0Lc8812Inver
|
||||
// uart 1 async
|
||||
typedef NeoEsp8266UartMethodBase<NeoEsp8266UartSpeedWs2812x, NeoEsp8266AsyncUart<UartFeature1, NeoEsp8266UartInterruptContext>, NeoEsp8266UartInverted> NeoEsp8266AsyncUart1Ws2812xInvertedMethod;
|
||||
typedef NeoEsp8266UartMethodBase<NeoEsp8266UartSpeedSk6812, NeoEsp8266AsyncUart<UartFeature1, NeoEsp8266UartInterruptContext>, NeoEsp8266UartInverted> NeoEsp8266AsyncUart1Sk6812InvertedMethod;
|
||||
typedef NeoEsp8266UartMethodBase<NeoEsp8266UartSpeedTm1814, NeoEsp8266AsyncUart<UartFeature1, NeoEsp8266UartInterruptContext>, NeoEsp8266UartNotInverted> NeoEsp8266AsyncUart1Tm1814InvertedMethod;
|
||||
typedef NeoEsp8266UartMethodBase<NeoEsp8266UartSpeedApa106, NeoEsp8266AsyncUart<UartFeature1, NeoEsp8266UartInterruptContext>, NeoEsp8266UartInverted> NeoEsp8266AsyncUart1Apa106InvertedMethod;
|
||||
typedef NeoEsp8266UartMethodBase<NeoEsp8266UartSpeed800Kbps, NeoEsp8266AsyncUart<UartFeature1, NeoEsp8266UartInterruptContext>, NeoEsp8266UartInverted> NeoEsp8266AsyncUart1800KbpsInvertedMethod;
|
||||
typedef NeoEsp8266UartMethodBase<NeoEsp8266UartSpeed400Kbps, NeoEsp8266AsyncUart<UartFeature1, NeoEsp8266UartInterruptContext>, NeoEsp8266UartInverted> NeoEsp8266AsyncUart1400KbpsInvertedMethod;
|
||||
|
@ -47,6 +47,14 @@ public:
|
||||
const static uint32_t Period = (F_CPU / 800000 - CYCLES_LOOPTEST); // 1.25us per bit
|
||||
};
|
||||
|
||||
class NeoEspSpeedTm1814
|
||||
{
|
||||
public:
|
||||
const static uint32_t T0H = (F_CPU / 2916666 - CYCLES_LOOPTEST); // 0.35us
|
||||
const static uint32_t T1H = (F_CPU / 1666666 - CYCLES_LOOPTEST); // 0.75us
|
||||
const static uint32_t Period = (F_CPU / 800000 - CYCLES_LOOPTEST); // 1.25us per bit
|
||||
};
|
||||
|
||||
class NeoEspSpeed800Mhz
|
||||
{
|
||||
public:
|
||||
@ -191,6 +199,13 @@ public:
|
||||
static const uint32_t ResetTimeUs = 80;
|
||||
};
|
||||
|
||||
// normal is inverted signal
|
||||
class NeoEspBitBangSpeedTm1814 : public NeoEspBitBangBase<NeoEspSpeedTm1814, NeoEspPinsetInverted>
|
||||
{
|
||||
public:
|
||||
static const uint32_t ResetTimeUs = 200;
|
||||
};
|
||||
|
||||
class NeoEspBitBangSpeed800Kbps : public NeoEspBitBangBase<NeoEspSpeed800Mhz, NeoEspPinset>
|
||||
{
|
||||
public:
|
||||
@ -222,6 +237,13 @@ public:
|
||||
static const uint32_t ResetTimeUs = 80;
|
||||
};
|
||||
|
||||
// normal is inverted signal, so inverted is normal
|
||||
class NeoEspBitBangInvertedSpeedTm1814 : public NeoEspBitBangBase<NeoEspSpeedTm1814, NeoEspPinset>
|
||||
{
|
||||
public:
|
||||
static const uint32_t ResetTimeUs = 200;
|
||||
};
|
||||
|
||||
class NeoEspBitBangInvertedSpeed800Kbps : public NeoEspBitBangBase<NeoEspSpeed800Mhz, NeoEspPinsetInverted>
|
||||
{
|
||||
public:
|
||||
@ -237,21 +259,21 @@ public:
|
||||
template<typename T_SPEED, typename T_PINSET> class NeoEspBitBangMethodBase
|
||||
{
|
||||
public:
|
||||
NeoEspBitBangMethodBase(uint8_t pin, uint16_t pixelCount, size_t elementSize) :
|
||||
NeoEspBitBangMethodBase(uint8_t pin, uint16_t pixelCount, size_t elementSize, size_t settingsSize) :
|
||||
_sizeData(pixelCount * elementSize + settingsSize),
|
||||
_pin(pin)
|
||||
{
|
||||
pinMode(pin, OUTPUT);
|
||||
|
||||
_sizePixels = pixelCount * elementSize;
|
||||
_pixels = (uint8_t*)malloc(_sizePixels);
|
||||
memset(_pixels, 0, _sizePixels);
|
||||
_data = static_cast<uint8_t*>(malloc(_sizeData));
|
||||
memset(_data, 0, _sizeData);
|
||||
}
|
||||
|
||||
~NeoEspBitBangMethodBase()
|
||||
{
|
||||
pinMode(_pin, INPUT);
|
||||
|
||||
free(_pixels);
|
||||
free(_data);
|
||||
}
|
||||
|
||||
bool IsReadyToUpdate() const
|
||||
@ -291,7 +313,7 @@ public:
|
||||
noInterrupts();
|
||||
#endif
|
||||
|
||||
T_SPEED::send_pixels(_pixels, _pixels + _sizePixels, _pin);
|
||||
T_SPEED::send_pixels(_data, _data + _sizeData, _pin);
|
||||
|
||||
#if defined(ARDUINO_ARCH_ESP32)
|
||||
portEXIT_CRITICAL(&updateMux);
|
||||
@ -303,21 +325,22 @@ public:
|
||||
_endTime = micros();
|
||||
}
|
||||
|
||||
uint8_t* getPixels() const
|
||||
uint8_t* getData() const
|
||||
{
|
||||
return _pixels;
|
||||
return _data;
|
||||
};
|
||||
|
||||
size_t getPixelsSize() const
|
||||
size_t getDataSize() const
|
||||
{
|
||||
return _sizePixels;
|
||||
return _sizeData;
|
||||
};
|
||||
|
||||
private:
|
||||
const size_t _sizeData; // Size of '_data' buffer below
|
||||
const uint8_t _pin; // output pin number
|
||||
|
||||
uint32_t _endTime; // Latch timing reference
|
||||
size_t _sizePixels; // Size of '_pixels' buffer below
|
||||
uint8_t* _pixels; // Holds LED color values
|
||||
uint8_t _pin; // output pin number
|
||||
uint8_t* _data; // Holds LED color values
|
||||
};
|
||||
|
||||
|
||||
@ -326,6 +349,7 @@ private:
|
||||
typedef NeoEspBitBangMethodBase<NeoEspBitBangSpeedWs2811, NeoEspPinset> NeoEsp32BitBangWs2811Method;
|
||||
typedef NeoEspBitBangMethodBase<NeoEspBitBangSpeedWs2812x, NeoEspPinset> NeoEsp32BitBangWs2812xMethod;
|
||||
typedef NeoEspBitBangMethodBase<NeoEspBitBangSpeedSk6812, NeoEspPinset> NeoEsp32BitBangSk6812Method;
|
||||
typedef NeoEspBitBangMethodBase<NeoEspBitBangSpeedTm1814, NeoEspPinsetInverted> NeoEsp32BitBangTm1814Method;
|
||||
typedef NeoEspBitBangMethodBase<NeoEspBitBangSpeed800Kbps, NeoEspPinset> NeoEsp32BitBang800KbpsMethod;
|
||||
typedef NeoEspBitBangMethodBase<NeoEspBitBangSpeed400Kbps, NeoEspPinset> NeoEsp32BitBang400KbpsMethod;
|
||||
|
||||
@ -337,6 +361,7 @@ typedef NeoEsp32BitBang400KbpsMethod NeoEsp32BitBangApa106Method;
|
||||
typedef NeoEspBitBangMethodBase<NeoEspBitBangInvertedSpeedWs2811, NeoEspPinsetInverted> NeoEsp32BitBangWs2811InvertedMethod;
|
||||
typedef NeoEspBitBangMethodBase<NeoEspBitBangInvertedSpeedWs2812x, NeoEspPinsetInverted> NeoEsp32BitBangWs2812xInvertedMethod;
|
||||
typedef NeoEspBitBangMethodBase<NeoEspBitBangInvertedSpeedSk6812, NeoEspPinsetInverted> NeoEsp32BitBangSk6812InvertedMethod;
|
||||
typedef NeoEspBitBangMethodBase<NeoEspBitBangInvertedSpeedTm1814, NeoEspPinset> NeoEsp32BitBangTm1814InvertedMethod;
|
||||
typedef NeoEspBitBangMethodBase<NeoEspBitBangInvertedSpeed800Kbps, NeoEspPinsetInverted> NeoEsp32BitBang800KbpsInvertedMethod;
|
||||
typedef NeoEspBitBangMethodBase<NeoEspBitBangInvertedSpeed400Kbps, NeoEspPinsetInverted> NeoEsp32BitBang400KbpsInvertedMethod;
|
||||
|
||||
@ -350,6 +375,7 @@ typedef NeoEsp32BitBang400KbpsInvertedMethod NeoEsp32BitBangApa106InvertedMethod
|
||||
typedef NeoEspBitBangMethodBase<NeoEspBitBangSpeedWs2811, NeoEspPinset> NeoEsp8266BitBangWs2811Method;
|
||||
typedef NeoEspBitBangMethodBase<NeoEspBitBangSpeedWs2812x, NeoEspPinset> NeoEsp8266BitBangWs2812xMethod;
|
||||
typedef NeoEspBitBangMethodBase<NeoEspBitBangSpeedSk6812, NeoEspPinset> NeoEsp8266BitBangSk6812Method;
|
||||
typedef NeoEspBitBangMethodBase<NeoEspBitBangSpeedTm1814, NeoEspPinsetInverted> NeoEsp8266BitBangTm1814Method;
|
||||
typedef NeoEspBitBangMethodBase<NeoEspBitBangSpeed800Kbps, NeoEspPinset> NeoEsp8266BitBang800KbpsMethod;
|
||||
typedef NeoEspBitBangMethodBase<NeoEspBitBangSpeed400Kbps, NeoEspPinset> NeoEsp8266BitBang400KbpsMethod;
|
||||
|
||||
@ -361,6 +387,7 @@ typedef NeoEsp8266BitBang400KbpsMethod NeoEsp8266BitBangApa106Method;
|
||||
typedef NeoEspBitBangMethodBase<NeoEspBitBangInvertedSpeedWs2811, NeoEspPinsetInverted> NeoEsp8266BitBangWs2811InvertedMethod;
|
||||
typedef NeoEspBitBangMethodBase<NeoEspBitBangInvertedSpeedWs2812x, NeoEspPinsetInverted> NeoEsp8266BitBangWs2812xInvertedMethod;
|
||||
typedef NeoEspBitBangMethodBase<NeoEspBitBangInvertedSpeedSk6812, NeoEspPinsetInverted> NeoEsp8266BitBangSk6812InvertedMethod;
|
||||
typedef NeoEspBitBangMethodBase<NeoEspBitBangInvertedSpeedTm1814, NeoEspPinset> NeoEsp8266BitBangTm1814InvertedMethod;
|
||||
typedef NeoEspBitBangMethodBase<NeoEspBitBangInvertedSpeed800Kbps, NeoEspPinsetInverted> NeoEsp8266BitBang800KbpsInvertedMethod;
|
||||
typedef NeoEspBitBangMethodBase<NeoEspBitBangInvertedSpeed400Kbps, NeoEspPinsetInverted> NeoEsp8266BitBang400KbpsInvertedMethod;
|
||||
|
||||
|
@ -31,7 +31,7 @@ License along with NeoPixel. If not, see
|
||||
|
||||
#if defined(ARDUINO_ARCH_NRF52840)
|
||||
|
||||
const uint16_t c_dmaBytesPerPixelByte = 8 * sizeof(nrf_pwm_values_common_t); // bits * bytes to represent pulse
|
||||
const uint16_t c_dmaBytesPerDataByte = 8 * sizeof(nrf_pwm_values_common_t); // bits * bytes to represent pulse
|
||||
|
||||
// for Bit* variables
|
||||
// count 1 = 0.0625us, so max count (32768) is 2048us
|
||||
@ -69,6 +69,17 @@ public:
|
||||
const static PinStatus IdleLevel = LOW;
|
||||
};
|
||||
|
||||
class NeoNrf52xPwmSpeedTm1814
|
||||
{
|
||||
public:
|
||||
const static uint32_t CountTop = 20UL; // 1.25us
|
||||
const static nrf_pwm_values_common_t Bit0 = 5; // ~0.3us
|
||||
const static nrf_pwm_values_common_t Bit1 = 12; // ~0.7us
|
||||
const static nrf_pwm_values_common_t BitReset = 0x0000; // HIGH
|
||||
const static uint32_t CountReset = 160; // 200us / 1.25us pulse width
|
||||
const static PinStatus IdleLevel = HIGH;
|
||||
};
|
||||
|
||||
class NeoNrf52xPwmSpeed800Kbps
|
||||
{
|
||||
public:
|
||||
@ -135,6 +146,17 @@ public:
|
||||
const static PinStatus IdleLevel = HIGH;
|
||||
};
|
||||
|
||||
class NeoNrf52xPwmInvertedSpeedTm1814
|
||||
{
|
||||
public:
|
||||
const static uint32_t CountTop = 20UL; // 1.25us
|
||||
const static nrf_pwm_values_common_t Bit0 = 5 | 0x8000; // ~0.3us
|
||||
const static nrf_pwm_values_common_t Bit1 = 12 | 0x8000; // ~0.7us
|
||||
const static nrf_pwm_values_common_t BitReset = 0x8000; // LOW
|
||||
const static uint32_t CountReset = 160; // 200us / 1.25us pulse width
|
||||
const static PinStatus IdleLevel = LOW;
|
||||
};
|
||||
|
||||
class NeoNrf52xPwmInvertedSpeed800Kbps
|
||||
{
|
||||
public:
|
||||
@ -209,16 +231,16 @@ public:
|
||||
template<typename T_SPEED, typename T_BUS> class NeoNrf52xMethodBase
|
||||
{
|
||||
public:
|
||||
NeoNrf52xMethodBase(uint8_t pin, uint16_t pixelCount, size_t elementSize) :
|
||||
NeoNrf52xMethodBase(uint8_t pin, uint16_t pixelCount, size_t elementSize, size_t settingsSize) :
|
||||
_sizeData(pixelCount * elementSize + settingsSize),
|
||||
_pin(pin)
|
||||
{
|
||||
pinMode(pin, OUTPUT);
|
||||
|
||||
_pixelsSize = pixelCount * elementSize;
|
||||
_pixels = static_cast<uint8_t*>(malloc(_pixelsSize));
|
||||
memset(_pixels, 0, _pixelsSize);
|
||||
_data = static_cast<uint8_t*>(malloc(_sizeData));
|
||||
memset(_data, 0, _sizeData);
|
||||
|
||||
_dmaBufferSize = c_dmaBytesPerPixelByte * _pixelsSize + sizeof(nrf_pwm_values_common_t);
|
||||
_dmaBufferSize = c_dmaBytesPerDataByte * _sizeData + sizeof(nrf_pwm_values_common_t);
|
||||
_dmaBuffer = static_cast<nrf_pwm_values_common_t*>(malloc(_dmaBufferSize));
|
||||
}
|
||||
|
||||
@ -233,7 +255,7 @@ public:
|
||||
|
||||
pinMode(_pin, INPUT);
|
||||
|
||||
free(_pixels);
|
||||
free(_data);
|
||||
free(_dmaBuffer);
|
||||
}
|
||||
|
||||
@ -271,22 +293,21 @@ public:
|
||||
dmaStart();
|
||||
}
|
||||
|
||||
uint8_t* getPixels() const
|
||||
uint8_t* getData() const
|
||||
{
|
||||
return _pixels;
|
||||
return _data;
|
||||
};
|
||||
|
||||
size_t getPixelsSize() const
|
||||
size_t getDataSize() const
|
||||
{
|
||||
return _pixelsSize;
|
||||
return _sizeData;
|
||||
};
|
||||
|
||||
private:
|
||||
const size_t _sizeData; // Size of '_data' buffer below
|
||||
const uint8_t _pin; // output pin number
|
||||
|
||||
size_t _pixelsSize; // Size of '_pixels' buffer below
|
||||
uint8_t* _pixels; // Holds LED color values
|
||||
|
||||
uint8_t* _data; // Holds LED color values
|
||||
size_t _dmaBufferSize; // total size of _dmaBuffer
|
||||
nrf_pwm_values_common_t* _dmaBuffer; // Holds pixel data in native format for PWM hardware
|
||||
|
||||
@ -335,11 +356,11 @@ private:
|
||||
{
|
||||
nrf_pwm_values_common_t* pDma = _dmaBuffer;
|
||||
nrf_pwm_values_common_t* pDmaEnd = _dmaBuffer + (_dmaBufferSize / sizeof(nrf_pwm_values_common_t));
|
||||
uint8_t* pPixelsEnd = _pixels + _pixelsSize;
|
||||
uint8_t* pEnd = _data + _sizeData;
|
||||
|
||||
for (uint8_t* pPixel = _pixels; pPixel < pPixelsEnd; pPixel++)
|
||||
for (uint8_t* pData = _data; pData < pEnd; pData++)
|
||||
{
|
||||
uint8_t data = *pPixel;
|
||||
uint8_t data = *pData;
|
||||
|
||||
for (uint8_t bit = 0; bit < 8; bit++)
|
||||
{
|
||||
@ -375,6 +396,7 @@ private:
|
||||
typedef NeoNrf52xMethodBase<NeoNrf52xPwmSpeedWs2811, NeoNrf52xPwm0> NeoNrf52xPwm0Ws2811Method;
|
||||
typedef NeoNrf52xMethodBase<NeoNrf52xPwmSpeedWs2812x, NeoNrf52xPwm0> NeoNrf52xPwm0Ws2812xMethod;
|
||||
typedef NeoNrf52xMethodBase<NeoNrf52xPwmSpeedSk6812, NeoNrf52xPwm0> NeoNrf52xPwm0Sk6812Method;
|
||||
typedef NeoNrf52xMethodBase<NeoNrf52xPwmSpeedTm1814, NeoNrf52xPwm0> NeoNrf52xPwm0Tm1814Method;
|
||||
typedef NeoNrf52xMethodBase<NeoNrf52xPwmSpeedApa106, NeoNrf52xPwm0> NeoNrf52xPwm0Apa106Method;
|
||||
typedef NeoNrf52xMethodBase<NeoNrf52xPwmSpeed800Kbps, NeoNrf52xPwm0> NeoNrf52xPwm0800KbpsMethod;
|
||||
typedef NeoNrf52xMethodBase<NeoNrf52xPwmSpeed400Kbps, NeoNrf52xPwm0> NeoNrf52xPwm0400KbpsMethod;
|
||||
@ -382,6 +404,7 @@ typedef NeoNrf52xMethodBase<NeoNrf52xPwmSpeed400Kbps, NeoNrf52xPwm0> NeoNrf52xPw
|
||||
typedef NeoNrf52xMethodBase<NeoNrf52xPwmSpeedWs2811, NeoNrf52xPwm1> NeoNrf52xPwm1Ws2811Method;
|
||||
typedef NeoNrf52xMethodBase<NeoNrf52xPwmSpeedWs2812x, NeoNrf52xPwm1> NeoNrf52xPwm1Ws2812xMethod;
|
||||
typedef NeoNrf52xMethodBase<NeoNrf52xPwmSpeedSk6812, NeoNrf52xPwm1> NeoNrf52xPwm1Sk6812Method;
|
||||
typedef NeoNrf52xMethodBase<NeoNrf52xPwmSpeedTm1814, NeoNrf52xPwm1> NeoNrf52xPwm1Tm1814Method;
|
||||
typedef NeoNrf52xMethodBase<NeoNrf52xPwmSpeedApa106, NeoNrf52xPwm1> NeoNrf52xPwm1Apa106Method;
|
||||
typedef NeoNrf52xMethodBase<NeoNrf52xPwmSpeed800Kbps, NeoNrf52xPwm1> NeoNrf52xPwm1800KbpsMethod;
|
||||
typedef NeoNrf52xMethodBase<NeoNrf52xPwmSpeed400Kbps, NeoNrf52xPwm1> NeoNrf52xPwm1400KbpsMethod;
|
||||
@ -389,6 +412,7 @@ typedef NeoNrf52xMethodBase<NeoNrf52xPwmSpeed400Kbps, NeoNrf52xPwm1> NeoNrf52xPw
|
||||
typedef NeoNrf52xMethodBase<NeoNrf52xPwmSpeedWs2811, NeoNrf52xPwm2> NeoNrf52xPwm2Ws2811Method;
|
||||
typedef NeoNrf52xMethodBase<NeoNrf52xPwmSpeedWs2812x, NeoNrf52xPwm2> NeoNrf52xPwm2Ws2812xMethod;
|
||||
typedef NeoNrf52xMethodBase<NeoNrf52xPwmSpeedSk6812, NeoNrf52xPwm2> NeoNrf52xPwm2Sk6812Method;
|
||||
typedef NeoNrf52xMethodBase<NeoNrf52xPwmSpeedTm1814, NeoNrf52xPwm2> NeoNrf52xPwm2Tm1814Method;
|
||||
typedef NeoNrf52xMethodBase<NeoNrf52xPwmSpeedApa106, NeoNrf52xPwm2> NeoNrf52xPwm2Apa106Method;
|
||||
typedef NeoNrf52xMethodBase<NeoNrf52xPwmSpeed800Kbps, NeoNrf52xPwm2> NeoNrf52xPwm2800KbpsMethod;
|
||||
typedef NeoNrf52xMethodBase<NeoNrf52xPwmSpeed400Kbps, NeoNrf52xPwm2> NeoNrf52xPwm2400KbpsMethod;
|
||||
@ -397,6 +421,7 @@ typedef NeoNrf52xMethodBase<NeoNrf52xPwmSpeed400Kbps, NeoNrf52xPwm2> NeoNrf52xPw
|
||||
typedef NeoNrf52xMethodBase<NeoNrf52xPwmSpeedWs2811, NeoNrf52xPwm3> NeoNrf52xPwm3Ws2811Method;
|
||||
typedef NeoNrf52xMethodBase<NeoNrf52xPwmSpeedWs2812x, NeoNrf52xPwm3> NeoNrf52xPwm3Ws2812xMethod;
|
||||
typedef NeoNrf52xMethodBase<NeoNrf52xPwmSpeedSk6812, NeoNrf52xPwm3> NeoNrf52xPwm3Sk6812Method;
|
||||
typedef NeoNrf52xMethodBase<NeoNrf52xPwmSpeedTm1814, NeoNrf52xPwm3> NeoNrf52xPwm3Tm1814Method;
|
||||
typedef NeoNrf52xMethodBase<NeoNrf52xPwmSpeedApa106, NeoNrf52xPwm3> NeoNrf52xPwm3Apa106Method;
|
||||
typedef NeoNrf52xMethodBase<NeoNrf52xPwmSpeed800Kbps, NeoNrf52xPwm3> NeoNrf52xPwm3800KbpsMethod;
|
||||
typedef NeoNrf52xMethodBase<NeoNrf52xPwmSpeed400Kbps, NeoNrf52xPwm3> NeoNrf52xPwm3400KbpsMethod;
|
||||
@ -406,6 +431,7 @@ typedef NeoNrf52xMethodBase<NeoNrf52xPwmSpeed400Kbps, NeoNrf52xPwm3> NeoNrf52xPw
|
||||
typedef NeoNrf52xMethodBase<NeoNrf52xPwmInvertedSpeedWs2811, NeoNrf52xPwm0> NeoNrf52xPwm0Ws2811InvertedMethod;
|
||||
typedef NeoNrf52xMethodBase<NeoNrf52xPwmInvertedSpeedWs2812x, NeoNrf52xPwm0> NeoNrf52xPwm0Ws2812xInvertedMethod;
|
||||
typedef NeoNrf52xMethodBase<NeoNrf52xPwmInvertedSpeedSk6812, NeoNrf52xPwm0> NeoNrf52xPwm0Sk6812InvertedMethod;
|
||||
typedef NeoNrf52xMethodBase<NeoNrf52xPwmInvertedSpeedTm1814, NeoNrf52xPwm0> NeoNrf52xPwm0Tm1814InvertedMethod;
|
||||
typedef NeoNrf52xMethodBase<NeoNrf52xPwmInvertedSpeedApa106, NeoNrf52xPwm0> NeoNrf52xPwm0Apa106InvertedMethod;
|
||||
typedef NeoNrf52xMethodBase<NeoNrf52xPwmInvertedSpeed800Kbps, NeoNrf52xPwm0> NeoNrf52xPwm0800KbpsInvertedMethod;
|
||||
typedef NeoNrf52xMethodBase<NeoNrf52xPwmInvertedSpeed400Kbps, NeoNrf52xPwm0> NeoNrf52xPwm0400KbpsInvertedMethod;
|
||||
@ -413,6 +439,7 @@ typedef NeoNrf52xMethodBase<NeoNrf52xPwmInvertedSpeed400Kbps, NeoNrf52xPwm0> Neo
|
||||
typedef NeoNrf52xMethodBase<NeoNrf52xPwmInvertedSpeedWs2811, NeoNrf52xPwm1> NeoNrf52xPwm1Ws2811InvertedMethod;
|
||||
typedef NeoNrf52xMethodBase<NeoNrf52xPwmInvertedSpeedWs2812x, NeoNrf52xPwm1> NeoNrf52xPwm1Ws2812xInvertedMethod;
|
||||
typedef NeoNrf52xMethodBase<NeoNrf52xPwmInvertedSpeedSk6812, NeoNrf52xPwm1> NeoNrf52xPwm1Sk6812InvertedMethod;
|
||||
typedef NeoNrf52xMethodBase<NeoNrf52xPwmInvertedSpeedTm1814, NeoNrf52xPwm1> NeoNrf52xPwm1Tm1814InvertedMethod;
|
||||
typedef NeoNrf52xMethodBase<NeoNrf52xPwmInvertedSpeedApa106, NeoNrf52xPwm1> NeoNrf52xPwm1Apa106InvertedMethod;
|
||||
typedef NeoNrf52xMethodBase<NeoNrf52xPwmInvertedSpeed800Kbps, NeoNrf52xPwm1> NeoNrf52xPwm1800KbpsInvertedMethod;
|
||||
typedef NeoNrf52xMethodBase<NeoNrf52xPwmInvertedSpeed400Kbps, NeoNrf52xPwm1> NeoNrf52xPwm1400KbpsInvertedMethod;
|
||||
@ -420,6 +447,7 @@ typedef NeoNrf52xMethodBase<NeoNrf52xPwmInvertedSpeed400Kbps, NeoNrf52xPwm1> Neo
|
||||
typedef NeoNrf52xMethodBase<NeoNrf52xPwmInvertedSpeedWs2811, NeoNrf52xPwm2> NeoNrf52xPwm2Ws2811InvertedMethod;
|
||||
typedef NeoNrf52xMethodBase<NeoNrf52xPwmInvertedSpeedWs2812x, NeoNrf52xPwm2> NeoNrf52xPwm2Ws2812xInvertedMethod;
|
||||
typedef NeoNrf52xMethodBase<NeoNrf52xPwmInvertedSpeedSk6812, NeoNrf52xPwm2> NeoNrf52xPwm2Sk6812InvertedMethod;
|
||||
typedef NeoNrf52xMethodBase<NeoNrf52xPwmInvertedSpeedTm1814, NeoNrf52xPwm2> NeoNrf52xPwm2Tm1814InvertedMethod;
|
||||
typedef NeoNrf52xMethodBase<NeoNrf52xPwmInvertedSpeedApa106, NeoNrf52xPwm2> NeoNrf52xPwm2Apa106InvertedMethod;
|
||||
typedef NeoNrf52xMethodBase<NeoNrf52xPwmInvertedSpeed800Kbps, NeoNrf52xPwm2> NeoNrf52xPwm2800KbpsInvertedMethod;
|
||||
typedef NeoNrf52xMethodBase<NeoNrf52xPwmInvertedSpeed400Kbps, NeoNrf52xPwm2> NeoNrf52xPwm2400KbpsInvertedMethod;
|
||||
@ -428,6 +456,7 @@ typedef NeoNrf52xMethodBase<NeoNrf52xPwmInvertedSpeed400Kbps, NeoNrf52xPwm2> Neo
|
||||
typedef NeoNrf52xMethodBase<NeoNrf52xPwmInvertedSpeedWs2811, NeoNrf52xPwm3> NeoNrf52xPwm3Ws2811InvertedMethod;
|
||||
typedef NeoNrf52xMethodBase<NeoNrf52xPwmInvertedSpeedWs2812x, NeoNrf52xPwm3> NeoNrf52xPwm3Ws2812xInvertedMethod;
|
||||
typedef NeoNrf52xMethodBase<NeoNrf52xPwmInvertedSpeedSk6812, NeoNrf52xPwm3> NeoNrf52xPwm3Sk6812InvertedMethod;
|
||||
typedef NeoNrf52xMethodBase<NeoNrf52xPwmInvertedSpeedTm1814, NeoNrf52xPwm3> NeoNrf52xPwm3Tm1814InvertedMethod;
|
||||
typedef NeoNrf52xMethodBase<NeoNrf52xPwmInvertedSpeedApa106, NeoNrf52xPwm3> NeoNrf52xPwm3Apa106InvertedMethod;
|
||||
typedef NeoNrf52xMethodBase<NeoNrf52xPwmInvertedSpeed800Kbps, NeoNrf52xPwm3> NeoNrf52xPwm3800KbpsInvertedMethod;
|
||||
typedef NeoNrf52xMethodBase<NeoNrf52xPwmInvertedSpeed400Kbps, NeoNrf52xPwm3> NeoNrf52xPwm3400KbpsInvertedMethod;
|
||||
@ -439,6 +468,7 @@ typedef NeoNrf52xPwm2Ws2812xMethod NeoWs2812xMethod;
|
||||
typedef NeoNrf52xPwm2800KbpsMethod NeoWs2812Method;
|
||||
typedef NeoNrf52xPwm2Ws2812xMethod NeoWs2811Method;
|
||||
typedef NeoNrf52xPwm2Sk6812Method NeoSk6812Method;
|
||||
typedef NeoNrf52xPwm2Tm1814Method NeoTm1814Method;
|
||||
typedef NeoNrf52xPwm2Sk6812Method NeoLc8812Method;
|
||||
typedef NeoNrf52xPwm2Apa106Method NeoApa106Method;
|
||||
|
||||
@ -450,6 +480,7 @@ typedef NeoNrf52xPwm2Ws2812xInvertedMethod NeoWs2812xInvertedMethod;
|
||||
typedef NeoNrf52xPwm2Ws2812xInvertedMethod NeoWs2811InvertedMethod;
|
||||
typedef NeoNrf52xPwm2800KbpsInvertedMethod NeoWs2812InvertedMethod;
|
||||
typedef NeoNrf52xPwm2Sk6812InvertedMethod NeoSk6812InvertedMethod;
|
||||
typedef NeoNrf52xPwm2Tm1814InvertedMethod NeoTm1814InvertedMethod;
|
||||
typedef NeoNrf52xPwm2Sk6812InvertedMethod NeoLc8812InvertedMethod;
|
||||
typedef NeoNrf52xPwm2Apa106InvertedMethod NeoApa106InvertedMethod;
|
||||
|
||||
|
@ -37,24 +37,24 @@ License along with NeoPixel. If not, see
|
||||
template<typename T_TWOWIRE> class Ws2801MethodBase
|
||||
{
|
||||
public:
|
||||
Ws2801MethodBase(uint8_t pinClock, uint8_t pinData, uint16_t pixelCount, size_t elementSize) :
|
||||
_sizePixels(pixelCount * elementSize),
|
||||
Ws2801MethodBase(uint8_t pinClock, uint8_t pinData, uint16_t pixelCount, size_t elementSize, size_t settingsSize) :
|
||||
_sizeData(pixelCount * elementSize + settingsSize),
|
||||
_wire(pinClock, pinData)
|
||||
{
|
||||
_pixels = (uint8_t*)malloc(_sizePixels);
|
||||
memset(_pixels, 0, _sizePixels);
|
||||
_data = static_cast<uint8_t*>(malloc(_sizeData));
|
||||
memset(_data, 0, _sizeData);
|
||||
}
|
||||
|
||||
#if !defined(__AVR_ATtiny85__) && !defined(ARDUINO_attiny)
|
||||
Ws2801MethodBase(uint16_t pixelCount, size_t elementSize) :
|
||||
Ws2801MethodBase(SCK, MOSI, pixelCount, elementSize)
|
||||
Ws2801MethodBase(uint16_t pixelCount, size_t elementSize, size_t settingsSize) :
|
||||
Ws2801MethodBase(SCK, MOSI, pixelCount, elementSize, settingsSize)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
~Ws2801MethodBase()
|
||||
{
|
||||
free(_pixels);
|
||||
free(_data);
|
||||
}
|
||||
|
||||
bool IsReadyToUpdate() const
|
||||
@ -90,7 +90,7 @@ public:
|
||||
_wire.beginTransaction();
|
||||
|
||||
// data
|
||||
_wire.transmitBytes(_pixels, _sizePixels);
|
||||
_wire.transmitBytes(_data, _sizeData);
|
||||
|
||||
_wire.endTransaction();
|
||||
|
||||
@ -98,22 +98,22 @@ public:
|
||||
_endTime = micros();
|
||||
}
|
||||
|
||||
uint8_t* getPixels() const
|
||||
uint8_t* getData() const
|
||||
{
|
||||
return _pixels;
|
||||
return _data;
|
||||
};
|
||||
|
||||
size_t getPixelsSize() const
|
||||
size_t getDataSize() const
|
||||
{
|
||||
return _sizePixels;
|
||||
return _sizeData;
|
||||
};
|
||||
|
||||
private:
|
||||
uint32_t _endTime; // Latch timing reference
|
||||
const size_t _sizePixels; // Size of '_pixels' buffer below
|
||||
const size_t _sizeData; // Size of '_data' buffer below
|
||||
|
||||
T_TWOWIRE _wire;
|
||||
uint8_t* _pixels; // Holds LED color values
|
||||
uint32_t _endTime; // Latch timing reference
|
||||
T_TWOWIRE _wire;
|
||||
uint8_t* _data; // Holds LED color values
|
||||
};
|
||||
|
||||
typedef Ws2801MethodBase<TwoWireBitBangImple> NeoWs2801Method;
|
||||
|
Reference in New Issue
Block a user