Skip to content

Commit 8d224c7

Browse files
committed
Fix rp2040Init() not called when instantiated with the parameterless constructor
Call of the rp2040Init() is moved to the setPin method.
1 parent edbac19 commit 8d224c7

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

Adafruit_NeoPixel.cpp

+11-7
Original file line numberDiff line numberDiff line change
@@ -82,13 +82,6 @@ Adafruit_NeoPixel::Adafruit_NeoPixel(uint16_t n, int16_t p, neoPixelType t)
8282
updateType(t);
8383
updateLength(n);
8484
setPin(p);
85-
#if defined(ARDUINO_ARCH_RP2040)
86-
#ifdef NEO_KHZ400
87-
rp2040Init(is800KHz);
88-
#else
89-
rp2040Init(true);
90-
#endif
91-
#endif
9285
}
9386

9487
/*!
@@ -3155,6 +3148,17 @@ void Adafruit_NeoPixel::setPin(int16_t p) {
31553148
#endif
31563149
pinMode(pin, INPUT); // Disable existing out pin
31573150
}
3151+
3152+
#if defined(ARDUINO_ARCH_RP2040)
3153+
if (init) {
3154+
#ifdef NEO_KHZ400
3155+
rp2040Init(is800KHz);
3156+
#else
3157+
rp2040Init(true);
3158+
#endif
3159+
}
3160+
#endif
3161+
31583162
pin = p;
31593163
if (begun) {
31603164
pinMode(p, OUTPUT);

0 commit comments

Comments
 (0)