PlatformIO Community

Digispark USB, FastLED won't compile because of undeclared variables

About a year ago, I had no problem using FastLED with a Digispark USB with PIO, using the Arduino framework, but I recently started a new project using this combo. It wouldn’t compile, giving many similar errors, of which the following is one example:

In file included from c:\users\personal\.platformio\packages\toolchain-atmelavr\avr\include\avr\io.h:99:0,
                 from c:\users\personal\.platformio\packages\toolchain-atmelavr\avr\include\avr\interrupt.h:38,
                 from C:\Users\personal\.platformio\packages\framework-arduinoavr\cores\digispark_tiny/WProgram.h:8,
                 from C:\Users\personal\.platformio\packages\framework-arduinoavr\cores\digispark_tiny/Arduino.h:4,
                 from C:\Users\personal\.platformio\packages\framework-arduinoavr\libraries\__cores__\digispark\SPI\SPI.h:17,
                 from C:\Users\personal\.platformio\packages\framework-arduinoavr\libraries\__cores__\digispark\SPI\SPI.cpp:14:
C:\Users\personal\.platformio\packages\framework-arduinoavr\libraries\__cores__\digispark\SPI\SPI.h: In member function 'void SPISettings::init_AlwaysInline(uint32_t, uint8_t, uint8_t)':
C:\Users\personal\.platformio\packages\framework-arduinoavr\libraries\__cores__\digispark\SPI\SPI.h:146:16: error: 'SPE' was not declared in this scope

My platformio.ini looks like this:

platform = atmelavr
board = digispark-tiny
framework = arduino
lib_deps =

After some searching around, I found this issue which indicated that not all preprocessor directives were being evaluated, and suggested a fix of adding lib_ldf_mode = chain+ to the platformio.ini file.

This solved the problem, but I wonder if this is specific to FastLED and the digispark_tiny core, and this one-off solution is the best way to deal with it, or could there be some update to the PIO repo for this core or platform or whatever, which would eliminate the need to find this esoteric issue on a different product’s github page…