forked from Makuna/NeoPixelBus
APA106 Timing Improvements (#406)
This commit is contained in:
@@ -201,8 +201,8 @@ public:
|
|||||||
class NeoEsp32RmtSpeedApa106 : public NeoEsp32RmtSpeedBase
|
class NeoEsp32RmtSpeedApa106 : public NeoEsp32RmtSpeedBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
const static DRAM_ATTR uint32_t RmtBit0 = Item32Val(400, 1250);
|
const static DRAM_ATTR uint32_t RmtBit0 = Item32Val(350, 1350);
|
||||||
const static DRAM_ATTR uint32_t RmtBit1 = Item32Val(1250, 400);
|
const static DRAM_ATTR uint32_t RmtBit1 = Item32Val(1350, 350);
|
||||||
const static DRAM_ATTR uint16_t RmtDurationReset = FromNs(50000); // 50us
|
const static DRAM_ATTR uint16_t RmtDurationReset = FromNs(50000); // 50us
|
||||||
|
|
||||||
static void IRAM_ATTR Translate(const void* src,
|
static void IRAM_ATTR Translate(const void* src,
|
||||||
@@ -307,8 +307,8 @@ public:
|
|||||||
class NeoEsp32RmtInvertedSpeedApa106 : public NeoEsp32RmtInvertedSpeedBase
|
class NeoEsp32RmtInvertedSpeedApa106 : public NeoEsp32RmtInvertedSpeedBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
const static DRAM_ATTR uint32_t RmtBit0 = Item32Val(400, 1250);
|
const static DRAM_ATTR uint32_t RmtBit0 = Item32Val(350, 1350);
|
||||||
const static DRAM_ATTR uint32_t RmtBit1 = Item32Val(1250, 400);
|
const static DRAM_ATTR uint32_t RmtBit1 = Item32Val(1350, 350);
|
||||||
const static DRAM_ATTR uint16_t RmtDurationReset = FromNs(50000); // 50us
|
const static DRAM_ATTR uint16_t RmtDurationReset = FromNs(50000); // 50us
|
||||||
|
|
||||||
static void IRAM_ATTR Translate(const void* src,
|
static void IRAM_ATTR Translate(const void* src,
|
||||||
|
@@ -71,6 +71,14 @@ public:
|
|||||||
const static uint32_t Period = (F_CPU / 400000 - CYCLES_LOOPTEST);
|
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
|
class NeoEspPinset
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -218,6 +226,11 @@ public:
|
|||||||
static const uint32_t ResetTimeUs = 50;
|
static const uint32_t ResetTimeUs = 50;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class NeoEspBitBangSpeedApa106 : public NeoEspBitBangBase<NeoEspSpeedApa106, NeoEspPinset>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
static const uint32_t ResetTimeUs = 50;
|
||||||
|
};
|
||||||
|
|
||||||
class NeoEspBitBangInvertedSpeedWs2811 : public NeoEspBitBangBase<NeoEspSpeedWs2811, NeoEspPinsetInverted>
|
class NeoEspBitBangInvertedSpeedWs2811 : public NeoEspBitBangBase<NeoEspSpeedWs2811, NeoEspPinsetInverted>
|
||||||
{
|
{
|
||||||
@@ -256,6 +269,12 @@ public:
|
|||||||
static const uint32_t ResetTimeUs = 50;
|
static const uint32_t ResetTimeUs = 50;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class NeoEspBitBangInvertedSpeedApa106 : public NeoEspBitBangBase<NeoEspSpeedApa106, NeoEspPinsetInverted>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
static const uint32_t ResetTimeUs = 50;
|
||||||
|
};
|
||||||
|
|
||||||
template<typename T_SPEED, typename T_PINSET> class NeoEspBitBangMethodBase
|
template<typename T_SPEED, typename T_PINSET> class NeoEspBitBangMethodBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -352,11 +371,11 @@ typedef NeoEspBitBangMethodBase<NeoEspBitBangSpeedSk6812, NeoEspPinset> NeoEsp32
|
|||||||
typedef NeoEspBitBangMethodBase<NeoEspBitBangSpeedTm1814, NeoEspPinsetInverted> NeoEsp32BitBangTm1814Method;
|
typedef NeoEspBitBangMethodBase<NeoEspBitBangSpeedTm1814, NeoEspPinsetInverted> NeoEsp32BitBangTm1814Method;
|
||||||
typedef NeoEspBitBangMethodBase<NeoEspBitBangSpeed800Kbps, NeoEspPinset> NeoEsp32BitBang800KbpsMethod;
|
typedef NeoEspBitBangMethodBase<NeoEspBitBangSpeed800Kbps, NeoEspPinset> NeoEsp32BitBang800KbpsMethod;
|
||||||
typedef NeoEspBitBangMethodBase<NeoEspBitBangSpeed400Kbps, NeoEspPinset> NeoEsp32BitBang400KbpsMethod;
|
typedef NeoEspBitBangMethodBase<NeoEspBitBangSpeed400Kbps, NeoEspPinset> NeoEsp32BitBang400KbpsMethod;
|
||||||
|
typedef NeoEspBitBangMethodBase<NeoEspBitBangSpeedApa106, NeoEspPinset> NeoEsp32BitBangApa106Method;
|
||||||
|
|
||||||
typedef NeoEsp32BitBangWs2812xMethod NeoEsp32BitBangWs2813Method;
|
typedef NeoEsp32BitBangWs2812xMethod NeoEsp32BitBangWs2813Method;
|
||||||
typedef NeoEsp32BitBang800KbpsMethod NeoEsp32BitBangWs2812Method;
|
typedef NeoEsp32BitBang800KbpsMethod NeoEsp32BitBangWs2812Method;
|
||||||
typedef NeoEsp32BitBangSk6812Method NeoEsp32BitBangLc8812Method;
|
typedef NeoEsp32BitBangSk6812Method NeoEsp32BitBangLc8812Method;
|
||||||
typedef NeoEsp32BitBang400KbpsMethod NeoEsp32BitBangApa106Method;
|
|
||||||
|
|
||||||
typedef NeoEspBitBangMethodBase<NeoEspBitBangInvertedSpeedWs2811, NeoEspPinsetInverted> NeoEsp32BitBangWs2811InvertedMethod;
|
typedef NeoEspBitBangMethodBase<NeoEspBitBangInvertedSpeedWs2811, NeoEspPinsetInverted> NeoEsp32BitBangWs2811InvertedMethod;
|
||||||
typedef NeoEspBitBangMethodBase<NeoEspBitBangInvertedSpeedWs2812x, NeoEspPinsetInverted> NeoEsp32BitBangWs2812xInvertedMethod;
|
typedef NeoEspBitBangMethodBase<NeoEspBitBangInvertedSpeedWs2812x, NeoEspPinsetInverted> NeoEsp32BitBangWs2812xInvertedMethod;
|
||||||
@@ -364,11 +383,11 @@ typedef NeoEspBitBangMethodBase<NeoEspBitBangInvertedSpeedSk6812, NeoEspPinsetIn
|
|||||||
typedef NeoEspBitBangMethodBase<NeoEspBitBangInvertedSpeedTm1814, NeoEspPinset> NeoEsp32BitBangTm1814InvertedMethod;
|
typedef NeoEspBitBangMethodBase<NeoEspBitBangInvertedSpeedTm1814, NeoEspPinset> NeoEsp32BitBangTm1814InvertedMethod;
|
||||||
typedef NeoEspBitBangMethodBase<NeoEspBitBangInvertedSpeed800Kbps, NeoEspPinsetInverted> NeoEsp32BitBang800KbpsInvertedMethod;
|
typedef NeoEspBitBangMethodBase<NeoEspBitBangInvertedSpeed800Kbps, NeoEspPinsetInverted> NeoEsp32BitBang800KbpsInvertedMethod;
|
||||||
typedef NeoEspBitBangMethodBase<NeoEspBitBangInvertedSpeed400Kbps, NeoEspPinsetInverted> NeoEsp32BitBang400KbpsInvertedMethod;
|
typedef NeoEspBitBangMethodBase<NeoEspBitBangInvertedSpeed400Kbps, NeoEspPinsetInverted> NeoEsp32BitBang400KbpsInvertedMethod;
|
||||||
|
typedef NeoEspBitBangMethodBase<NeoEspBitBangInvertedSpeedApa106, NeoEspPinsetInverted> NeoEsp32BitBangApa106InvertedMethod;
|
||||||
|
|
||||||
typedef NeoEsp32BitBangWs2812xInvertedMethod NeoEsp32BitBangWs2813InvertedMethod;
|
typedef NeoEsp32BitBangWs2812xInvertedMethod NeoEsp32BitBangWs2813InvertedMethod;
|
||||||
typedef NeoEsp32BitBang800KbpsInvertedMethod NeoEsp32BitBangWs2812InvertedMethod;
|
typedef NeoEsp32BitBang800KbpsInvertedMethod NeoEsp32BitBangWs2812InvertedMethod;
|
||||||
typedef NeoEsp32BitBangSk6812InvertedMethod NeoEsp32BitBangLc8812InvertedMethod;
|
typedef NeoEsp32BitBangSk6812InvertedMethod NeoEsp32BitBangLc8812InvertedMethod;
|
||||||
typedef NeoEsp32BitBang400KbpsInvertedMethod NeoEsp32BitBangApa106InvertedMethod;
|
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
@@ -378,11 +397,11 @@ typedef NeoEspBitBangMethodBase<NeoEspBitBangSpeedSk6812, NeoEspPinset> NeoEsp82
|
|||||||
typedef NeoEspBitBangMethodBase<NeoEspBitBangSpeedTm1814, NeoEspPinsetInverted> NeoEsp8266BitBangTm1814Method;
|
typedef NeoEspBitBangMethodBase<NeoEspBitBangSpeedTm1814, NeoEspPinsetInverted> NeoEsp8266BitBangTm1814Method;
|
||||||
typedef NeoEspBitBangMethodBase<NeoEspBitBangSpeed800Kbps, NeoEspPinset> NeoEsp8266BitBang800KbpsMethod;
|
typedef NeoEspBitBangMethodBase<NeoEspBitBangSpeed800Kbps, NeoEspPinset> NeoEsp8266BitBang800KbpsMethod;
|
||||||
typedef NeoEspBitBangMethodBase<NeoEspBitBangSpeed400Kbps, NeoEspPinset> NeoEsp8266BitBang400KbpsMethod;
|
typedef NeoEspBitBangMethodBase<NeoEspBitBangSpeed400Kbps, NeoEspPinset> NeoEsp8266BitBang400KbpsMethod;
|
||||||
|
typedef NeoEspBitBangMethodBase<NeoEspBitBangSpeedApa106, NeoEspPinset> NeoEsp8266BitBangApa106Method;
|
||||||
|
|
||||||
typedef NeoEsp8266BitBangWs2812xMethod NeoEsp8266BitBangWs2813Method;
|
typedef NeoEsp8266BitBangWs2812xMethod NeoEsp8266BitBangWs2813Method;
|
||||||
typedef NeoEsp8266BitBang800KbpsMethod NeoEsp8266BitBangWs2812Method;
|
typedef NeoEsp8266BitBang800KbpsMethod NeoEsp8266BitBangWs2812Method;
|
||||||
typedef NeoEsp8266BitBangSk6812Method NeoEsp8266BitBangLc8812Method;
|
typedef NeoEsp8266BitBangSk6812Method NeoEsp8266BitBangLc8812Method;
|
||||||
typedef NeoEsp8266BitBang400KbpsMethod NeoEsp8266BitBangApa106Method;
|
|
||||||
|
|
||||||
typedef NeoEspBitBangMethodBase<NeoEspBitBangInvertedSpeedWs2811, NeoEspPinsetInverted> NeoEsp8266BitBangWs2811InvertedMethod;
|
typedef NeoEspBitBangMethodBase<NeoEspBitBangInvertedSpeedWs2811, NeoEspPinsetInverted> NeoEsp8266BitBangWs2811InvertedMethod;
|
||||||
typedef NeoEspBitBangMethodBase<NeoEspBitBangInvertedSpeedWs2812x, NeoEspPinsetInverted> NeoEsp8266BitBangWs2812xInvertedMethod;
|
typedef NeoEspBitBangMethodBase<NeoEspBitBangInvertedSpeedWs2812x, NeoEspPinsetInverted> NeoEsp8266BitBangWs2812xInvertedMethod;
|
||||||
@@ -390,11 +409,12 @@ typedef NeoEspBitBangMethodBase<NeoEspBitBangInvertedSpeedSk6812, NeoEspPinsetIn
|
|||||||
typedef NeoEspBitBangMethodBase<NeoEspBitBangInvertedSpeedTm1814, NeoEspPinset> NeoEsp8266BitBangTm1814InvertedMethod;
|
typedef NeoEspBitBangMethodBase<NeoEspBitBangInvertedSpeedTm1814, NeoEspPinset> NeoEsp8266BitBangTm1814InvertedMethod;
|
||||||
typedef NeoEspBitBangMethodBase<NeoEspBitBangInvertedSpeed800Kbps, NeoEspPinsetInverted> NeoEsp8266BitBang800KbpsInvertedMethod;
|
typedef NeoEspBitBangMethodBase<NeoEspBitBangInvertedSpeed800Kbps, NeoEspPinsetInverted> NeoEsp8266BitBang800KbpsInvertedMethod;
|
||||||
typedef NeoEspBitBangMethodBase<NeoEspBitBangInvertedSpeed400Kbps, NeoEspPinsetInverted> NeoEsp8266BitBang400KbpsInvertedMethod;
|
typedef NeoEspBitBangMethodBase<NeoEspBitBangInvertedSpeed400Kbps, NeoEspPinsetInverted> NeoEsp8266BitBang400KbpsInvertedMethod;
|
||||||
|
typedef NeoEspBitBangMethodBase<NeoEspBitBangInvertedSpeedApa106, NeoEspPinsetInverted> NeoEsp8266BitBangApa106InvertedMethod;
|
||||||
|
|
||||||
typedef NeoEsp8266BitBangWs2812xInvertedMethod NeoEsp8266BitBangWs2813InvertedMethod;
|
typedef NeoEsp8266BitBangWs2812xInvertedMethod NeoEsp8266BitBangWs2813InvertedMethod;
|
||||||
typedef NeoEsp8266BitBang800KbpsInvertedMethod NeoEsp8266BitBangWs2812InvertedMethod;
|
typedef NeoEsp8266BitBang800KbpsInvertedMethod NeoEsp8266BitBangWs2812InvertedMethod;
|
||||||
typedef NeoEsp8266BitBangSk6812InvertedMethod NeoEsp8266BitBangLc8812InvertedMethod;
|
typedef NeoEsp8266BitBangSk6812InvertedMethod NeoEsp8266BitBangLc8812InvertedMethod;
|
||||||
typedef NeoEsp8266BitBang400KbpsInvertedMethod NeoEsp8266BitBangApa106InvertedMethod;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// ESP bitbang doesn't have defaults and should avoided except for testing
|
// ESP bitbang doesn't have defaults and should avoided except for testing
|
||||||
|
@@ -102,12 +102,13 @@ public:
|
|||||||
const static PinStatus IdleLevel = LOW;
|
const static PinStatus IdleLevel = LOW;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// count 1 = 0.0625us, so max count (32768) is 2048us
|
||||||
class NeoNrf52xPwmSpeedApa106
|
class NeoNrf52xPwmSpeedApa106
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
const static uint32_t CountTop = 26UL; // 1.65us
|
const static uint32_t CountTop = 26UL; // ~1.525us (target is 1.65us)
|
||||||
const static nrf_pwm_values_common_t Bit0 = 6 | 0x8000; // ~0.4us
|
const static nrf_pwm_values_common_t Bit0 = 6 | 0x8000; // ~0.375us (target is 0.35)
|
||||||
const static nrf_pwm_values_common_t Bit1 = 20 | 0x8000; // ~1.25us
|
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 nrf_pwm_values_common_t BitReset = 0x8000; // LOW
|
||||||
const static uint32_t CountReset = 40; // 50us / 1.25us pulse width
|
const static uint32_t CountReset = 40; // 50us / 1.25us pulse width
|
||||||
const static PinStatus IdleLevel = LOW;
|
const static PinStatus IdleLevel = LOW;
|
||||||
@@ -182,9 +183,9 @@ public:
|
|||||||
class NeoNrf52xPwmInvertedSpeedApa106
|
class NeoNrf52xPwmInvertedSpeedApa106
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
const static uint32_t CountTop = 26UL; // 1.65us
|
const static uint32_t CountTop = 26UL; // ~1.525us (target is 1.65us)
|
||||||
const static nrf_pwm_values_common_t Bit0 = 6; // ~0.4us
|
const static nrf_pwm_values_common_t Bit0 = 6; // ~0.375us (target is 0.35)
|
||||||
const static nrf_pwm_values_common_t Bit1 = 20; // ~1.25us
|
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 nrf_pwm_values_common_t BitReset = 0x0000; // HIGH
|
||||||
const static uint32_t CountReset = 40; // 50us / 1.25us pulse width
|
const static uint32_t CountReset = 40; // 50us / 1.25us pulse width
|
||||||
const static PinStatus IdleLevel = HIGH;
|
const static PinStatus IdleLevel = HIGH;
|
||||||
|
Reference in New Issue
Block a user