Hi All. I'm attempting to call the version of addLeds defined by the 3rd

Hi All.

I’m attempting to call the version of addLeds defined by the 3rd template in this group from FastLED.h:

#ifdef SPI_DATA
template static CLEDController &addLeds(struct CRGB *data, int nLedsOrOffset, int nLedsIfOffset = 0) {
return addLeds<CHIPSET, SPI_DATA, SPI_CLOCK, RGB>(data, nLedsOrOffset, nLedsIfOffset);
}

template<ESPIChipsets CHIPSET, EOrder RGB_ORDER> static CLEDController &addLeds(struct CRGB *data, int nLedsOrOffset, int nLedsIfOffset = 0) {
	return addLeds<CHIPSET, SPI_DATA, SPI_CLOCK, RGB_ORDER>(data, nLedsOrOffset, nLedsIfOffset);
}

template<ESPIChipsets CHIPSET, EOrder RGB_ORDER, uint8_t SPI_DATA_RATE> static CLEDController &addLeds(struct CRGB *data, int nLedsOrOffset, int nLedsIfOffset = 0) {
	return addLeds<CHIPSET, SPI_DATA, SPI_CLOCK, RGB_ORDER, SPI_DATA_RATE>(data, nLedsOrOffset, nLedsIfOffset);
}

#endif

The line in my code is:
LEDS.addLeds<APA102, RGB, 10>(leds, NUM_LEDS);
Since template’s SPI_DATA_RATE is declared a uint8_t, I’m guessing that the frequency is in MHz.

However, compiler is complaining with:
“call of overloaded ‘addLeds(CRGB [120], int, int)’ is ambiguous”

The Board is a Teensy 3.2 with the APA102 LEDs connected to its default SPI clock and data pins.

Appreciate any help on getting this to work.

Thanks in advance.

PS: an invocation of the first template above does work:
LEDS.addLeds(leds, NUM_LEDS);

https://github.com/FastLED/FastLED/wiki/SPI-Hardware-or-Bit-banging talks about how to do this - with some compiler setups, if you want to set the data rate you have to be explicit about the clock/data pins (has to do with the way compilers are handling template parameters, and I haven’t had a chance to find a way to trick them into doing what I want).

Also - you need to use the DATA_RATE_MHZ or DATA_RATE_KHZ macros - you can’t just put a 10 in there and have it work like you’d expect :slight_smile: