mirror of
https://github.com/Makuna/NeoPixelBus.git
synced 2025-08-07 04:44:26 +02:00
Updated NeoBuffer object (markdown)
@@ -1,5 +1,3 @@
|
||||
(under construction)
|
||||
|
||||
[NeoBuffer object API](https://github.com/Makuna/NeoPixelBus/wiki/NeoBuffer-object-API)
|
||||
|
||||
The NeoBuffer is basic image storage object. Based upon the "method" object it is defined with, it can store the image data in RAM or reference image data stored in PROGMEM.
|
||||
@@ -15,9 +13,14 @@ NeoPixelBus<NeoGrbwFeature, Neo800KbpsMethod> strip(PixelCount, PixelPin);
|
||||
NeoBuffer<NeoBufferMethod<NeoGrbwFeature>> image(myImageWidth, myImageHeight, NULL);
|
||||
```
|
||||
|
||||
You also need to decide how you are going to store the image data. Images take a lot of memory, and some consideration needs to be taken when making this decision.
|
||||
If you plan to dynamically modify the image through source code, then you have to define it to use RAM. You can still initialize the RAM stored image from PROGMEM.
|
||||
If you plan to just consume the image and never modify it, your best approach is to use PROGMEM as it will store in flash like source code and save precious RAM for your sketch.
|
||||
There are two template "Method" objects that used in the construction of the NeoBuffer that define where the data for the image is stored. There is no need to call these objects directly and they should just be used to construct the two raster objects.
|
||||
|
||||
* NeoBufferMethod - This method object will define the raster object so that it uses RAM to store the image.
|
||||
* NeoBufferProgmemMethod - This method object will define the raster object so that it uses PROGMEM to store the image.
|
||||
|
||||
If you plan to dynamically modify the image through source code, then you have to define it to use RAM by using `NeoBufferMethod `. You can still initialize the RAM stored image from PROGMEM.
|
||||
If you plan to just consume the image and never modify it, your best approach is to use PROGMEM by using `NeoBufferProgmemMethod` as it will store in flash like source code and save precious RAM for your sketch.
|
||||
|
||||
```
|
||||
// stored in RAM, but initialized by the "myImage" from PROGMEM
|
||||
NeoBuffer<NeoBuffermMethod<NeoGrbwFeature>> image(myImageWidth, myImageHeight, myImage);
|
||||
|
Reference in New Issue
Block a user