3.1.8 Trinket M0 support question.

3.1.8 Trinket M0 support question. On this board there is an onboard APA102 led connected to pins 7 (data) and 8 (clock). It seems those pins are not defined in FastLED.

FastLED.addLeds<APA102, 7, 8>(leds, 1);

returns the following https://pastebin.com/4Vrh5pa0

“Invalid pin specified”

This would be a question for @Daniel_Garcia . I would suggest opening a new issue for this here:

Don’t exactly know what the correct addition would be, but if you’re up for trying to test it out yourself look at lines 158, 159 in this file. I think this is where you would add those additional pins.

https://github.com/FastLED/FastLED/blob/master/platforms/arm/d21/fastpin_arm_d21.h

I manually added the pins in fastpin_arm_d21.h :

#elif defined(ADAFRUIT_TRINKET_M0)

#define MAX_PIN 7
_DEFPIN_ARM( 0, 0, 8); _DEFPIN_ARM( 1, 0, 2); _DEFPIN_ARM( 2, 0, 9);
_DEFPIN_ARM( 3, 0, 7); _DEFPIN_ARM( 4, 0, 6); _DEFPIN_ARM( 7, 0, 0); _DEFPIN_ARM( 8, 0, 1);

#define SPI_DATA 4
#define SPI_CLOCK 3

#define HAS_HARDWARE_PIN_SUPPORT 1

#endif

It works. Thanks Marc!

@ Frank Marcotte: I’m also having the same problem trying to use the Dot Star on the Trinket M0. How did you add the pins to FastLED?

@Alex_superdude First, make sure you are using the latest version of FastLED (3.1.8). Then, you have to manually modify the file fastpin_arm_d21.h as follows :

(you can find this file by searching for it, mine is in C:\Users\Franck\Documents\Arduino\libraries\FastLED-3.1.8\platforms\arm\d21)

Search the file for this keyword : ADAFRUIT_TRINKET_M0

Update the code with the following :

#elif defined(ADAFRUIT_TRINKET_M0)

#define MAX_PIN 7
_DEFPIN_ARM( 0, 0, 8); _DEFPIN_ARM( 1, 0, 2); _DEFPIN_ARM( 2, 0, 9);
_DEFPIN_ARM( 3, 0, 7); _DEFPIN_ARM( 4, 0, 6); _DEFPIN_ARM( 7, 0, 0); _DEFPIN_ARM( 8, 0, 1);

#define SPI_DATA 4
#define SPI_CLOCK 3

#define HAS_HARDWARE_PIN_SUPPORT 1

#endif

Then, to use the DotStar led, use this code :

//declare this globally
CRGB M0DotStar[1] = {CRGB::Yellow};

//declare this in setup()
FastLED.addLeds<APA102, 7, 8>(M0DotStar, 1);

Et voila!

Thank You Very much Franck Marcotte, I’ll give it a try!!

@ Frank Marcotte…Thank You very much the Dot Star works!! But when I tried your simple code in the setup area and nothing in the loop area nothing happens, but when I added this code in the loop I get a Red Dot Star not a Blue Dot Star.

M0DotStar[0] = CRGB::Blue;
FastLED.show();
delay(30);

White color seems to work

Oh the color order is reversed, I never actually used the led I just set it to black when booting. Try this instead

FastLED.addLeds<DOTSTAR, 7, 8>(M0DotStar, 1);

For what I need the Dot Star for, your Fix is more than what I need Thanks again Frank Marcotte!! :slight_smile:

Anytime, super dude!