Hihi, I am porting a piece of code form the adafruit neopixel library to

Hihi,
I am porting a piece of code form the adafruit neopixel library to FastLed.
The catch is…
I am running it on a SAM4S4A ( I ported the Due SAM3X arduino files for the SAM4, all except USB… )
inside AVR Studio 6.2 ( ARM/GNU C Compiler : 4.8.3 )
I am getting the following error and Can’t figure it out :frowning:

\FastLED\fastpin.h(22,11): error: ‘RwReg’ does not name a type
volatile RwReg *mPort;
^

even though its defined in led_sysdefs.h as
typedef volatile uint8_t RwReg;

I get the same for

This is more likely going to be easier on the FastLED3.1 branch, if only because the code/file layout is a bit easier to follow.

The problem is that FastLED, if it doesn’t know/recognize the platform you’re building on defaults/drops back to AVR. However, that is not what you’re using.

In the library, e.g. in platforms.h and led_sysdefs.h and probably others you need to find places where it says something like:

#elif defined(SAM3X8E)

and change that to

#elif defined(SAM3X8E) || defined(SAM4S4A)

Also note that all the pin/gpio definitions are based on the SAM3X8E as used in the due/digix - you may need to do some experimenting to support the platform that you’re on.

What board are you working on?

That’s what I did :slight_smile:

I’m working on a board we made to use the SAM4S instead of the 3x ( we needed a small footprint ARM that we could port from a known board and be able to use the onboard JTAG on the EVKIT, so we chose the SAM4S and ported arduino DUE code to make a new variant)
It’s similar to the flutter wireless board but with a SAM4S instead of a 3S, almost everything is the same as the due except pin mapping and the USB controller, it’s also 120MHz :slight_smile:

The only errors that I get are from the fastpin.h file ( I’ll also need to check that the compiler and linker are set up ) - Atmel studio does define F_CPU but not all the libraries seem to get that define ( might be some strangeness on Atmel studio )
I’ll try with the 3.1 branch :slight_smile:
Most of the arduino libraries work relatively pain free when I get them into the project in Atmel studio

Yeah - most arduino libraries don’t go to bare metal/IO register programming like FastLED does :slight_smile:

I’m still wrapping my head around how everything is templates of things , it’s really neatly done !

Thanks! I did a quick glance/read of the sam4s datasheet and it looks like the same registers are used, so hopefully the code will work without too much hassle.

How many leds are you thinking about driving? The 3.1 branch supports parallel output :slight_smile:

The board only has 2 outputs for LEDs , and that is usually 32- 300 per channel ( wireless LED strip controllers with accelerometer and gyros )