WS2805 WS2814 (#794)

This commit is contained in:
Michael Miller authored and GitHub committed 2024-04-06 21:49:54 -07:00
1 parent a56929531e
commit b8f33709aa
11 files changed
+153 -64

No files matched your search

+35 -20
View File
@@ -139,10 +139,10 @@ public:
class NeoArmMk20dxSpeedPropsWs2805
{
public:
static const uint32_t CyclesT0h = (F_CPU / 4000000);
static const uint32_t CyclesT1h = (F_CPU / 913750);
static const uint32_t Cycles = (F_CPU / 584800);
static const uint32_t ResetTimeUs = 300;
static const uint32_t CyclesT0h = (F_CPU / 3333333);
static const uint32_t CyclesT1h = (F_CPU / 1265822);
static const uint32_t Cycles = (F_CPU / 917431);
static const uint32_t ResetTimeUs = 300; // spec is 280, intentionally longer for compatiblity use
};
class NeoArmMk20dxSpeedPropsSk6812 : public NeoArmMk20dxSpeedProps800KbpsBase
@@ -239,7 +239,7 @@ typedef NeoArmMethodBase<NeoArmMk20dxSpeedBase<NeoArmMk20dxSpeedPropsTm1829>> Ne
typedef NeoArmMethodBase<NeoArmMk20dxSpeedBase<NeoArmMk20dxSpeedPropsApa106>> NeoArmApa106Method;
typedef NeoArmMethodBase<NeoArmMk20dxSpeedBase<NeoArmMk20dxSpeedProps800Kbps>> NeoArm800KbpsMethod;
typedef NeoArmMethodBase<NeoArmMk20dxSpeedBase<NeoArmMk20dxSpeedProps400Kbps>> NeoArm400KbpsMethod;
typedef NeoArmWs2805Method NeoArmWs2814Method;
typedef NeoArmTm1814InvertedMethod NeoArmTm1914InvertedMethod;
#elif defined(__MKL26Z64__) // Teensy-LC
@@ -373,37 +373,42 @@ typedef NeoArmMethodBase<NeoArmMk26z64SpeedTm1829> NeoArmTm1829InvertedMethod;
typedef NeoArmMethodBase<NeoArmMk26z64Speed800Kbps> NeoArm800KbpsMethod;
typedef NeoArm800KbpsMethod NeoArmApa106Method;
typedef NeoArmWs2812xMethod NeoArmWs2805Method;
typedef NeoArmWs2805Method NeoArmWs2814Method;
typedef NeoArmTm1814InvertedMethod NeoArmTm1914InvertedMethod;
#else
#error "Teensy-LC: Sorry, only 48 MHz is supported, please set Tools > CPU Speed to 48 MHz"
#endif // F_CPU == 48000000
#elif defined(__SAMD21G18A__) // Arduino Zero
#elif defined(__SAMD21G18A__) // Arduino Zero, SEEED XIAO
class NeoArmSamd21g18aSpeedProps800KbpsBase
{
public:
// should match Zero Bit TH
static void BitPreWait()
{
asm("nop; nop; nop; nop; nop; nop; nop; nop;");
asm("nop; nop; nop; nop; nop; nop; ");
}
// should match One Bit TH - BitPreWait (with pin clear after)
static void BitT1hWait()
{
asm("nop; nop; nop; nop; nop; nop; nop; nop;"
"nop; nop; nop; nop; nop; nop; nop; nop;"
"nop; nop; nop; nop;");
"nop; ");
}
// should match Zero Bit TL - BitPreWait (with pin clear before)
static void BitT0lWait()
{
asm("nop; nop; nop; nop; nop; nop; nop; nop;"
"nop; nop; nop; nop; nop; nop; nop; nop;"
"nop; nop; nop; nop;");
"nop; ");
}
// this should match cycles it takes to prepare next byte
static void BitPostWait()
{
asm("nop; nop; nop; nop; nop; nop; nop; nop; nop;");
asm("nop; nop; nop; nop; nop;");
}
};
@@ -441,10 +446,12 @@ public:
class NeoArmSamd21g18aSpeedProps400KbpsBase
{
public:
// should match Zero Bit TH
static void BitPreWait()
{
asm("nop; nop; nop; nop; nop; nop; nop; nop; nop; nop; nop;");
}
// should match One Bit TH - BitPreWait (with pin clear after)
static void BitT1hWait()
{
asm("nop; nop; nop; nop; nop; nop; nop; nop;"
@@ -452,6 +459,7 @@ public:
"nop; nop; nop; nop; nop; nop; nop; nop;"
"nop; nop; nop;");
}
// should match Zero Bit TL - BitPreWait (with pin clear before)
static void BitT0lWait()
{
asm("nop; nop; nop; nop; nop; nop; nop; nop;"
@@ -459,6 +467,7 @@ public:
"nop; nop; nop; nop; nop; nop; nop; nop;"
"nop; nop; nop;");
}
// this should match cycles it takes to prepare next byte
static void BitPostWait()
{
asm("nop; nop; nop; nop; nop; nop; nop;");
@@ -471,10 +480,10 @@ public:
static const uint32_t ResetTimeUs = 50;
};
class NeoArmSamd21g18aSpeedPropsWs2805 : public NeoArmSamd21g18aSpeedProps400KbpsBase
class NeoArmSamd21g18aSpeedPropsWs2805 : public NeoArmSamd21g18aSpeedProps800KbpsBase
{
public:
static const uint32_t ResetTimeUs = 300;
static const uint32_t ResetTimeUs = 300; // spec is 280, intentionally longer for compatiblity use
};
template<typename T_SPEEDPROPS> class NeoArmSamd21g18aSpeedBase
@@ -511,7 +520,9 @@ public:
*clr = pinMask;
T_SPEEDPROPS::BitT0lWait();
}
if (bitMask >>= 1)
bitMask >>= 1;
if (bitMask)
{
T_SPEEDPROPS::BitPostWait();
}
@@ -536,6 +547,7 @@ typedef NeoArmMethodBase<NeoArmSamd21g18aSpeedBase<NeoArmSamd21g18aSpeedPropsTm1
typedef NeoArmMethodBase<NeoArmSamd21g18aSpeedBase<NeoArmSamd21g18aSpeedProps800Kbps>> NeoArm800KbpsMethod;
typedef NeoArmMethodBase<NeoArmSamd21g18aSpeedBase<NeoArmSamd21g18aSpeedProps400Kbps>> NeoArm400KbpsMethod;
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)
@@ -732,6 +744,7 @@ typedef NeoArmMethodBase<NeoArmStm32SpeedBase<NeoArmStm32SpeedPropsTm1829>> NeoA
typedef NeoArmMethodBase<NeoArmStm32SpeedBase<NeoArmStm32SpeedProps800Kbps>> NeoArm800KbpsMethod;
typedef NeoArm800KbpsMethod NeoArmApa106Method;
typedef NeoArmWs2812xMethod NeoArmWs2805Method;
typedef NeoArmWs2805Method NeoArmWs2814Method;
typedef NeoArmTm1814InvertedMethod NeoArmTm1914InvertedMethod;
#else // Other ARM architecture -- Presumed Arduino Due
@@ -757,10 +770,10 @@ public:
class NeoArmOtherSpeedPropsWs2805
{
public:
static const uint32_t CyclesT0h = static_cast<uint32_t>((0.35 * ARM_OTHER_SCALE + 0.5) - (5 * ARM_OTHER_INST));
static const uint32_t CyclesT1h = static_cast<uint32_t>((1.35 * ARM_OTHER_SCALE + 0.5) - (5 * ARM_OTHER_INST));
static const uint32_t Cycles = static_cast<uint32_t>((1.70 * ARM_OTHER_SCALE + 0.5) - (5 * ARM_OTHER_INST));
static const uint32_t ResetTimeUs = 300;
static const uint32_t CyclesT0h = static_cast<uint32_t>((0.30 * ARM_OTHER_SCALE + 0.5) - (5 * ARM_OTHER_INST));
static const uint32_t CyclesT1h = static_cast<uint32_t>((0.79 * ARM_OTHER_SCALE + 0.5) - (5 * ARM_OTHER_INST));
static const uint32_t Cycles = static_cast<uint32_t>((1.09 * ARM_OTHER_SCALE + 0.5) - (5 * ARM_OTHER_INST));
static const uint32_t ResetTimeUs = 300; // spec is 280, intentionally longer for compatiblity use
};
class NeoArmOtherSpeedPropsSk6812 : public NeoArmOtherSpeedProps800KbpsBase
@@ -880,6 +893,7 @@ typedef NeoArmMethodBase<NeoArmOtherSpeedBase<NeoArmOtherSpeedPropsTm1829>> NeoA
typedef NeoArmMethodBase<NeoArmOtherSpeedBase<NeoArmOtherSpeedProps800Kbps>> NeoArm800KbpsMethod;
typedef NeoArmMethodBase<NeoArmOtherSpeedBase<NeoArmOtherSpeedProps400Kbps>> NeoArm400KbpsMethod;
typedef NeoArm400KbpsMethod NeoArmApa106Method;
typedef NeoArmWs2805Method NeoArmWs2814Method;
typedef NeoArmTm1814InvertedMethod NeoArmTm1914InvertedMethod;
#endif
@@ -891,14 +905,15 @@ typedef NeoArmWs2812xMethod NeoWs2812xMethod;
typedef NeoArmWs2812xMethod NeoWs2811Method;
typedef NeoArmWs2812xMethod NeoWs2816Method;
typedef NeoArmWs2805Method NeoWs2805Method;
typedef NeoArmWs2805Method NeoWs2814Method;
typedef NeoArmSk6812Method NeoSk6812Method;
typedef NeoArmSk6812Method NeoLc8812Method;
typedef NeoArm800KbpsMethod NeoWs2812Method;
typedef NeoArmApa106Method NeoApa106Method;
typedef NeoArmWs2812xMethod Neo800KbpsMethod;
#ifdef NeoArm400KbpsMethod // this is needed due to missing 400Kbps for some platforms
typedef NeoArm400KbpsMethod Neo400KbpsMethod;
#endif
//typedef NeoArm400KbpsMethod Neo400KbpsMethod; // due to missing 400Kbps for some platforms
// there is no non-invert methods for arm, but the norm for TM1814 is inverted, so
typedef NeoArmTm1814InvertedMethod NeoTm1814InvertedMethod;
typedef NeoArmTm1914InvertedMethod NeoTm1914InvertedMethod;