16#if defined(FASTLED_TEENSY3) && (F_CPU > 48000000)
17#define DATA_RATE_MHZ(X) (((48000000L / 1000000L) / X))
18#define DATA_RATE_KHZ(X) (((48000000L / 1000L) / X))
19#elif defined(FASTLED_TEENSY4) || (defined(ESP32) && defined(FASTLED_ALL_PINS_HARDWARE_SPI)) || (defined(ESP8266) && defined(FASTLED_ALL_PINS_HARDWARE_SPI) || defined(FASTLED_STUB_IMPL))
21#define DATA_RATE_MHZ(X) (1000000 * (X))
22#define DATA_RATE_KHZ(X) (1000 * (X))
25#define DATA_RATE_MHZ(X) ((F_CPU / 1000000L) / X)
27#define DATA_RATE_KHZ(X) ((F_CPU / 1000L) / X)
37FASTLED_NAMESPACE_BEGIN
39#if defined(FASTLED_STUB_IMPL)
42template<u
int8_t _DATA_PIN, u
int8_t _CLOCK_PIN, u
int32_t _SPI_CLOCK_DIVIDER>
48#if !defined(FASTLED_ALL_PINS_HARDWARE_SPI)
50template<u
int8_t _DATA_PIN, u
int8_t _CLOCK_PIN, u
int32_t _SPI_CLOCK_DIVIDER>
55template<u
int8_t _DATA_PIN, u
int8_t _CLOCK_PIN, u
int32_t _SPI_CLOCK_DIVIDER>
58#ifndef FASTLED_FORCE_SOFTWARE_SPI
60#if defined(NRF51) && defined(FASTLED_ALL_PINS_HARDWARE_SPI)
61template<u
int8_t _DATA_PIN, u
int8_t _CLOCK_PIN, u
int32_t _SPI_CLOCK_DIVIDER>
62class SPIOutput :
public NRF51SPIOutput<_DATA_PIN, _CLOCK_PIN, _SPI_CLOCK_DIVIDER> {};
65#if defined(NRF52_SERIES) && defined(FASTLED_ALL_PINS_HARDWARE_SPI)
66template<u
int8_t _DATA_PIN, u
int8_t _CLOCK_PIN, u
int32_t _SPI_CLOCK_DIVIDER>
67class SPIOutput :
public NRF52SPIOutput<_DATA_PIN, _CLOCK_PIN, _SPI_CLOCK_DIVIDER> {};
70#if defined(FASTLED_APOLLO3) && defined(FASTLED_ALL_PINS_HARDWARE_SPI)
71template<u
int8_t _DATA_PIN, u
int8_t _CLOCK_PIN, u
int32_t _SPI_CLOCK_DIVIDER>
72class SPIOutput :
public APOLLO3HardwareSPIOutput<_DATA_PIN, _CLOCK_PIN, _SPI_CLOCK_DIVIDER> {};
75#if defined(ESP32) && defined(FASTLED_ALL_PINS_HARDWARE_SPI)
76template<u
int8_t _DATA_PIN, u
int8_t _CLOCK_PIN, u
int32_t _SPI_CLOCK_DIVIDER>
77class SPIOutput :
public ESP32SPIOutput<_DATA_PIN, _CLOCK_PIN, _SPI_CLOCK_DIVIDER> {};
80#if defined(ESP8266) && defined(FASTLED_ALL_PINS_HARDWARE_SPI)
81template<u
int8_t _DATA_PIN, u
int8_t _CLOCK_PIN, u
int32_t _SPI_CLOCK_DIVIDER>
82class SPIOutput :
public ESP8266SPIOutput<_DATA_PIN, _CLOCK_PIN, _SPI_CLOCK_DIVIDER> {};
88#if defined(SPI_DATA) && defined(SPI_CLOCK)
90#if defined(FASTLED_TEENSY3) && defined(ARM_HARDWARE_SPI)
92template<u
int32_t SPI_SPEED>
93class SPIOutput<SPI_DATA, SPI_CLOCK, SPI_SPEED> :
public ARMHardwareSPIOutput<SPI_DATA, SPI_CLOCK, SPI_SPEED, 0x4002C000> {};
97template<u
int32_t SPI_SPEED>
98class SPIOutput<SPI2_DATA, SPI2_CLOCK, SPI_SPEED> :
public ARMHardwareSPIOutput<SPI2_DATA, SPI2_CLOCK, SPI_SPEED, 0x4002C000> {};
100template<u
int32_t SPI_SPEED>
101class SPIOutput<SPI_DATA, SPI2_CLOCK, SPI_SPEED> :
public ARMHardwareSPIOutput<SPI_DATA, SPI2_CLOCK, SPI_SPEED, 0x4002C000> {};
103template<u
int32_t SPI_SPEED>
104class SPIOutput<SPI2_DATA, SPI_CLOCK, SPI_SPEED> :
public ARMHardwareSPIOutput<SPI2_DATA, SPI_CLOCK, SPI_SPEED, 0x4002C000> {};
107#elif defined(FASTLED_TEENSY4) && defined(ARM_HARDWARE_SPI)
109template<u
int32_t SPI_SPEED>
110class SPIOutput<SPI_DATA, SPI_CLOCK, SPI_SPEED> :
public Teensy4HardwareSPIOutput<SPI_DATA, SPI_CLOCK, SPI_SPEED, SPI, 0> {};
112template<u
int32_t SPI_SPEED>
113class SPIOutput<SPI1_DATA, SPI1_CLOCK, SPI_SPEED> :
public Teensy4HardwareSPIOutput<SPI1_DATA, SPI1_CLOCK, SPI_SPEED, SPI1, 1> {};
115template<u
int32_t SPI_SPEED>
116class SPIOutput<SPI2_DATA, SPI2_CLOCK, SPI_SPEED> :
public Teensy4HardwareSPIOutput<SPI2_DATA, SPI2_CLOCK, SPI_SPEED, SPI2, 2> {};
118#elif defined(FASTLED_TEENSYLC) && defined(ARM_HARDWARE_SPI)
120#define DECLARE_SPI0(__DATA,__CLOCK) template<uint32_t SPI_SPEED>\
121 class SPIOutput<__DATA, __CLOCK, SPI_SPEED> : public ARMHardwareSPIOutput<__DATA, __CLOCK, SPI_SPEED, 0x40076000> {};
122 #define DECLARE_SPI1(__DATA,__CLOCK) template<uint32_t SPI_SPEED>\
123 class SPIOutput<__DATA, __CLOCK, SPI_SPEED> : public ARMHardwareSPIOutput<__DATA, __CLOCK, SPI_SPEED, 0x40077000> {};
137#elif defined(__SAM3X8E__)
139template<u
int32_t SPI_SPEED>
140class SPIOutput<SPI_DATA, SPI_CLOCK, SPI_SPEED> :
public SAMHardwareSPIOutput<SPI_DATA, SPI_CLOCK, SPI_SPEED> {};
142#elif defined(AVR_HARDWARE_SPI)
144template<u
int32_t SPI_SPEED>
145class SPIOutput<SPI_DATA, SPI_CLOCK, SPI_SPEED> :
public AVRHardwareSPIOutput<SPI_DATA, SPI_CLOCK, SPI_SPEED> {};
147#if defined(SPI_UART0_DATA)
149template<u
int32_t SPI_SPEED>
150class SPIOutput<SPI_UART0_DATA, SPI_UART0_CLOCK, SPI_SPEED> :
public AVRUSART0SPIOutput<SPI_UART0_DATA, SPI_UART0_CLOCK, SPI_SPEED> {};
154#if defined(SPI_UART1_DATA)
156template<u
int32_t SPI_SPEED>
157class SPIOutput<SPI_UART1_DATA, SPI_UART1_CLOCK, SPI_SPEED> :
public AVRUSART1SPIOutput<SPI_UART1_DATA, SPI_UART1_CLOCK, SPI_SPEED> {};
161#elif defined(ARDUNIO_CORE_SPI)
163template<u
int32_t SPI_SPEED>
164class SPIOutput<SPI_DATA, SPI_CLOCK, SPI_SPEED> :
public ArdunioCoreSPIOutput<SPI_DATA, SPI_CLOCK, SPI_SPEED, SPI> {};
169# if !defined(FASTLED_INTERNAL) && !defined(FASTLED_ALL_PINS_HARDWARE_SPI) && !defined(ESP32)
170# ifdef FASTLED_HAS_PRAGMA_MESSAGE
171# pragma message "No hardware SPI pins defined. All SPI access will default to bitbanged output"
173# warning "No hardware SPI pins defined. All SPI access will default to bitbanged output"
184# if !defined(FASTLED_INTERNAL) && !defined(FASTLED_ALL_PINS_HARDWARE_SPI)
185# ifdef FASTLED_HAS_PRAGMA_MESSAGE
186# pragma message "Forcing software SPI - no hardware SPI for you!"
188# warning "Forcing software SPI - no hardware SPI for you!"
central include file for FastLED, defines the CFastLED class/object
Software SPI (aka bit-banging) support Includes aggressive optimizations for when the clock and data ...
base definitions used by led controllers for writing out led data
Software SPI (aka bit-banging) support.
Fast, efficient 8-bit math functions specifically designed for high-performance LED programming.