Resolving library conflict between DaisyDuino and Adafruit_NeoPixel

I’m continuing to try to get my WS2811 LED string working with Daisy. To my surprise, the Adafruit_NeoPixel examples work out-of-the-box with Daisy! Now I want to see if the LEDs will play well with Daisy audio. When I merged some simple LED code with the “tone” example sketch (including both Adafruit_NeoPixe.h and DaisyDuino.h), I’m getting a series of error messages from the loader of the form: “multiple definition of `HAL_SAI_Init’” These are showing up for a whole series of HAL_SAI routines. Can anybody suggest how to resolve this? Thanks!

Is the NeoPixel library using the SAI peripheral to push the bits to the WS2811? If that’s the case, NeoPixel and Daisy Audio are mutually exclusive, unless you can change the NeoPixel library to use another way of pushing the bits to the LEDs

I’m not sure. What I’m seeing in the NeoPixel code is calls to these routines:

LL_GPIO_SetOutputPin() Which is an inline for: WRITE_REG(GPIOx->BSRR, PinMask);
LL_GPIO_ResetOutputPin() Which is an inline for: WRITE_REG(GPIOx->BSRR, PinMask << 16U);

This is all Greek to me! Thanks for sharing your expertise.

Is your code public somewhere? I’d have to take a look into it to help

Wow! That would be great. Here’s the sketch. A caveat: this is a merge between two pieces of code, both running, with a few tweaks (adding the timer to avoid calling “delay”). I couldn’t get the sketch to compile, so it’s untested. Thanks much for your help.

#include <Adafruit_NeoPixel.h>
#include "DaisyDuino.h"

DaisyHardware hw;

#define PIN        6
#define NUMPIXELS 6 
Adafruit_NeoPixel pixels(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);

size_t num_channels;

static Tone flt;
static Oscillator osc, lfo;

void MyCallback(float **in, float **out, size_t size)
  float saw, freq, output;
  for (size_t i = 0; i < size; i++)
    freq = 2500 + ( lfo.Process() * 2500 );
    saw = osc.Process();

    output = flt.Process(saw);

    for (size_t chn = 0; chn < num_channels; chn++)
      out[chn][i] = output;

void setup() {
  pixels.begin(); // INITIALIZE NeoPixel strip object (REQUIRED)

  float sample_rate;
  // Initialize for Daisy pod at 48kHz
  hw = DAISY.init(DAISY_SEED, AUDIO_SR_48K);
  num_channels = hw.num_channels;
  sample_rate = DAISY.get_samplerate();

  // initialize Tone object

  // set parameters for sine oscillator object

  // set parameters for sine oscillator object


unsigned long currTime = millis();
int delayTime = 500;
uint8_t displayPixel = 0;

void showPixel() {
  if (displayPixel == 0) {
    pixels.clear(); // Set all pixel colors to 'off';

  // pixels.Color() takes RGB values, from 0,0,0 up to 255,255,255
  // Here we're using a moderately bright green color:
  pixels.setPixelColor(displayPixel, pixels.Color(150, 0, 0));;   // Send the updated pixel colors to the hardware.
  displayPixel %= NUMPIXELS;

void loop() {
  if ((millis() - currTime) > delayTime) {
    currTime = millis();

Hmm, the code looks fine and the NeoPixel library doesn’t directly include any files that could cause this error.
I’m not familiar with the way Arduino resolves dependencies, but I would suspect the error comes from there somehow. Maybe someone else with a little.more Arduino experience can chime in and look at this?

I suppose that’s a bit encouraging; maybe light and sound together if someone can help out? Does this mean that you were able to replicate the “multiple definition” problem that I’m seeing?

The code listed above compiles successfully here - no errors, but several warnings. I don’t have a neopixel, so I can’t try it.

1 Like

Thanks for the help guys. Turns out this is a known problem: Examples won't compile I still can’t get it to compile, but will continue my moaning in that thread :laughing:

Silly user error! Lights and Sound compiles and runs! Yay!