diff options
-rw-r--r-- | FastLED.h | 12 | ||||
-rw-r--r-- | chipsets.h | 5 | ||||
-rw-r--r-- | fastspi_nop.h | 33 | ||||
-rw-r--r-- | platforms/arm/k20/clockless_arm_k20.h | 2 | ||||
-rw-r--r-- | platforms/arm/k20/clockless_block_arm_k20.h | 2 | ||||
-rw-r--r-- | platforms/arm/sam/clockless_arm_sam.h | 1 | ||||
-rw-r--r-- | platforms/arm/sam/clockless_block_arm_sam.h | 2 | ||||
-rw-r--r-- | platforms/avr/clockless_trinket.h | 2 |
8 files changed, 28 insertions, 31 deletions
@@ -65,6 +65,7 @@ enum ESPIChipsets { enum ESM { SMART_MATRIX }; enum OWS2811 { OCTOWS2811 }; +#ifdef FASTLED_HAS_CLOCKLESS template<uint8_t DATA_PIN> class NEOPIXEL : public WS2812Controller800Khz<DATA_PIN, GRB> {}; template<uint8_t DATA_PIN, EOrder RGB_ORDER> class TM1829 : public TM1829Controller800Khz<DATA_PIN, RGB_ORDER> {}; template<uint8_t DATA_PIN, EOrder RGB_ORDER> class TM1809 : public TM1809Controller800Khz<DATA_PIN, RGB_ORDER> {}; @@ -87,11 +88,7 @@ template<uint8_t DATA_PIN, EOrder RGB_ORDER> class DMXSIMPLE : public DMXSimpleC #ifdef DmxSerial_h template<EOrder RGB_ORDER> class DMXSERIAL : public DMXSerialController<RGB_ORDER> {}; #endif - -// template <uint8_t DATA_PIN, uint8_t CLOCK_PIN, EOrder RGB_ORDER = RGB, uint8_t SPI_SPEED = DATA_RATE_MHZ(20)> class LPD8806 : public LPD8806Controller<DATA_PIN, CLOCK_PIN, RGB_ORDER, SPI_SPEED> {}; -// template <uint8_t DATA_PIN, uint8_t CLOCK_PIN, EOrder RGB_ORDER = RGB, uint8_t SPI_SPEED = DATA_RATE_MHZ(1)> class WS2801 : public WS2801Controller<DATA_PIN, CLOCK_PIN, RGB_ORDER, SPI_SPEED> {}; -// template <uint8_t DATA_PIN, uint8_t CLOCK_PIN, EOrder RGB_ORDER = RGB, uint8_t SPI_SPEED = DATA_RATE_MHZ(15)> class P9813 : public P9813Controller<DATA_PIN, CLOCK_PIN, RGB_ORDER, SPI_SPEED> {}; -// template <uint8_t DATA_PIN, uint8_t CLOCK_PIN, EOrder RGB_ORDER = RGB, uint8_t SPI_SPEED = DATA_RATE_MHZ(16)> class SM16716 : public SM16716Controller<DATA_PIN, CLOCK_PIN, RGB_ORDER, SPI_SPEED> {}; +#endif enum EBlockChipsets { #ifdef PORTA_FIRST_PIN @@ -215,6 +212,7 @@ public: #endif //@} +#ifdef FASTLED_HAS_CLOCKLESS /// @name Adding 3-wire led controllers //@{ /// Add a clockless (aka 3wire, also DMX) based CLEDController instance to the world. @@ -261,7 +259,7 @@ public: } #endif //@} - +#endif /// @name Adding 3rd party library controllers //@{ @@ -322,7 +320,7 @@ public: //@} -#ifdef HAS_BLOCKLESS +#ifdef FASTLED_HAS_BLOCKLESS /// @name adding parallel output controllers //@{ @@ -240,7 +240,7 @@ protected: mSPI.select(); startBoundary(); - for(int i = 0; i < nLeds; i++) { + for(int i = 0; i < nLeds; i++) { writeLed(pixels.loadAndScale0(), pixels.loadAndScale1(), pixels.loadAndScale2()); pixels.stepDithering(); } @@ -444,6 +444,7 @@ protected: // ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +#ifdef FASTLED_HAS_CLOCKLESS // We want to force all avr's to use the Trinket controller when running at 8Mhz, because even the 328's at 8Mhz // need the more tightly defined timeframes. #if (F_CPU == 8000000 || F_CPU == 16000000 || F_CPU == 24000000) // || F_CPU == 48000000 || F_CPU == 96000000) // 125ns/clock @@ -575,3 +576,5 @@ class LPD1886Controller1250Khz : public ClocklessController<DATA_PIN, NS(200), N #endif #endif + +#endif diff --git a/fastspi_nop.h b/fastspi_nop.h index 64cd5128..e9cd4aa7 100644 --- a/fastspi_nop.h +++ b/fastspi_nop.h @@ -6,13 +6,14 @@ // idea of interfaces - it's possible this could be done with virtual classes, need to decide if i want that overhead) template <uint8_t _DATA_PIN, uint8_t _CLOCK_PIN, uint8_t _SPI_CLOCK_DIVIDER> class NOPSPIOutput { + Selectable *m_pSelect; public: - NOPSPIOutput() { /* TODO */ } - NOPSPIOutput(Selectable *pSelect) { /* TODO */ } + NOPSPIOutput() { m_pSelect = NULL; } + NOPSPIOutput(Selectable *pSelect) { m_pSelect = pSelect; } // set the object representing the selectable - void setSelect(Selectable *pSelect) { /* TODO */ } + void setSelect(Selectable *pSelect) { m_pSelect = pSelect; } // initialize the SPI subssytem void init() { /* TODO */ } @@ -20,19 +21,22 @@ public: // latch the CS select void select() { /* TODO */ } - // release the CS select + // release the CS select void release() { /* TODO */ } // wait until all queued up data has been written void waitFully(); - + + // not the most efficient mechanism in the world - but should be enough for sm16716 and friends + template <uint8_t BIT> inline static void writeBit(uint8_t b) { /* TODO */ + // write a byte out via SPI (returns immediately on writing register) void writeByte(uint8_t b) { /* TODO */ } // write a word out via SPI (returns immediately on writing register) void writeWord(uint16_t w) { /* TODO */ } // A raw set of writing byte values, assumes setup/init/waiting done elsewhere (static for use by adjustment classes) - static void writeBytesValueRaw(uint8_t value, int len) { /* TODO */ } + static void writeBytesValueRaw(uint8_t value, int len) { /* TODO */ } // A full cycle of writing a value for len bytes, including select, release, and waiting void writeBytesValue(uint8_t value, int len) { /* TODO */ } @@ -43,21 +47,8 @@ public: // write a single bit out, which bit from the passed in byte is determined by template parameter template <uint8_t BIT> inline static void writeBit(uint8_t b) { /* TODO */ } - template <uint8_t SKIP, class D, EOrder RGB_ORDER> void writeBytes3(register uint8_t *data, int len, register uint8_t scale) { /* TODO*/ } - - // template instantiations for writeBytes 3 - template <uint8_t SKIP, EOrder RGB_ORDER> void writeBytes3(register uint8_t *data, int len, register uint8_t scale) { - writeBytes3<SKIP, DATA_NOP, RGB_ORDER>(data, len, scale); - } - template <class D, EOrder RGB_ORDER> void writeBytes3(register uint8_t *data, int len, register uint8_t scale) { - writeBytes3<0, D, RGB_ORDER>(data, len, scale); - } - template <EOrder RGB_ORDER> void writeBytes3(register uint8_t *data, int len, register uint8_t scale) { - writeBytes3<0, DATA_NOP, RGB_ORDER>(data, len, scale); - } - void writeBytes3(register uint8_t *data, int len, register uint8_t scale) { - writeBytes3<0, DATA_NOP, RGB>(data, len, scale); + template <uint8_t FLAGS, class D, EOrder RGB_ORDER> void writePixels(PixelController<RGB_ORDER> pixels) { /* TODO */ } }; -#endif
\ No newline at end of file +#endif diff --git a/platforms/arm/k20/clockless_arm_k20.h b/platforms/arm/k20/clockless_arm_k20.h index 4987b336..caeffc41 100644 --- a/platforms/arm/k20/clockless_arm_k20.h +++ b/platforms/arm/k20/clockless_arm_k20.h @@ -5,6 +5,8 @@ // See clockless.h for detailed info on how the template parameters are used. #if defined(FASTLED_TEENSY3) +#define FASTLED_HAS_CLOCKLESS 1 + template <int DATA_PIN, int T1, int T2, int T3, EOrder RGB_ORDER = RGB, int XTRA0 = 0, bool FLIP = false, int WAIT_TIME = 50> class ClocklessController : public CLEDController { typedef typename FastPin<DATA_PIN>::port_ptr_t data_ptr_t; diff --git a/platforms/arm/k20/clockless_block_arm_k20.h b/platforms/arm/k20/clockless_block_arm_k20.h index fb0bf1b3..a24f00f2 100644 --- a/platforms/arm/k20/clockless_block_arm_k20.h +++ b/platforms/arm/k20/clockless_block_arm_k20.h @@ -4,7 +4,7 @@ // Definition for a single channel clockless controller for the k20 family of chips, like that used in the teensy 3.0/3.1 // See clockless.h for detailed info on how the template parameters are used. #if defined(FASTLED_TEENSY3) -#define HAS_BLOCKLESS 1 +#define FASTLED_HAS_BLOCKLESS 1 #define PORTC_FIRST_PIN 15 #define PORTD_FIRST_PIN 2 diff --git a/platforms/arm/sam/clockless_arm_sam.h b/platforms/arm/sam/clockless_arm_sam.h index ebc8c0ad..66cd12db 100644 --- a/platforms/arm/sam/clockless_arm_sam.h +++ b/platforms/arm/sam/clockless_arm_sam.h @@ -14,6 +14,7 @@ #define SCALE(S,V) scale8_video(S,V) // #define SCALE(S,V) scale8(S,V) +#define FASTLED_HAS_CLOCKLESS 1 template <uint8_t DATA_PIN, int T1, int T2, int T3, EOrder RGB_ORDER = RGB, int XTRA0 = 0, bool FLIP = false, int WAIT_TIME = 50> class ClocklessController : public CLEDController { diff --git a/platforms/arm/sam/clockless_block_arm_sam.h b/platforms/arm/sam/clockless_block_arm_sam.h index 128617a2..5d175b69 100644 --- a/platforms/arm/sam/clockless_block_arm_sam.h +++ b/platforms/arm/sam/clockless_block_arm_sam.h @@ -12,7 +12,7 @@ #if defined(__SAM3X8E__) #define PORT_MASK (((1<<LANES)-1) & ((FIRST_PIN==2) ? 0xFF : 0xFF)) -#define HAS_BLOCKLESS 1 +#define FASTLED_HAS_BLOCKLESS 1 #define PORTD_FIRST_PIN 25 #define PORTA_FIRST_PIN 69 diff --git a/platforms/avr/clockless_trinket.h b/platforms/avr/clockless_trinket.h index 07b56ca0..4ef0b0e9 100644 --- a/platforms/avr/clockless_trinket.h +++ b/platforms/avr/clockless_trinket.h @@ -67,6 +67,8 @@ template<> __attribute__((always_inline)) inline void _dc<10>(register uint8_t & static uint8_t gTimeErrorAccum256ths; #endif +#define FASTLED_HAS_CLOCKLESS 1 + template <uint8_t DATA_PIN, int T1, int T2, int T3, EOrder RGB_ORDER = RGB, int XTRA0 = 0, bool FLIP = false, int WAIT_TIME = 10> class ClocklessController : public CLEDController { typedef typename FastPin<DATA_PIN>::port_ptr_t data_ptr_t; |