Neopixel Library Missing Arduino Defines for Teensy 3.5

Status
Not open for further replies.

cujomalainey

New member
I am trying to build a sketch I have used many times on multiple devices including the teensy 3.2 but it will not compile on the 3.5 (both through the arduino IDE and platformio.) It appears some framework defines for the board are missing.

Soucre code


Library used

Here is the output from teh arduino IDE

Code:
Arduino: 1.8.2 (Mac OS X), TD: 1.37, Board: "Teensy 3.5, Serial, 120 MHz, Faster, US English"

/Users/curtismalainey/Documents/Arduino/libraries/Adafruit_NeoPixel/Adafruit_NeoPixel.cpp: In member function 'void Adafruit_NeoPixel::show()':
/Users/curtismalainey/Documents/Arduino/libraries/Adafruit_NeoPixel/Adafruit_NeoPixel.cpp:1659:3: error: 'Pio' was not declared in this scope
   Pio            *port;
   ^
/Users/curtismalainey/Documents/Arduino/libraries/Adafruit_NeoPixel/Adafruit_NeoPixel.cpp:1659:19: error: 'port' was not declared in this scope
   Pio            *port;
                   ^
/Users/curtismalainey/Documents/Arduino/libraries/Adafruit_NeoPixel/Adafruit_NeoPixel.cpp:1660:12: error: 'WoReg' does not name a type
   volatile WoReg *portSet, *portClear, *timeValue, *timeReset;
            ^
/Users/curtismalainey/Documents/Arduino/libraries/Adafruit_NeoPixel/Adafruit_NeoPixel.cpp:1663:29: error: 'pmc_set_writeprotect' was not declared in this scope
   pmc_set_writeprotect(false);
                             ^
/Users/curtismalainey/Documents/Arduino/libraries/Adafruit_NeoPixel/Adafruit_NeoPixel.cpp:1664:35: error: 'TC3_IRQn' was not declared in this scope
   pmc_enable_periph_clk((uint32_t)TC3_IRQn);
                                   ^
/Users/curtismalainey/Documents/Arduino/libraries/Adafruit_NeoPixel/Adafruit_NeoPixel.cpp:1664:43: error: 'pmc_enable_periph_clk' was not declared in this scope
   pmc_enable_periph_clk((uint32_t)TC3_IRQn);
                                           ^
/Users/curtismalainey/Documents/Arduino/libraries/Adafruit_NeoPixel/Adafruit_NeoPixel.cpp:1665:16: error: 'TC1' was not declared in this scope
   TC_Configure(TC1, 0,
                ^
/Users/curtismalainey/Documents/Arduino/libraries/Adafruit_NeoPixel/Adafruit_NeoPixel.cpp:1666:5: error: 'TC_CMR_WAVE' was not declared in this scope
     TC_CMR_WAVE | TC_CMR_WAVSEL_UP | TC_CMR_TCCLKS_TIMER_CLOCK1);
     ^
/Users/curtismalainey/Documents/Arduino/libraries/Adafruit_NeoPixel/Adafruit_NeoPixel.cpp:1666:19: error: 'TC_CMR_WAVSEL_UP' was not declared in this scope
     TC_CMR_WAVE | TC_CMR_WAVSEL_UP | TC_CMR_TCCLKS_TIMER_CLOCK1);
                   ^
/Users/curtismalainey/Documents/Arduino/libraries/Adafruit_NeoPixel/Adafruit_NeoPixel.cpp:1666:38: error: 'TC_CMR_TCCLKS_TIMER_CLOCK1' was not declared in this scope
     TC_CMR_WAVE | TC_CMR_WAVSEL_UP | TC_CMR_TCCLKS_TIMER_CLOCK1);
                                      ^
/Users/curtismalainey/Documents/Arduino/libraries/Adafruit_NeoPixel/Adafruit_NeoPixel.cpp:1666:64: error: 'TC_Configure' was not declared in this scope
     TC_CMR_WAVE | TC_CMR_WAVSEL_UP | TC_CMR_TCCLKS_TIMER_CLOCK1);
                                                                ^
/Users/curtismalainey/Documents/Arduino/libraries/Adafruit_NeoPixel/Adafruit_NeoPixel.cpp:1667:18: error: 'TC_Start' was not declared in this scope
   TC_Start(TC1, 0);
                  ^
/Users/curtismalainey/Documents/Arduino/libraries/Adafruit_NeoPixel/Adafruit_NeoPixel.cpp:1669:15: error: 'g_APinDescription' was not declared in this scope
   pinMask   = g_APinDescription[pin].ulPin; // Don't 'optimize' these into
               ^
/Users/curtismalainey/Documents/Arduino/libraries/Adafruit_NeoPixel/Adafruit_NeoPixel.cpp:1671:3: error: 'portSet' was not declared in this scope
   portSet   = &(port->PIO_SODR);            // burn a few cycles after
   ^
/Users/curtismalainey/Documents/Arduino/libraries/Adafruit_NeoPixel/Adafruit_NeoPixel.cpp:1672:3: error: 'portClear' was not declared in this scope
   portClear = &(port->PIO_CODR);            // starting timer to minimize
   ^
/Users/curtismalainey/Documents/Arduino/libraries/Adafruit_NeoPixel/Adafruit_NeoPixel.cpp:1673:3: error: 'timeValue' was not declared in this scope
   timeValue = &(TC1->TC_CHANNEL[0].TC_CV);  // the initial 'while'.
   ^
/Users/curtismalainey/Documents/Arduino/libraries/Adafruit_NeoPixel/Adafruit_NeoPixel.cpp:1674:3: error: 'timeReset' was not declared in this scope
   timeReset = &(TC1->TC_CHANNEL[0].TC_CCR);
   ^
/Users/curtismalainey/Documents/Arduino/libraries/Adafruit_NeoPixel/Adafruit_NeoPixel.cpp:1649:22: error: 'VARIANT_MCK' was not declared in this scope
   #define SCALE      VARIANT_MCK / 2UL / 1000000UL
                      ^
/Users/curtismalainey/Documents/Arduino/libraries/Adafruit_NeoPixel/Adafruit_NeoPixel.cpp:1651:36: note: in expansion of macro 'SCALE'
   #define TIME_800_0 ((int)(0.40 * SCALE + 0.5) - (5 * INST))
                                    ^
/Users/curtismalainey/Documents/Arduino/libraries/Adafruit_NeoPixel/Adafruit_NeoPixel.cpp:1683:14: note: in expansion of macro 'TIME_800_0'
     time0  = TIME_800_0;
              ^
/Users/curtismalainey/Documents/Arduino/libraries/Adafruit_NeoPixel/Adafruit_NeoPixel.cpp:1649:22: error: 'VARIANT_MCK' was not declared in this scope
   #define SCALE      VARIANT_MCK / 2UL / 1000000UL
                      ^
Multiple libraries were found for "Adafruit_NeoPixel.h"
 Used: /Users/curtismalainey/Documents/Arduino/libraries/Adafruit_NeoPixel
 Not used: /Applications/Arduino.app/Contents/Java/hardware/teensy/avr/libraries/Adafruit_NeoPixel
/Users/curtismalainey/Documents/Arduino/libraries/Adafruit_NeoPixel/Adafruit_NeoPixel.cpp:1654:36: note: in expansion of macro 'SCALE'
   #define TIME_400_0 ((int)(0.50 * SCALE + 0.5) - (5 * INST))
                                    ^
/Users/curtismalainey/Documents/Arduino/libraries/Adafruit_NeoPixel/Adafruit_NeoPixel.cpp:1688:14: note: in expansion of macro 'TIME_400_0'
     time0  = TIME_400_0;
              ^
/Users/curtismalainey/Documents/Arduino/libraries/Adafruit_NeoPixel/Adafruit_NeoPixel.cpp:1698:18: error: 'TC_CCR_CLKEN' was not declared in this scope
     *timeReset = TC_CCR_CLKEN | TC_CCR_SWTRG;
                  ^
/Users/curtismalainey/Documents/Arduino/libraries/Adafruit_NeoPixel/Adafruit_NeoPixel.cpp:1698:33: error: 'TC_CCR_SWTRG' was not declared in this scope
     *timeReset = TC_CCR_CLKEN | TC_CCR_SWTRG;
                                 ^
/Users/curtismalainey/Documents/Arduino/libraries/Adafruit_NeoPixel/Adafruit_NeoPixel.cpp:1708:17: error: 'TC_Stop' was not declared in this scope
   TC_Stop(TC1, 0);
                 ^
Error compiling for board Teensy 3.5.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
 
You are using your own version of this library as shown in the error messages like:
/Users/curtismalainey/Documents/Arduino/libraries/Adafruit_NeoPixel/Adafruit_NeoPixel.cpp:

Try deleting this version and use the one that is installed as part of Teensyduino...

Did a quick check of the Adafruit version up at: https://github.com/adafruit/Adafruit_NeoPixel/blob/master/Adafruit_NeoPixel.cpp
And it looks like this one has not been updated, nor in a quick check did I see any Pull requests... Would be great if someone did one...

Code:
#if defined(__MK20DX128__) || defined(__MK20DX256__) // Teensy 3.0 & 3.1
 
Re-run the Teensyduino installer, and in the step where optional libraries are installed, make sure you have Adafruit_Neopixel selected. The installer puts a copy for Teensy into the hardware/teensy/avr/libraries.

My guess is you didn't install this, because the error from Arduino isn't telling you there's more than one copy of Adafruit_Neopixel.
 
Ah, I was not aware it installed its own, removing the vanilla library from the library folder did the trick, thanks. Is there any way to load the modified library into platformio outside of loading it into the lib folder in the project?
 
And it looks like this one has not been updated, nor in a quick check did I see any Pull requests... Would be great if someone did one...

I sent a pull request to Adafruit and it looks like they've merged it.

Teensyduino's 1.39-beta2 will have the latest Adafruit_NeoPixel lib with Teensy 3.5 & 3.6 supported.
 
Status
Not open for further replies.
Back
Top