Skip to content

Commit

Permalink
Fix rp2040Init() not called when instantiated with the parameterless …
Browse files Browse the repository at this point in the history
…constructor

Call of the rp2040Init() is moved to the setPin method.
  • Loading branch information
bbacskay committed Mar 13, 2024
1 parent 5da70dc commit dd00e48
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions Adafruit_NeoPixel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,6 @@ Adafruit_NeoPixel::Adafruit_NeoPixel(uint16_t n, int16_t p, neoPixelType t)
updateType(t);
updateLength(n);
setPin(p);
#if defined(ARDUINO_ARCH_RP2040)
#ifdef NEO_KHZ400
rp2040Init(is800KHz);
#else
rp2040Init(true);
#endif
#endif
}

/*!
Expand Down Expand Up @@ -3073,6 +3066,17 @@ void Adafruit_NeoPixel::setPin(int16_t p) {
#endif
pinMode(pin, INPUT); // Disable existing out pin
}

#if defined(ARDUINO_ARCH_RP2040)
if (init) {
#ifdef NEO_KHZ400
rp2040Init(is800KHz);
#else
rp2040Init(true);
#endif
}
#endif

pin = p;
if (begun) {
pinMode(p, OUTPUT);
Expand Down

0 comments on commit dd00e48

Please sign in to comment.