Merge branch 'master' into NoRegister

This commit is contained in:
Sam Guyer 2023-05-29 12:04:37 -04:00 committed by GitHub
commit 85137e07ab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 119 additions and 13 deletions

25
CMakeLists.txt Normal file
View File

@ -0,0 +1,25 @@
# FastLED
# https://github.com/FastLED/FastLED
# MIT License
cmake_minimum_required(VERSION 3.5)
set(FastLED_SRCS
src/bitswap.cpp
src/colorpalettes.cpp
src/colorutils.cpp
src/FastLED.cpp
src/hsv2rgb.cpp
src/lib8tion.cpp
src/noise.cpp
src/platforms.cpp
src/power_mgt.cpp
src/wiring.cpp
src/platforms/esp/32/clockless_rmt_esp32.cpp
)
idf_component_register(SRCS ${FastLED_SRCS}
INCLUDE_DIRS "src"
REQUIRES arduino)
project(FastLED)

View File

@ -49,6 +49,7 @@ Here's a list of all the LED chipsets are supported. More details on the LED ch
* TM1809/4 - 3 wire chipset, cheaply available on aliexpress.com
* TM1803 - 3 wire chipset, sold by RadioShack
* UCS1903 - another 3 wire LED chipset, cheap
* DP1903 - another 3 wire LED chipset, cheap
* GW6205 - another 3 wire LED chipset
* LPD8806 - SPI based chipset, very high speed
* WS2801 - SPI based chipset, cheap and widely available

View File

@ -395,6 +395,8 @@ UCS1903 LITERAL1
UCS1903B LITERAL1
UCS1904 LITERAL1
UCS2903 LITERAL1
DP1903 LITERAL1
DP1903_400 LITERAL1
WS2801 LITERAL1
WS2803 LITERAL1
WS2811 LITERAL1

View File

@ -2,7 +2,7 @@ FastLED 3.5.0
=============
This release incorporates dozens of valuable improvements from FastLED contributors, tested and explored by the world-wide FastLED community of artists, creators, and developers. Thank you for all of your time, energy, and help! Here are some of the most significant changes in FastLED 3.5.0:
* Greatly improved ESP32 and ESP8266 support
* Improved board support for Teensy 4, Adafruit MatrixPortal M4, Arduino Nano Every, Partical Photon, and Seeed Wio Terminal
* Improved board support for Teensy 4, Adafruit MatrixPortal M4, Arduino Nano Every, Particle Photon, and Seeed Wio Terminal
* Improved and/or sped up: sin8, cos8, blend8, blur2d, scale8, Perlin/simplex noise
* Improved HSV colors are smoother, richer, and brighter in fill_rainbow and elsewhere
* Modernized and cleaned up the FastLED examples

View File

@ -135,6 +135,8 @@ template<uint8_t DATA_PIN, EOrder RGB_ORDER> class SK6812 : public SK6812Control
template<uint8_t DATA_PIN, EOrder RGB_ORDER> class SK6822 : public SK6822Controller<DATA_PIN, RGB_ORDER> {}; ///< SK6822 controller class. @copydetails SK6822Controller
template<uint8_t DATA_PIN, EOrder RGB_ORDER> class APA106 : public SK6822Controller<DATA_PIN, RGB_ORDER> {}; ///< APA106 controller class. @copydetails SK6822Controller
template<uint8_t DATA_PIN, EOrder RGB_ORDER> class PL9823 : public PL9823Controller<DATA_PIN, RGB_ORDER> {}; ///< @copydoc PL9823Controller
template<uint8_t DATA_PIN, EOrder RGB_ORDER> class DP1903 : public DP1903Controller800Khz<DATA_PIN, RGB_ORDER> {}; ///< @copydoc DP1903Controller800Khz
template<uint8_t DATA_PIN, EOrder RGB_ORDER> class DP1903_400 : public DP1903Controller400Khz<DATA_PIN, RGB_ORDER> {}; ///< @copydoc DP1903Controller400Khz
template<uint8_t DATA_PIN, EOrder RGB_ORDER> class WS2811 : public WS2811Controller800Khz<DATA_PIN, RGB_ORDER> {}; ///< @copydoc WS2811Controller800Khz
template<uint8_t DATA_PIN, EOrder RGB_ORDER> class WS2813 : public WS2813Controller<DATA_PIN, RGB_ORDER> {}; ///< @copydoc WS2813Controller
template<uint8_t DATA_PIN, EOrder RGB_ORDER> class APA104 : public WS2811Controller800Khz<DATA_PIN, RGB_ORDER> {}; ///< APA104 controller class. @copydetails WS2811Controller800Khz
@ -246,7 +248,7 @@ public:
/// @name Adding SPI-based controllers
/// Add an SPI based CLEDController instance to the world.
///
/// There are two ways to call this method (as well as the other addLeds()
/// There are two ways to call this method (as well as the other addLeds()
/// variations). The first is with 2 arguments, in which case the arguments are a pointer to
/// led data, and the number of leds used by this controller. The second is with 3 arguments, in which case
/// the first argument is the same, the second argument is an offset into the CRGB data where this controller's
@ -590,7 +592,7 @@ public:
void showColor(const struct CRGB & color) { showColor(color, m_Scale); }
/// Delay for the given number of milliseconds. Provided to allow the library to be used on platforms
/// that don't have a delay function (to allow code to be more portable).
/// that don't have a delay function (to allow code to be more portable).
/// @note This will call show() constantly to drive the dithering engine (and will call show() at least once).
/// @param ms the number of milliseconds to pause for
void delay(unsigned long ms);

View File

@ -452,7 +452,7 @@ protected:
#ifdef FASTLED_HAS_CLOCKLESS
/// @defgroup ClocklessChipsets Clockless Chipsets
/// These chipsets have only a single data line.
/// These chipsets have only a single data line.
///
/// The clockless chipset controllers use the same base class
/// and the same protocol, but with varying timing periods.
@ -465,7 +465,7 @@ protected:
/// At T=T1+T2+T3 : the cycle is concluded (next bit can be sent)
/// @endcode
///
/// The units used for T1, T2, and T3 is nanoseconds.
/// The units used for T1, T2, and T3 is nanoseconds.
///
/// For 8MHz/16MHz/24MHz frequencies, these values are also guaranteed
/// to be integral multiples of an 8MHz clock (125ns increments).
@ -631,6 +631,14 @@ class UCS2903Controller : public ClocklessController<DATA_PIN, C_NS(250), C_NS(7
template <uint8_t DATA_PIN, EOrder RGB_ORDER = RGB>
class TM1809Controller800Khz : public ClocklessController<DATA_PIN, C_NS(350), C_NS(350), C_NS(450), RGB_ORDER> {};
// DP1903 - 250ns, 1000ns, 250ns
template <uint8_t DATA_PIN, EOrder RGB_ORDER = RGB>
class DP1903Controller800Khz : public ClocklessController<DATA_PIN, C_NS(250), C_NS(1000), C_NS(250), RGB_ORDER> {};
// DP1903@400khz - 500ns, 2000ns, 500ns
template <uint8_t DATA_PIN, EOrder RGB_ORDER = RGB>
class DP1903Controller400Khz : public ClocklessController<DATA_PIN, C_NS(500), C_NS(2000), C_NS(500), RGB_ORDER> {};
// WS2811 - 320ns, 320ns, 640ns
template <uint8_t DATA_PIN, EOrder RGB_ORDER = RGB>
class WS2811Controller800Khz : public ClocklessController<DATA_PIN, C_NS(320), C_NS(320), C_NS(640), RGB_ORDER> {};

View File

@ -61,6 +61,7 @@ extern const TProgmemRGBPalette16 LavaColors_p FL_PROGMEM =
CRGB::Black,
CRGB::Maroon,
CRGB::DarkRed,
CRGB::DarkRed,
CRGB::Maroon,
CRGB::DarkRed,

View File

@ -164,6 +164,10 @@ public:
/// @returns CLEDController::m_nLeds
virtual int size() { return m_nLeds; }
/// How many Lanes does this controller manage?
/// @returns 1 for a non-Parallel controller
virtual int lanes() { return 1; }
/// Pointer to the CRGB array for this controller
/// @returns CLEDController::m_Data
CRGB* leds() { return m_Data; }
@ -441,6 +445,10 @@ struct PixelController {
/// @returns PixelController::mLen
__attribute__((always_inline)) inline int size() { return mLen; }
/// Get the number of lanes of the Controller
/// @returns LANES from template
__attribute__((always_inline)) inline int lanes() { return LANES; }
/// Get the amount to advance the pointer by
/// @returns PixelController::mAdvance
__attribute__((always_inline)) inline int advanceBy() { return mAdvance; }
@ -635,6 +643,10 @@ protected:
public:
CPixelLEDController() : CLEDController() {}
/// Get the number of lanes of the Controller
/// @returns LANES from template
int lanes() { return LANES; }
};

View File

@ -31,7 +31,7 @@
#include "platforms/arm/stm32/led_sysdefs_arm_stm32.h"
#elif defined(__SAMD21G18A__) || defined(__SAMD21J18A__) || defined(__SAMD21E17A__) || defined(__SAMD21E18A__)
#include "platforms/arm/d21/led_sysdefs_arm_d21.h"
#elif defined(__SAMD51G19A__) || defined(__SAMD51J19A__) || defined(__SAMD51P19A__) || defined(__SAMD51P20A__)
#elif defined(__SAMD51G19A__) || defined(__SAMD51J19A__) || defined(__SAME51J19A__) || defined(__SAMD51P19A__) || defined(__SAMD51P20A__)
#include "platforms/arm/d51/led_sysdefs_arm_d51.h"
#elif defined(ARDUINO_ARCH_RP2040) // not sure a pico-sdk define for this
// RP2040 (Raspberry Pi Pico etc)

View File

@ -835,6 +835,18 @@ inline __attribute__((always_inline)) bool operator!= (const CRGB& lhs, const CR
return !(lhs == rhs);
}
/// Check if two CHSV objects have the same color data
inline __attribute__((always_inline)) bool operator== (const CHSV& lhs, const CHSV& rhs)
{
return (lhs.h == rhs.h) && (lhs.s == rhs.s) && (lhs.v == rhs.v);
}
/// Check if two CHSV objects do *not* have the same color data
inline __attribute__((always_inline)) bool operator!= (const CHSV& lhs, const CHSV& rhs)
{
return !(lhs == rhs);
}
/// Check if the sum of the color channels in one CRGB object is less than another
inline __attribute__((always_inline)) bool operator< (const CRGB& lhs, const CRGB& rhs)
{

View File

@ -31,7 +31,7 @@
#include "platforms/arm/stm32/fastled_arm_stm32.h"
#elif defined(__SAMD21G18A__) || defined(__SAMD21J18A__) || defined(__SAMD21E17A__) || defined(__SAMD21E18A__)
#include "platforms/arm/d21/fastled_arm_d21.h"
#elif defined(__SAMD51G19A__) || defined(__SAMD51J19A__) || defined(__SAMD51P19A__)
#elif defined(__SAMD51G19A__) || defined(__SAMD51J19A__) || defined(__SAME51J19A__) || defined(__SAMD51P19A__)
#include "platforms/arm/d51/fastled_arm_d51.h"
#elif defined(ARDUINO_ARCH_RP2040) // not sure a pico-sdk define for this
// RP2040 (Raspberry Pi Pico etc)

View File

@ -107,6 +107,27 @@ _FL_DEFPIN(24, 14, 0); _FL_DEFPIN(25, 13, 0); _FL_DEFPIN(26, 12, 0);
#define HAS_HARDWARE_PIN_SUPPORT 1
#elif defined(ADAFRUIT_FEATHER_M4_CAN)
#define MAX_PIN 19
// D0-D13, including D8 (neopixel) no pins 2 3
_FL_DEFPIN( 0, 17, 1); _FL_DEFPIN( 1, 16, 1);
_FL_DEFPIN( 4, 14, 0); _FL_DEFPIN( 5, 16, 0); _FL_DEFPIN( 6, 18, 0);
_FL_DEFPIN( 7, 3, 1); _FL_DEFPIN( 8, 2, 1); _FL_DEFPIN( 9, 19, 0); _FL_DEFPIN(10, 20, 0); _FL_DEFPIN(11, 21, 0);
_FL_DEFPIN(12, 22, 0); _FL_DEFPIN(13, 23, 0);
// A0-A5
_FL_DEFPIN(14, 2, 0); _FL_DEFPIN(15, 5, 0); _FL_DEFPIN(16, 8, 1); _FL_DEFPIN(17, 9, 1);
_FL_DEFPIN(18, 4, 0); _FL_DEFPIN(19, 6, 0); /* A6 is present in variant.h but couldn't find it on the schematic */
// SDA/SCL
_FL_DEFPIN(21, 12, 0); _FL_DEFPIN(22, 13, 0);
// 23..25 MISO/MOSI/SCK
_FL_DEFPIN(23, 22, 1); _FL_DEFPIN(24, 23, 1); _FL_DEFPIN(25, 17, 0);
#define SPI_DATA 24
#define SPI_CLOCK 25
#define HAS_HARDWARE_PIN_SUPPORT 1
#elif defined(ADAFRUIT_FEATHER_M4_EXPRESS)
#define MAX_PIN 19

View File

@ -80,7 +80,7 @@ public:
template<int BIT> static __attribute__((always_inline)) inline ptr_reg32_t rx() { return GPIO_BITBAND_PTR(T, BIT); } };
#define _FL_IO(L,C) _RD32(REG_PIO ## L ## _ODSR); _RD32(REG_PIO ## L ## _SODR); _RD32(REG_PIO ## L ## _CODR); _RD32(REG_PIO ## L ## _OER); _FL_DEFINE_PORT3(L, C, _R(REG_PIO ## L ## _ODSR));
#define _FL_DEFPIN(PIN, BIT, L) template<> class FastPin<PIN> : public _DUEPIN<PIN, 1 << BIT, _R(REG_PIO ## L ## _ODSR), _R(REG_PIO ## L ## _SODR), _R(REG_PIO ## L ## _CODR), \
#define _FL_DEFPIN(PIN, BIT, L) template<> class FastPin<PIN> : public _DUEPIN<PIN, 1U << BIT, _R(REG_PIO ## L ## _ODSR), _R(REG_PIO ## L ## _SODR), _R(REG_PIO ## L ## _CODR), \
_R(GPIO ## L ## _OER)> {}; \
template<> class FastPinBB<PIN> : public _DUEPIN_BITBAND<PIN, BIT, _R(REG_PIO ## L ## _ODSR), _R(REG_PIO ## L ## _SODR), _R(REG_PIO ## L ## _CODR), \
_R(GPIO ## L ## _OER)> {};

View File

@ -128,6 +128,23 @@ _FL_DEFPIN(4, 4, B); _FL_DEFPIN(5, 5, B);
#define HAS_HARDWARE_PIN_SUPPORT 1
#elif defined(__AVR_ATtiny48__) || defined(__AVR_ATtiny88__)
#define MAX_PIN 27
_FL_DEFPIN( 0, 0, D); _FL_DEFPIN( 1, 1, D); _FL_DEFPIN( 2, 2, D); _FL_DEFPIN( 3, 3, D);
_FL_DEFPIN( 4, 4, D); _FL_DEFPIN( 5, 5, D); _FL_DEFPIN( 6, 6, D); _FL_DEFPIN( 7, 7, D);
_FL_DEFPIN( 8, 0, B); _FL_DEFPIN( 9, 1, B); _FL_DEFPIN(10, 2, B); _FL_DEFPIN(11, 3, B);
_FL_DEFPIN(12, 4, B); _FL_DEFPIN(13, 5, B); _FL_DEFPIN(14, 7, B); _FL_DEFPIN(15, 2, A);
_FL_DEFPIN(16, 3, A); _FL_DEFPIN(17, 0, A); _FL_DEFPIN(18, 1, A); _FL_DEFPIN(19, 0, C);
_FL_DEFPIN(20, 1, C); _FL_DEFPIN(21, 2, C); _FL_DEFPIN(22, 3, C); _FL_DEFPIN(23, 4, C);
_FL_DEFPIN(24, 5, C); _FL_DEFPIN(25, 7, C);
#define SPI_DATA 11
#define SPI_CLOCK 13
#define SPI_SELECT 10
#define AVR_HARDWARE_SPI 1
#define HAS_HARDWARE_PIN_SUPPORT 1
#elif defined(__AVR_ATtiny841__) || defined(__AVR_ATtiny441__)
#define MAX_PIN 11

View File

@ -56,7 +56,7 @@ extern volatile unsigned long timer0_millis;
};
// special defs for the tiny environments
#if defined(__AVR_ATmega32U2__) || defined(__AVR_ATmega16U2__) || defined(__AVR_ATmega8U2__) || defined(__AVR_AT90USB162__) || defined(__AVR_ATtiny24__) || defined(__AVR_ATtiny44__) || defined(__AVR_ATtiny84__) || defined(__AVR_ATtiny25__) || defined(__AVR_ATtiny45__) || defined(__AVR_ATtiny85__) || defined(__AVR_ATtiny167__) || defined(__AVR_ATtiny87__) || defined(__AVR_ATtiny88__) || defined(__AVR_ATtinyX41__) || defined(__AVR_ATtiny841__) || defined(__AVR_ATtiny441__)
#if defined(__AVR_ATmega32U2__) || defined(__AVR_ATmega16U2__) || defined(__AVR_ATmega8U2__) || defined(__AVR_AT90USB162__) || defined(__AVR_ATtiny24__) || defined(__AVR_ATtiny44__) || defined(__AVR_ATtiny84__) || defined(__AVR_ATtiny25__) || defined(__AVR_ATtiny45__) || defined(__AVR_ATtiny85__) || defined(__AVR_ATtiny167__) || defined(__AVR_ATtiny87__) || defined(__AVR_ATtiny48__) || defined(__AVR_ATtiny88__) || defined(__AVR_ATtinyX41__) || defined(__AVR_ATtiny841__) || defined(__AVR_ATtiny441__)
#define LIB8_ATTINY 1
#define FASTLED_NEEDS_YIELD
#endif

View File

@ -108,7 +108,7 @@ public:
// This method is made static to force making register Y available to use for data on AVR - if the method is non-static, then
// gcc will use register Y for the this pointer.
static uint32_t ICACHE_RAM_ATTR showRGBInternal(PixelController<RGB_ORDER, LANES, PORT_MASK> &allpixels) {
static uint32_t IRAM_ATTR showRGBInternal(PixelController<RGB_ORDER, LANES, PORT_MASK> &allpixels) {
// Setup the pixel controller and load/scale the first byte
Lines b0;

View File

@ -53,8 +53,13 @@ protected:
template<int BITS> __attribute__ ((always_inline)) inline static bool writeBits(FASTLED_REGISTER uint32_t & last_mark, FASTLED_REGISTER uint32_t b) {
b <<= 24; b = ~b;
for(FASTLED_REGISTER uint32_t i = BITS; i > 0; --i) {
while((__clock_cycles() - last_mark) < (T1+T2+T3));
last_mark = __clock_cycles();
while((__clock_cycles() - last_mark) < (T1+T2+T3)) {
// the current compiler does like just a ; to end of THIS while loop
// although this change make no sense because below are more of the same while loops without
// compiler warning.
;
}
last_mark = __clock_cycles();
FastPin<DATA_PIN>::hi();
while((__clock_cycles() - last_mark) < T1);
@ -77,7 +82,7 @@ protected:
}
static uint32_t ICACHE_RAM_ATTR showRGBInternal(PixelController<RGB_ORDER> pixels) {
static uint32_t IRAM_ATTR showRGBInternal(PixelController<RGB_ORDER> pixels) {
// Setup the pixel controller and load/scale the first byte
pixels.preStepFirstByteDithering();
FASTLED_REGISTER uint32_t b = pixels.loadAndScale0();