Created NeoPixelBus object API (markdown)

Michael Miller
2016-02-26 00:34:28 -08:00
parent 42c8f16f32
commit ff5f2f3911

46
NeoPixelBus-object-API.md Normal file

@@ -0,0 +1,46 @@
## void Begin()
This will initialize the NeoPixelBus and prepare it for use. Call this first within Setup().
## void Show()
This will try to send the pixel information to the physical pixels. If there has been no change since the last time it was called, nothing will be sent.
Due to the hardware protocol, if you call this quickly after the last time it was called, it may wait up to 50us extra.
Based upon the Method used, sometimes this may take some time before it returns depending on the number of pixels. 300 pixel strip can take 9ms to send the data. The more pixels, the longer it takes, the less pixels, the quicker it can send them.
## bool CanShow()
This will return true if enough time has passed since the last time Show() was called. This also means that calling Show() will not cause any undue waiting.
Normally, you really shouldn't worry about this as either you have enough other things in your sketch to process, or you have so little you don't care if Show() waits.
## bool IsDirty()
This will return true if SetPixelColor() was called since the last time Show() was called. It will also return true if the Dirty() method was called.
## void Dirty()
This will force the internal state to think that SetPixelColor() was called. This is handy if you modify the pixel buffer directly using the Pixels() method below.
## void ResetDirty()
This will force the internal state to think that Show() has happened and there is nothing new to send.
## uint8_t* Pixels()
This will return a pointer to the internal buffer of pixels. See PixelsSize() and PixelSize() to understand how large this buffer is and how its laid out.
## size_t PixelsSize()
This will return the number of bytes of the internal buffer that calling Pixels() returns.
## size_t PixelSize()
This will return the number of bytes that a single pixel requires, as defined by the Feature given when the NeoPixelBus object was created.
## uint16_t PixelCount()
This will return the number pixels the NeoPixelBus manages. This value was passed in to the NeoPixelBus object when it was created.
## void SetPixelColor(uint16_t indexPixel, ColorObject color)
This will set the color for the given pixel.
indexPixel - the pixel number
color - a color object to use, RgbColor, HslColor, and HsbColor will all work and if the NeoPixelBus object was created with the NeoRgbwFeature the RgbwColor will also work.
## ColorObject GetPixelColor(uint16_t indexPixel)
This will return the color for the given pixel.
indexPixel - the pixel number
<return>, a color object, RgbColor, HslColor, HsbColor, and RgbwColor will all work .
## void ClearTo(ColorObject color)
This will clear all pixels to the given color.
color - a color object to use, RgbColor, HslColor, and HsbColor will all work and if the NeoPixelBus object was created with the NeoRgbwFeature the RgbwColor will also work.