// // picostrip.h // // ILEDStrip on RP2040 / RP2350, driving WS2812B from a PIO state machine. // #ifndef _picostrip_h #define _picostrip_h #include "ledstrip.h" #include "hardware/pio.h" class CPicoLEDStrip : public ILEDStrip { public: CPicoLEDStrip (unsigned nLEDCount, unsigned nPin); ~CPicoLEDStrip (void); bool Initialize (void) override; unsigned GetLEDCount (void) const override { return m_nLEDCount; } void SetLED (unsigned nIndex, uint8_t nRed, uint8_t nGreen, uint8_t nBlue) override; bool Update (void) override; bool Blackout (void) override; private: // Blocks until the strip has latched, so a caller cannot start a new // frame inside the reset window. void WaitForLatch (void); private: unsigned m_nLEDCount; unsigned m_nPin; uint32_t *m_pBuffer; // one GRB word per LED, left-justified PIO m_PIO; unsigned m_nSM; unsigned m_nOffset; bool m_bInitialized; uint64_t m_nLastFrameUs; }; #endif