diff --git a/src/internal/methods/Rp2040/NeoRp2040PioInstance.h b/src/internal/methods/Rp2040/NeoRp2040PioInstance.h index d51323b..5fbb12a 100644 --- a/src/internal/methods/Rp2040/NeoRp2040PioInstance.h +++ b/src/internal/methods/Rp2040/NeoRp2040PioInstance.h @@ -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 diff --git a/src/internal/methods/Rp2040/NeoRp2040PioMonoProgram.h b/src/internal/methods/Rp2040/NeoRp2040PioMonoProgram.h index 6ac3fc0..bcd6bfc 100644 --- a/src/internal/methods/Rp2040/NeoRp2040PioMonoProgram.h +++ b/src/internal/methods/Rp2040/NeoRp2040PioMonoProgram.h @@ -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 -uint NeoRp2040PioMonoProgram::s_loadedOffset[] = {c_ProgramNotLoaded, c_ProgramNotLoaded}; +uint NeoRp2040PioMonoProgram::s_loadedOffset[] = +#if NUM_PIOS == 2 + {c_ProgramNotLoaded, c_ProgramNotLoaded}; +#elif NUM_PIOS == 3 + {c_ProgramNotLoaded, c_ProgramNotLoaded, c_ProgramNotLoaded}; +#endif + #endif diff --git a/src/internal/methods/Rp2040/NeoRp2040x4Method.h b/src/internal/methods/Rp2040/NeoRp2040x4Method.h index 8ba02fe..6969ade 100644 --- a/src/internal/methods/Rp2040/NeoRp2040x4Method.h +++ b/src/internal/methods/Rp2040/NeoRp2040x4Method.h @@ -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 R typedef NeoRp2040x4MethodBase Rp2040x4Pio1400KbpsMethod; typedef Rp2040x4Pio1Ws2805Method Rp2040x4Pio1Ws2814Method; +#if NUM_PIOS == 3 +typedef NeoRp2040x4MethodBase Rp2040x4Pio2Ws2811Method; +typedef NeoRp2040x4MethodBase Rp2040x4Pio2Ws2812xMethod; +typedef NeoRp2040x4MethodBase Rp2040x4Pio2Ws2816Method; +typedef NeoRp2040x4MethodBase Rp2040x4Pio2Ws2805Method; +typedef NeoRp2040x4MethodBase Rp2040x4Pio2Sk6812Method; +typedef NeoRp2040x4MethodBase Rp2040x4Pio2Tm1814Method; +typedef NeoRp2040x4MethodBase Rp2040x4Pio2Tm1829Method; +typedef NeoRp2040x4MethodBase Rp2040x4Pio2Tm1914Method; +typedef NeoRp2040x4MethodBase Rp2040x4Pio2Apa106Method; +typedef NeoRp2040x4MethodBase Rp2040x4Pio2Tx1812Method; +typedef NeoRp2040x4MethodBase Rp2040x4Pio2Gs1903Method; +typedef NeoRp2040x4MethodBase Rp2040x4Pio2800KbpsMethod; +typedef NeoRp2040x4MethodBase Rp2040x4Pio2400KbpsMethod; +typedef Rp2040x4Pio2Ws2805Method Rp2040x4Pio2Ws2814Method; +#endif + // inverted typedef NeoRp2040x4MethodBase Rp2040x4NWs2811InvertedMethod; typedef NeoRp2040x4MethodBase Rp2040x4NWs2812xInvertedMethod; @@ -410,6 +427,23 @@ typedef NeoRp2040x4MethodBase Rp2040x4Pio1400KbpsInvertedMethod; typedef Rp2040x4Pio1Ws2805InvertedMethod Rp2040x4Pio1Ws2814InvertedMethod; +#if NUM_PIOS == 3 +typedef NeoRp2040x4MethodBase Rp2040x4Pio2Ws2811InvertedMethod; +typedef NeoRp2040x4MethodBase Rp2040x4Pio2Ws2812xInvertedMethod; +typedef NeoRp2040x4MethodBase Rp2040x4Pio2Ws2816InvertedMethod; +typedef NeoRp2040x4MethodBase Rp2040x4Pio2Ws2805InvertedMethod; +typedef NeoRp2040x4MethodBase Rp2040x4Pio2Sk6812InvertedMethod; +typedef NeoRp2040x4MethodBase Rp2040x4Pio2Tm1814InvertedMethod; +typedef NeoRp2040x4MethodBase Rp2040x4Pio2Tm1829InvertedMethod; +typedef NeoRp2040x4MethodBase Rp2040x4Pio2Tm1914InvertedMethod; +typedef NeoRp2040x4MethodBase Rp2040x4Pio2Apa106InvertedMethod; +typedef NeoRp2040x4MethodBase Rp2040x4Pio2Tx1812InvertedMethod; +typedef NeoRp2040x4MethodBase Rp2040x4Pio2Gs1903InvertedMethod; +typedef NeoRp2040x4MethodBase Rp2040x4Pio2800KbpsInvertedMethod; +typedef NeoRp2040x4MethodBase Rp2040x4Pio2400KbpsInvertedMethod; +typedef Rp2040x4Pio2Ws2805InvertedMethod Rp2040x4Pio2Ws2814InvertedMethod; +#endif + // PIO 1 method is the default method, and still x4 instances typedef Rp2040x4Pio1Ws2812xMethod NeoWs2813Method; typedef Rp2040x4Pio1Ws2812xMethod NeoWs2812xMethod;