forked from Makuna/NeoPixelBus
Merge branch 'master' into CORE3
This commit is contained in:
commit
73a2bb0e88
31 files changed
+279
-14
No files matched your search
@@ -330,6 +330,15 @@ public:
|
||||
void SetPixelSettings(const typename T_COLOR_FEATURE::SettingsObject& settings)
|
||||
{
|
||||
T_COLOR_FEATURE::applySettings(_method.getData(), _method.getDataSize(), settings);
|
||||
if (_method.SwapBuffers())
|
||||
{
|
||||
// some methods have two internal buffers
|
||||
// so need to swap so settings are stored in both copies
|
||||
//
|
||||
T_COLOR_FEATURE::applySettings(_method.getData(), _method.getDataSize(), settings);
|
||||
// swap back to minimize inconsistencies
|
||||
_method.SwapBuffers();
|
||||
}
|
||||
Dirty();
|
||||
};
|
||||
|
||||
|
||||
@@ -211,9 +211,8 @@ public:
|
||||
}
|
||||
else
|
||||
{
|
||||
return (-0.5f * (cos(PI * (unitValue-0.5f)) + 1.0f));
|
||||
return (-0.5f * cos(PI * (unitValue - 0.5f)) + 1.0f);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static float ExponentialIn(float unitValue)
|
||||
|
||||
@@ -25,6 +25,7 @@ License along with NeoPixel. If not, see
|
||||
-------------------------------------------------------------------------*/
|
||||
|
||||
#include <Arduino.h>
|
||||
#include "../NeoUtil.h"
|
||||
#include "NeoPixelAnimator.h"
|
||||
|
||||
NeoPixelAnimator::NeoPixelAnimator(uint16_t countAnimations, uint16_t timeScale) :
|
||||
|
||||
@@ -73,4 +73,11 @@ class DotStarLbgr64Feature :
|
||||
{
|
||||
};
|
||||
|
||||
typedef DotStarLbgr64Feature Hd108LbgrFeature;
|
||||
class DotStarLrgb64Feature :
|
||||
public DotStarL4WordFeature<ColorIndexR, ColorIndexG, ColorIndexB>,
|
||||
public NeoElementsNoSettings
|
||||
{
|
||||
};
|
||||
|
||||
typedef DotStarLbgr64Feature Hd108LbgrFeature;
|
||||
typedef DotStarLrgb64Feature Hd108LrgbFeature;
|
||||
@@ -74,4 +74,11 @@ class DotStarBgr48Feature :
|
||||
{
|
||||
};
|
||||
|
||||
class DotStarRgb48Feature :
|
||||
public DotStarX4WordFeature<ColorIndexR, ColorIndexG, ColorIndexB>,
|
||||
public NeoElementsNoSettings
|
||||
{
|
||||
};
|
||||
|
||||
typedef DotStarBgr48Feature Hd108BgrFeature;
|
||||
typedef DotStarRgb48Feature Hd108RgbFeature;
|
||||
@@ -161,14 +161,20 @@ private:
|
||||
|
||||
};
|
||||
|
||||
class Tlc59711RgbFeature :
|
||||
class Tlc59711RgbFeature : // RGB only
|
||||
public Neo3WordFeature<ColorIndexR, ColorIndexG, ColorIndexB>,
|
||||
public Tlc59711ElementsSettings
|
||||
{
|
||||
};
|
||||
|
||||
class Tlc59711RgbwFeature :
|
||||
class Tlc59711RgbwFeature : // RGB + warmer white
|
||||
public Neo4WordFeature<ColorIndexR, ColorIndexG, ColorIndexB, ColorIndexW>,
|
||||
public Tlc59711ElementsSettings
|
||||
{
|
||||
};
|
||||
|
||||
class Tlc59711RgbwcFeature : // RGB + warmer white + cooler white in that order
|
||||
public Neo5WordFeature<ColorIndexR, ColorIndexG, ColorIndexB, ColorIndexWW, ColorIndexCW>,
|
||||
public Tlc59711ElementsSettings
|
||||
{
|
||||
};
|
||||
@@ -1,6 +1,6 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
NeoPixel library helper functions for ARM MCUs.
|
||||
Teensy 3.0, 3.1, LC, Arduino Due
|
||||
Teensy 3.0, 3.1, 3.5, 3.6, 4.0, 4.1, LC, Arduino Due
|
||||
|
||||
Written by Michael C. Miller.
|
||||
Some work taken from the Adafruit NeoPixel library.
|
||||
@@ -97,6 +97,11 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
bool SwapBuffers()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
uint8_t* getData() const
|
||||
{
|
||||
return _data;
|
||||
@@ -119,8 +124,8 @@ private:
|
||||
uint8_t _pin; // output pin number
|
||||
};
|
||||
|
||||
// Teensy 3.0 or 3.1 (3.2) or 3.5 or 3.6
|
||||
#if defined(__MK20DX128__) || defined(__MK20DX256__) || defined(__MK64FX512__) || defined(__MK66FX1M0__)
|
||||
// Teensy
|
||||
#if defined(__MK20DX128__) || defined(__MK20DX256__) || defined(__MK64FX512__) || defined(__MK66FX1M0__) || defined (__IMXRT1062__) || defined (__IMXRT1052__)
|
||||
|
||||
class NeoArmMk20dxSpeedProps800KbpsBase
|
||||
{
|
||||
@@ -199,10 +204,15 @@ public:
|
||||
uint8_t pix;
|
||||
uint8_t mask;
|
||||
|
||||
volatile uint8_t* set = portSetRegister(pin);
|
||||
volatile uint8_t* clr = portClearRegister(pin);
|
||||
volatile auto set = portSetRegister(pin);
|
||||
volatile auto clr = portClearRegister(pin);
|
||||
|
||||
uint32_t cyc;
|
||||
#if defined(KINETISK) || defined(KINETISL)
|
||||
uint8_t msk = 1;
|
||||
#else
|
||||
uint32_t msk = digitalPinToBitMask(pin);
|
||||
#endif
|
||||
|
||||
ARM_DEMCR |= ARM_DEMCR_TRCENA;
|
||||
ARM_DWT_CTRL |= ARM_DWT_CTRL_CYCCNTENA;
|
||||
@@ -216,7 +226,7 @@ public:
|
||||
while (ARM_DWT_CYCCNT - cyc < T_SPEEDPROPS::Cycles);
|
||||
|
||||
cyc = ARM_DWT_CYCCNT;
|
||||
*set = 1;
|
||||
*set = msk;
|
||||
if (pix & mask)
|
||||
{
|
||||
while (ARM_DWT_CYCCNT - cyc < T_SPEEDPROPS::CyclesT1h);
|
||||
@@ -225,7 +235,7 @@ public:
|
||||
{
|
||||
while (ARM_DWT_CYCCNT - cyc < T_SPEEDPROPS::CyclesT0h);
|
||||
}
|
||||
*clr = 1;
|
||||
*clr = msk;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -550,7 +560,7 @@ typedef NeoArm400KbpsMethod NeoArmApa106Method;
|
||||
typedef NeoArmWs2805Method NeoArmWs2814Method;
|
||||
typedef NeoArmTm1814InvertedMethod NeoArmTm1914InvertedMethod;
|
||||
|
||||
#elif defined(ARDUINO_STM32_FEATHER) || defined(ARDUINO_ARCH_STM32L4) || defined(ARDUINO_ARCH_STM32F4) || defined(ARDUINO_ARCH_STM32F1)// FEATHER WICED (120MHz)
|
||||
#elif defined(ARDUINO_ARCH_STM32) || defined(ARDUINO_STM32_FEATHER) || defined(ARDUINO_ARCH_STM32L4) || defined(ARDUINO_ARCH_STM32F4) || defined(ARDUINO_ARCH_STM32F1)// FEATHER WICED (120MHz)
|
||||
|
||||
class NeoArmStm32SpeedProps800KbpsBase
|
||||
{
|
||||
@@ -695,7 +705,21 @@ public:
|
||||
volatile uint32_t* set = &(GPIO->BRR);
|
||||
volatile uint32_t* clr = &(GPIO->BSRR);
|
||||
|
||||
#elif defined(STM32WLE5xx)
|
||||
const unsigned long GPIO_BASE_ADDR = 0x48000000UL;
|
||||
const unsigned long GPIO_BASE_OFFSET = 0x00000400UL;
|
||||
const uint32_t GPIO_NUMBER = 16;
|
||||
|
||||
uint32_t pinMask = 1 << (pin % GPIO_NUMBER);
|
||||
|
||||
GPIO_TypeDef* GPIO = reinterpret_cast<GPIO_TypeDef*>(GPIO_BASE_ADDR + ((pin / GPIO_NUMBER) * GPIO_BASE_OFFSET));
|
||||
|
||||
volatile uint32_t* set = &(GPIO->BRR);
|
||||
volatile uint32_t* clr = &(GPIO->BSRR);
|
||||
#else
|
||||
#error "SPECIFIC STM32 CHIP NOT ACCOUNTED FOR"
|
||||
#endif
|
||||
|
||||
for (;;)
|
||||
{
|
||||
if (p & bitMask)
|
||||
|
||||
@@ -429,6 +429,11 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
bool SwapBuffers()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
uint8_t* getData() const
|
||||
{
|
||||
return _data;
|
||||
|
||||
@@ -244,6 +244,11 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
bool SwapBuffers()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
uint8_t* getData() const
|
||||
{
|
||||
return _data;
|
||||
|
||||
@@ -110,6 +110,11 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
bool SwapBuffers()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
uint8_t* getData() const
|
||||
{
|
||||
return _data;
|
||||
|
||||
@@ -283,6 +283,11 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
bool SwapBuffers()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
uint8_t* getData() const
|
||||
{
|
||||
return _data;
|
||||
|
||||
@@ -841,6 +841,11 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SwapBuffers()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
uint8_t* getData() const
|
||||
{
|
||||
return _data;
|
||||
|
||||
@@ -651,6 +651,12 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
bool SwapBuffers()
|
||||
{
|
||||
std::swap(_dataSending, _dataEditing);
|
||||
return true;
|
||||
}
|
||||
|
||||
uint8_t* getData() const
|
||||
{
|
||||
return _dataEditing;
|
||||
|
||||
@@ -188,6 +188,11 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
bool SwapBuffers()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
uint8_t* getData() const
|
||||
{
|
||||
return _data + _sizeStartFrame;
|
||||
|
||||
@@ -658,6 +658,11 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SwapBuffers()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
uint8_t* getData() const
|
||||
{
|
||||
return _data;
|
||||
|
||||
@@ -271,6 +271,11 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
bool SwapBuffers()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
uint8_t* getData() const
|
||||
{
|
||||
return _data;
|
||||
|
||||
@@ -213,6 +213,11 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
bool SwapBuffers()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
uint8_t* getData() const
|
||||
{
|
||||
return _data + T_SPEED::HeaderSize;
|
||||
|
||||
@@ -205,6 +205,11 @@ protected:
|
||||
ptr = const_cast<uint8_t*>(T_UARTCONTEXT::FillUartFifo(T_UARTFEATURE::Index, ptr, end));
|
||||
}
|
||||
}
|
||||
|
||||
bool SwapUartBuffers()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
// this template method class is used to glue uart feature and context for
|
||||
@@ -274,6 +279,12 @@ protected:
|
||||
std::swap(_dataSending, _data);
|
||||
}
|
||||
|
||||
bool SwapUartBuffers()
|
||||
{
|
||||
std::swap(_dataSending, _data);
|
||||
return true;
|
||||
}
|
||||
|
||||
private:
|
||||
T_UARTCONTEXT _context;
|
||||
|
||||
@@ -420,6 +431,11 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
bool SwapBuffers()
|
||||
{
|
||||
return this->SwapUartBuffers();
|
||||
}
|
||||
|
||||
uint8_t* getData() const
|
||||
{
|
||||
return this->_data;
|
||||
|
||||
@@ -262,6 +262,11 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
bool SwapBuffers()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
uint8_t* getData() const
|
||||
{
|
||||
return _data;
|
||||
|
||||
@@ -78,7 +78,7 @@ public:
|
||||
|
||||
void Update(bool)
|
||||
{
|
||||
const uint8_t startFrame[4] = { 0x00 };
|
||||
const uint8_t startFrame[16] = { 0x00 };
|
||||
const uint8_t endFrame[4] = { 0xff };
|
||||
|
||||
_wire.beginTransaction();
|
||||
@@ -101,6 +101,11 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
bool SwapBuffers()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
uint8_t* getData() const
|
||||
{
|
||||
return _data;
|
||||
|
||||
@@ -106,6 +106,11 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
bool SwapBuffers()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
uint8_t* getData() const
|
||||
{
|
||||
return _data;
|
||||
|
||||
@@ -106,6 +106,11 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
bool SwapBuffers()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
uint8_t* getData() const
|
||||
{
|
||||
return _data;
|
||||
|
||||
@@ -129,6 +129,11 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
bool SwapBuffers()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
uint8_t* getData() const
|
||||
{
|
||||
return _data;
|
||||
|
||||
@@ -102,6 +102,11 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
bool SwapBuffers()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
uint8_t* getData() const
|
||||
{
|
||||
return _data;
|
||||
|
||||
@@ -86,6 +86,11 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SwapBuffers()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
uint8_t* getData() const
|
||||
{
|
||||
return _data;
|
||||
|
||||
@@ -271,6 +271,12 @@ Serial.println();
|
||||
return false;
|
||||
}
|
||||
|
||||
bool SwapBuffers()
|
||||
{
|
||||
std::swap(_dataSending, _dataEditing);
|
||||
return true;
|
||||
}
|
||||
|
||||
uint8_t* getData() const
|
||||
{
|
||||
return _dataEditing;
|
||||
|
||||
@@ -109,6 +109,11 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
bool SwapBuffers()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
uint8_t* getData() const
|
||||
{
|
||||
return _data;
|
||||
|
||||
@@ -170,6 +170,11 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
bool SwapBuffers()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
uint8_t* getData() const
|
||||
{
|
||||
return _data;
|
||||
|
||||
@@ -157,6 +157,11 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
bool SwapBuffers()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
uint8_t* getData() const
|
||||
{
|
||||
return _data;
|
||||
|
||||
@@ -108,6 +108,11 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
bool SwapBuffers()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
uint8_t* getData() const
|
||||
{
|
||||
return _data;
|
||||
|
||||
Reference in new issue
Block a user