diff --git a/src/internal/NeoEsp32RmtMethod.h b/src/internal/NeoEsp32RmtMethod.h index da77d48..3f33958 100644 --- a/src/internal/NeoEsp32RmtMethod.h +++ b/src/internal/NeoEsp32RmtMethod.h @@ -201,8 +201,8 @@ public: class NeoEsp32RmtSpeedApa106 : public NeoEsp32RmtSpeedBase { public: - const static DRAM_ATTR uint32_t RmtBit0 = Item32Val(400, 1250); - const static DRAM_ATTR uint32_t RmtBit1 = Item32Val(1250, 400); + const static DRAM_ATTR uint32_t RmtBit0 = Item32Val(350, 1350); + const static DRAM_ATTR uint32_t RmtBit1 = Item32Val(1350, 350); const static DRAM_ATTR uint16_t RmtDurationReset = FromNs(50000); // 50us static void IRAM_ATTR Translate(const void* src, @@ -307,8 +307,8 @@ public: class NeoEsp32RmtInvertedSpeedApa106 : public NeoEsp32RmtInvertedSpeedBase { public: - const static DRAM_ATTR uint32_t RmtBit0 = Item32Val(400, 1250); - const static DRAM_ATTR uint32_t RmtBit1 = Item32Val(1250, 400); + const static DRAM_ATTR uint32_t RmtBit0 = Item32Val(350, 1350); + const static DRAM_ATTR uint32_t RmtBit1 = Item32Val(1350, 350); const static DRAM_ATTR uint16_t RmtDurationReset = FromNs(50000); // 50us static void IRAM_ATTR Translate(const void* src, diff --git a/src/internal/NeoEspBitBangMethod.h b/src/internal/NeoEspBitBangMethod.h index 506adb7..cf43120 100644 --- a/src/internal/NeoEspBitBangMethod.h +++ b/src/internal/NeoEspBitBangMethod.h @@ -71,6 +71,14 @@ public: const static uint32_t Period = (F_CPU / 400000 - CYCLES_LOOPTEST); }; +class NeoEspSpeedApa106 +{ +public: + const static uint32_t T0H = (F_CPU / 2857143 - CYCLES_LOOPTEST); // 0.35us + const static uint32_t T1H = (F_CPU / 740741 - CYCLES_LOOPTEST); // 1.35 + const static uint32_t Period = (F_CPU / 606061 - CYCLES_LOOPTEST); // 1.65us +}; + class NeoEspPinset { public: @@ -218,6 +226,11 @@ public: static const uint32_t ResetTimeUs = 50; }; +class NeoEspBitBangSpeedApa106 : public NeoEspBitBangBase +{ +public: + static const uint32_t ResetTimeUs = 50; +}; class NeoEspBitBangInvertedSpeedWs2811 : public NeoEspBitBangBase { @@ -256,6 +269,12 @@ public: static const uint32_t ResetTimeUs = 50; }; +class NeoEspBitBangInvertedSpeedApa106 : public NeoEspBitBangBase +{ +public: + static const uint32_t ResetTimeUs = 50; +}; + template class NeoEspBitBangMethodBase { public: @@ -352,11 +371,11 @@ typedef NeoEspBitBangMethodBase NeoEsp32 typedef NeoEspBitBangMethodBase NeoEsp32BitBangTm1814Method; typedef NeoEspBitBangMethodBase NeoEsp32BitBang800KbpsMethod; typedef NeoEspBitBangMethodBase NeoEsp32BitBang400KbpsMethod; +typedef NeoEspBitBangMethodBase NeoEsp32BitBangApa106Method; typedef NeoEsp32BitBangWs2812xMethod NeoEsp32BitBangWs2813Method; typedef NeoEsp32BitBang800KbpsMethod NeoEsp32BitBangWs2812Method; typedef NeoEsp32BitBangSk6812Method NeoEsp32BitBangLc8812Method; -typedef NeoEsp32BitBang400KbpsMethod NeoEsp32BitBangApa106Method; typedef NeoEspBitBangMethodBase NeoEsp32BitBangWs2811InvertedMethod; typedef NeoEspBitBangMethodBase NeoEsp32BitBangWs2812xInvertedMethod; @@ -364,11 +383,11 @@ typedef NeoEspBitBangMethodBase NeoEsp32BitBangTm1814InvertedMethod; typedef NeoEspBitBangMethodBase NeoEsp32BitBang800KbpsInvertedMethod; typedef NeoEspBitBangMethodBase NeoEsp32BitBang400KbpsInvertedMethod; +typedef NeoEspBitBangMethodBase NeoEsp32BitBangApa106InvertedMethod; typedef NeoEsp32BitBangWs2812xInvertedMethod NeoEsp32BitBangWs2813InvertedMethod; typedef NeoEsp32BitBang800KbpsInvertedMethod NeoEsp32BitBangWs2812InvertedMethod; typedef NeoEsp32BitBangSk6812InvertedMethod NeoEsp32BitBangLc8812InvertedMethod; -typedef NeoEsp32BitBang400KbpsInvertedMethod NeoEsp32BitBangApa106InvertedMethod; #else @@ -378,11 +397,11 @@ typedef NeoEspBitBangMethodBase NeoEsp82 typedef NeoEspBitBangMethodBase NeoEsp8266BitBangTm1814Method; typedef NeoEspBitBangMethodBase NeoEsp8266BitBang800KbpsMethod; typedef NeoEspBitBangMethodBase NeoEsp8266BitBang400KbpsMethod; +typedef NeoEspBitBangMethodBase NeoEsp8266BitBangApa106Method; typedef NeoEsp8266BitBangWs2812xMethod NeoEsp8266BitBangWs2813Method; typedef NeoEsp8266BitBang800KbpsMethod NeoEsp8266BitBangWs2812Method; typedef NeoEsp8266BitBangSk6812Method NeoEsp8266BitBangLc8812Method; -typedef NeoEsp8266BitBang400KbpsMethod NeoEsp8266BitBangApa106Method; typedef NeoEspBitBangMethodBase NeoEsp8266BitBangWs2811InvertedMethod; typedef NeoEspBitBangMethodBase NeoEsp8266BitBangWs2812xInvertedMethod; @@ -390,11 +409,12 @@ typedef NeoEspBitBangMethodBase NeoEsp8266BitBangTm1814InvertedMethod; typedef NeoEspBitBangMethodBase NeoEsp8266BitBang800KbpsInvertedMethod; typedef NeoEspBitBangMethodBase NeoEsp8266BitBang400KbpsInvertedMethod; +typedef NeoEspBitBangMethodBase NeoEsp8266BitBangApa106InvertedMethod; typedef NeoEsp8266BitBangWs2812xInvertedMethod NeoEsp8266BitBangWs2813InvertedMethod; typedef NeoEsp8266BitBang800KbpsInvertedMethod NeoEsp8266BitBangWs2812InvertedMethod; typedef NeoEsp8266BitBangSk6812InvertedMethod NeoEsp8266BitBangLc8812InvertedMethod; -typedef NeoEsp8266BitBang400KbpsInvertedMethod NeoEsp8266BitBangApa106InvertedMethod; + #endif // ESP bitbang doesn't have defaults and should avoided except for testing diff --git a/src/internal/NeoNrf52xMethod.h b/src/internal/NeoNrf52xMethod.h index b8810ea..41f19a6 100644 --- a/src/internal/NeoNrf52xMethod.h +++ b/src/internal/NeoNrf52xMethod.h @@ -102,12 +102,13 @@ public: const static PinStatus IdleLevel = LOW; }; +// count 1 = 0.0625us, so max count (32768) is 2048us class NeoNrf52xPwmSpeedApa106 { public: - const static uint32_t CountTop = 26UL; // 1.65us - const static nrf_pwm_values_common_t Bit0 = 6 | 0x8000; // ~0.4us - const static nrf_pwm_values_common_t Bit1 = 20 | 0x8000; // ~1.25us + const static uint32_t CountTop = 26UL; // ~1.525us (target is 1.65us) + const static nrf_pwm_values_common_t Bit0 = 6 | 0x8000; // ~0.375us (target is 0.35) + const static nrf_pwm_values_common_t Bit1 = 21 | 0x8000; // ~1.3125us (target is 1.350) const static nrf_pwm_values_common_t BitReset = 0x8000; // LOW const static uint32_t CountReset = 40; // 50us / 1.25us pulse width const static PinStatus IdleLevel = LOW; @@ -182,9 +183,9 @@ public: class NeoNrf52xPwmInvertedSpeedApa106 { public: - const static uint32_t CountTop = 26UL; // 1.65us - const static nrf_pwm_values_common_t Bit0 = 6; // ~0.4us - const static nrf_pwm_values_common_t Bit1 = 20; // ~1.25us + const static uint32_t CountTop = 26UL; // ~1.525us (target is 1.65us) + const static nrf_pwm_values_common_t Bit0 = 6; // ~0.375us (target is 0.35) + const static nrf_pwm_values_common_t Bit1 = 21; // ~1.3125us (target is 1.350) const static nrf_pwm_values_common_t BitReset = 0x0000; // HIGH const static uint32_t CountReset = 40; // 50us / 1.25us pulse width const static PinStatus IdleLevel = HIGH;