Moderately modified version of the Adafruit_NeoPixel Arduino library to allow it to properly interface with ESP8266_RTOS_SDK as a component.
- Addition of component.mk with specific preprocessor flags.
- Change of Arduino framework functions (pinMode(), millis(), etc.) to native ESP8266 and FreeRTOS functions (gpio_config(), esp_timer_get_time(), etc.).
- Change of Adafruit_NeoPixel C++ class methods (begin(), setPixelColor(), etc.) to account for the class-less nature of C functions (anp_begin(), anp_setPixelColor_RGB(), etc.); this includes the constructor as well.
- Fix includes to also match the native headers.
- C++ guards at both ends of the relevant files.
- For clarity,
anp
is short forAdafruit_NeoPixel
. - The class
Adafruit_NeoPixel
has been replaced with theAnpStrip
struct. The constructor has also been replaced.- Example:
Adafruit_NeoPixel pixels(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800)
is nowAnpStrip *pixels
. The functionnew_AnpStrip()
must be subsequently called:pixels = new_AnpStrip(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800)
. - Note that the other two constructors have been removed for now.
- Example:
- The variables in
Adafruit_NeoPixel
transition one-to-one ontoAnpStrip
, but all are public now. However, variables are accessed with->
instead of.
(since pixels is a pointer). -Example:pixels.numLEDs
is nowpixels->numLEDs
. - All methods of the class
Adafruit_NeoPixel
are now functions which take in a pointer to anAnpStrip
struct as the first parameter; the rest of the parameters are unchanged. In addition, all functions are prefixed withanp_
for better readability.- Example:
pixels.begin()
is nowanp_begin(strip)
.
- Example:
- Some function names have been changed due to the lack of overloading in C. Most of these are related to color operations.
- Example:
pixels.setPixelColor(i, pixels.Color(0, 150, 0))
is nowanp_setPixelColor_C(pixels, i, anp_Color_RGB(0, 150, 0))
. - Here, the suffix
_C
onanp_setPixelColor_C()
means that the function takes in aColor
; more specifically, theColor
here is fromanp_Color_RGB()
(which would've been apixels.Color()
previously). The suffixes_RGB
and_RGBW
also exist foranp_setPixelColor
.anp_ColorHSV()
is largely unchanged from before.
- Example:
Documentation of most functions may be found in the source code of Adafruit_NeoPixel. Most documentation has been removed in this version for the sake of brevity.
Please refer to Adafruit_NeoPixel for additional information regarding the license and related commentary.