diff options
Diffstat (limited to 'FastSPI_LED2.h')
-rw-r--r-- | FastSPI_LED2.h | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/FastSPI_LED2.h b/FastSPI_LED2.h index 1ede0f47..4cb6048b 100644 --- a/FastSPI_LED2.h +++ b/FastSPI_LED2.h @@ -19,9 +19,9 @@ public: static uint8_t adjust(register uint8_t data) { return (data>>1) | 0x80; } }; -template <uint8_t DATA_PIN, uint8_t CLOCK_PIN, uint8_t LATCH_PIN> +template <uint8_t DATA_PIN, uint8_t CLOCK_PIN, uint8_t LATCH_PIN, uint8_t SPI_SPEED = 0 > class LPD8806Controller : public CLEDController { - typedef AVRSPIOutput<DATA_PIN, CLOCK_PIN, LATCH_PIN, 0> SPI; + typedef AVRSPIOutput<DATA_PIN, CLOCK_PIN, LATCH_PIN, SPI_SPEED> SPI; void clearLine(int nLeds) { int n = ((nLeds + 63) >> 6); @@ -51,9 +51,9 @@ public: // ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -template <uint8_t DATA_PIN, uint8_t CLOCK_PIN, uint8_t LATCH_PIN> +template <uint8_t DATA_PIN, uint8_t CLOCK_PIN, uint8_t LATCH_PIN, uint8_t SPI_SPEED = 1> class WS2801Controller : public CLEDController { - typedef AVRSPIOutput<DATA_PIN, CLOCK_PIN, LATCH_PIN, 0> SPI; + typedef AVRSPIOutput<DATA_PIN, CLOCK_PIN, LATCH_PIN, SPI_SPEED> SPI; public: virtual void init() { @@ -69,7 +69,6 @@ public: } }; - ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // // Clockless template instantiations @@ -78,18 +77,30 @@ public: // 500ns, 1500ns, 500ns template <uint8_t DATA_PIN> -class UCS1903Controller400Mhz : public ClocklessController<DATA_PIN, 8, 24, 8> {}; +class UCS1903Controller400Mhz : public ClocklessController<DATA_PIN, NS(500), NS(1500), NS(500)> {}; +#if NO_TIME(500, 1500, 500) +#pragma message "No enough clock cycles available for the UCS103" +#endif // 312.5ns, 312.5ns, 325ns template <uint8_t DATA_PIN> -class TM1809Controller800Mhz : public ClocklessController<DATA_PIN, 5, 5, 10> {}; +class TM1809Controller800Mhz : public ClocklessController<DATA_PIN, NS(350), NS(350), NS(550)> {}; +#if NO_TIME(350, 350, 550) +#pragma message "No enough clock cycles available for the UCS103" +#endif -// 312.5ns, 312.5ns, 325ns +// 380s, 380ns, 725ns template <uint8_t DATA_PIN> -class WS2811Controller800Mhz : public ClocklessController<DATA_PIN, 5, 5, 10> {}; +class WS2811Controller800Mhz : public ClocklessController<DATA_PIN, NS(350), NS(350), NS(550)> {}; +#if NO_TIME(350, 350, 550) +#pragma message "No enough clock cycles available for the UCS103" +#endif // 750NS, 750NS, 750NS template <uint8_t DATA_PIN> -class TM1803Controller400Mhz : public ClocklessController<DATA_PIN, 12, 12, 12> {}; +class TM1803Controller400Mhz : public ClocklessController<DATA_PIN, NS(750), NS(750), NS(750)> {}; +#if NO_TIME(750, 750, 750) +#pragma message "No enough clock cycles available for the UCS103" +#endif #endif
\ No newline at end of file |