forked from Makuna/NeoPixelBus
PIO2 support (#880)
This commit is contained in:
@@ -50,12 +50,28 @@ public:
|
||||
const PIO Instance;
|
||||
};
|
||||
|
||||
#if NUM_PIOS == 3
|
||||
class NeoRp2040PioInstance2
|
||||
{
|
||||
public:
|
||||
NeoRp2040PioInstance2() :
|
||||
Instance(pio2)
|
||||
{};
|
||||
|
||||
const PIO Instance;
|
||||
};
|
||||
#endif
|
||||
|
||||
// dynamic channel support
|
||||
class NeoRp2040PioInstanceN
|
||||
{
|
||||
public:
|
||||
NeoRp2040PioInstanceN(NeoBusChannel channel) :
|
||||
#if NUM_PIOS == 2
|
||||
Instance(channel == NeoBusChannel_0 ? pio0 : pio1)
|
||||
#elif NUM_PIOS == 3
|
||||
Instance(channel == NeoBusChannel_0 ? pio0 : (channel == NeoBusChannel_1 ? pio1 : pio2))
|
||||
#endif
|
||||
{
|
||||
}
|
||||
NeoRp2040PioInstanceN() = delete; // no default constructor
|
||||
|
@@ -164,7 +164,12 @@ class NeoRp2040PioMonoProgram
|
||||
public:
|
||||
static inline uint add(PIO pio_instance)
|
||||
{
|
||||
size_t index = (pio_instance == pio0) ? 0 : 1;
|
||||
size_t index =
|
||||
#if NUM_PIOS == 2
|
||||
(pio_instance == pio0) ? 0 : 1;
|
||||
#elif NUM_PIOS == 3
|
||||
(pio_instance == pio0) ? 0 : (pio_instance == pio1 ? 1 : 2);
|
||||
#endif
|
||||
if (s_loadedOffset[index] == c_ProgramNotLoaded)
|
||||
{
|
||||
assert(pio_can_add_program(pio_instance, &T_CADENCE::program));
|
||||
@@ -203,10 +208,16 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
static uint s_loadedOffset[2]; // singlet instance of loaded program, one for each PIO hardware unit
|
||||
static uint s_loadedOffset[NUM_PIOS]; // singlet instance of loaded program, one for each PIO hardware unit
|
||||
};
|
||||
|
||||
template<typename T_CADENCE>
|
||||
uint NeoRp2040PioMonoProgram<T_CADENCE>::s_loadedOffset[] = {c_ProgramNotLoaded, c_ProgramNotLoaded};
|
||||
uint NeoRp2040PioMonoProgram<T_CADENCE>::s_loadedOffset[] =
|
||||
#if NUM_PIOS == 2
|
||||
{c_ProgramNotLoaded, c_ProgramNotLoaded};
|
||||
#elif NUM_PIOS == 3
|
||||
{c_ProgramNotLoaded, c_ProgramNotLoaded, c_ProgramNotLoaded};
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
|
@@ -118,13 +118,13 @@ public:
|
||||
if (_sizeData % 4 == 0)
|
||||
{
|
||||
// data is 4 byte aligned in size,
|
||||
// use a 32 bit fifo word for effeciency
|
||||
// use a 32 bit fifo word for efficiency
|
||||
fifoWordBits = 32;
|
||||
}
|
||||
else if (_sizeData % 2 == 0)
|
||||
{
|
||||
// data is 2 byte aligned in size,
|
||||
// use a 16 bit fifo word for effeciency
|
||||
// use a 16 bit fifo word for efficiency
|
||||
fifoWordBits = 16;
|
||||
}
|
||||
|
||||
@@ -364,6 +364,23 @@ typedef NeoRp2040x4MethodBase<NeoRp2040PioSpeed800Kbps, NeoRp2040PioInstance1> R
|
||||
typedef NeoRp2040x4MethodBase<NeoRp2040PioSpeed400Kbps, NeoRp2040PioInstance1> Rp2040x4Pio1400KbpsMethod;
|
||||
typedef Rp2040x4Pio1Ws2805Method Rp2040x4Pio1Ws2814Method;
|
||||
|
||||
#if NUM_PIOS == 3
|
||||
typedef NeoRp2040x4MethodBase<NeoRp2040PioSpeedWs2811, NeoRp2040PioInstance2> Rp2040x4Pio2Ws2811Method;
|
||||
typedef NeoRp2040x4MethodBase<NeoRp2040PioSpeedWs2812x, NeoRp2040PioInstance2> Rp2040x4Pio2Ws2812xMethod;
|
||||
typedef NeoRp2040x4MethodBase<NeoRp2040PioSpeedWs2812x, NeoRp2040PioInstance2> Rp2040x4Pio2Ws2816Method;
|
||||
typedef NeoRp2040x4MethodBase<NeoRp2040PioSpeedWs2805, NeoRp2040PioInstance2> Rp2040x4Pio2Ws2805Method;
|
||||
typedef NeoRp2040x4MethodBase<NeoRp2040PioSpeedSk6812, NeoRp2040PioInstance2> Rp2040x4Pio2Sk6812Method;
|
||||
typedef NeoRp2040x4MethodBase<NeoRp2040PioSpeedTm1814, NeoRp2040PioInstance2, true> Rp2040x4Pio2Tm1814Method;
|
||||
typedef NeoRp2040x4MethodBase<NeoRp2040PioSpeedTm1829, NeoRp2040PioInstance2, true> Rp2040x4Pio2Tm1829Method;
|
||||
typedef NeoRp2040x4MethodBase<NeoRp2040PioSpeedTm1914, NeoRp2040PioInstance2, true> Rp2040x4Pio2Tm1914Method;
|
||||
typedef NeoRp2040x4MethodBase<NeoRp2040PioSpeedApa106, NeoRp2040PioInstance2> Rp2040x4Pio2Apa106Method;
|
||||
typedef NeoRp2040x4MethodBase<NeoRp2040PioSpeedTx1812, NeoRp2040PioInstance2> Rp2040x4Pio2Tx1812Method;
|
||||
typedef NeoRp2040x4MethodBase<NeoRp2040PioSpeedGs1903, NeoRp2040PioInstance2> Rp2040x4Pio2Gs1903Method;
|
||||
typedef NeoRp2040x4MethodBase<NeoRp2040PioSpeed800Kbps, NeoRp2040PioInstance2> Rp2040x4Pio2800KbpsMethod;
|
||||
typedef NeoRp2040x4MethodBase<NeoRp2040PioSpeed400Kbps, NeoRp2040PioInstance2> Rp2040x4Pio2400KbpsMethod;
|
||||
typedef Rp2040x4Pio2Ws2805Method Rp2040x4Pio2Ws2814Method;
|
||||
#endif
|
||||
|
||||
// inverted
|
||||
typedef NeoRp2040x4MethodBase<NeoRp2040PioSpeedWs2811, NeoRp2040PioInstanceN, true> Rp2040x4NWs2811InvertedMethod;
|
||||
typedef NeoRp2040x4MethodBase<NeoRp2040PioSpeedWs2812x, NeoRp2040PioInstanceN, true> Rp2040x4NWs2812xInvertedMethod;
|
||||
@@ -410,6 +427,23 @@ typedef NeoRp2040x4MethodBase<NeoRp2040PioSpeed800Kbps, NeoRp2040PioInstance1, t
|
||||
typedef NeoRp2040x4MethodBase<NeoRp2040PioSpeed400Kbps, NeoRp2040PioInstance1, true> Rp2040x4Pio1400KbpsInvertedMethod;
|
||||
typedef Rp2040x4Pio1Ws2805InvertedMethod Rp2040x4Pio1Ws2814InvertedMethod;
|
||||
|
||||
#if NUM_PIOS == 3
|
||||
typedef NeoRp2040x4MethodBase<NeoRp2040PioSpeedWs2811, NeoRp2040PioInstance2, true> Rp2040x4Pio2Ws2811InvertedMethod;
|
||||
typedef NeoRp2040x4MethodBase<NeoRp2040PioSpeedWs2812x, NeoRp2040PioInstance2, true> Rp2040x4Pio2Ws2812xInvertedMethod;
|
||||
typedef NeoRp2040x4MethodBase<NeoRp2040PioSpeedWs2812x, NeoRp2040PioInstance2, true> Rp2040x4Pio2Ws2816InvertedMethod;
|
||||
typedef NeoRp2040x4MethodBase<NeoRp2040PioSpeedWs2805, NeoRp2040PioInstance2, true> Rp2040x4Pio2Ws2805InvertedMethod;
|
||||
typedef NeoRp2040x4MethodBase<NeoRp2040PioSpeedSk6812, NeoRp2040PioInstance2, true> Rp2040x4Pio2Sk6812InvertedMethod;
|
||||
typedef NeoRp2040x4MethodBase<NeoRp2040PioSpeedTm1814, NeoRp2040PioInstance2> Rp2040x4Pio2Tm1814InvertedMethod;
|
||||
typedef NeoRp2040x4MethodBase<NeoRp2040PioSpeedTm1829, NeoRp2040PioInstance2> Rp2040x4Pio2Tm1829InvertedMethod;
|
||||
typedef NeoRp2040x4MethodBase<NeoRp2040PioSpeedTm1914, NeoRp2040PioInstance2> Rp2040x4Pio2Tm1914InvertedMethod;
|
||||
typedef NeoRp2040x4MethodBase<NeoRp2040PioSpeedApa106, NeoRp2040PioInstance2, true> Rp2040x4Pio2Apa106InvertedMethod;
|
||||
typedef NeoRp2040x4MethodBase<NeoRp2040PioSpeedTx1812, NeoRp2040PioInstance2, true> Rp2040x4Pio2Tx1812InvertedMethod;
|
||||
typedef NeoRp2040x4MethodBase<NeoRp2040PioSpeedGs1903, NeoRp2040PioInstance2, true> Rp2040x4Pio2Gs1903InvertedMethod;
|
||||
typedef NeoRp2040x4MethodBase<NeoRp2040PioSpeed800Kbps, NeoRp2040PioInstance2, true> Rp2040x4Pio2800KbpsInvertedMethod;
|
||||
typedef NeoRp2040x4MethodBase<NeoRp2040PioSpeed400Kbps, NeoRp2040PioInstance2, true> Rp2040x4Pio2400KbpsInvertedMethod;
|
||||
typedef Rp2040x4Pio2Ws2805InvertedMethod Rp2040x4Pio2Ws2814InvertedMethod;
|
||||
#endif
|
||||
|
||||
// PIO 1 method is the default method, and still x4 instances
|
||||
typedef Rp2040x4Pio1Ws2812xMethod NeoWs2813Method;
|
||||
typedef Rp2040x4Pio1Ws2812xMethod NeoWs2812xMethod;
|
||||
|
Reference in New Issue
Block a user