You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/Berry_Addressable-LED.md
+5-12Lines changed: 5 additions & 12 deletions
Original file line number
Diff line number
Diff line change
@@ -86,19 +86,22 @@ Finally the frame buffer is copied to the physical WS2812 led strip, after apply
86
86
### `animate.core` class
87
87
88
88
This is the main helper class to host all the animation components. It is composed of:
89
+
89
90
-`strip` object representing the led strip (1-dimension, only RGB supported for now)
90
91
-`bri` parameter (0..100) to control the overall brightness
91
92
-`frame` the background frame buffer, instance of `animate.frame`
92
93
-`layer` the current frame buffer being painted by a `painter`, instance of `animate.frame`. It is merged to `frame` once painted, taking into account transparency (alpha channel)
93
94
94
95
The instance also does the following:
96
+
95
97
- register a `fast_loop` for quick animation, and iterate every 20ms (50Hz)
96
98
- call each `animator` object to compute new values of all parameters
97
99
- call each `painter` object to paint layers on top of each others
98
100
- apply brightness to frame buffer
99
101
- copy to `strip` WS2812 leds
100
102
101
103
Methods:
104
+
102
105
-`init(strip [, bri:int])` constructor, needs a strip, brightness defaults to 50%
103
106
-`set_bri()` and `get_bri()` to set/get brightness
104
107
-`add_animator()` adds an animator object to be called at each tick
@@ -115,6 +118,7 @@ This class is a helper class to manage RGB pixels frame, mix layers and compute
115
118
`Leds_frame` is a super-class of `bytes` and encapsulate a raw bytes buffer. Each pixel is in ARGB 32 bits format with alpha-channel.
116
119
117
120
Methods:
121
+
118
122
- constructor `Leds_frame(number_of_pixels:int)`: creates a frame buffer with the specified number of pixels (the actual bytes buffer is x4 this size). The buffer is filled with black opaque by default
119
123
-`frame[i]`: read/write the 32-bit value of the ARGB pixel at index `i`
120
124
-`frame.set_pixel(i, r, g, b, alpha)`: set the pixel at index `i` for value `r`/`g`/`b` (0..255) and optional `alpha` channel (opaque 0x00 if not specified)
@@ -125,6 +129,7 @@ Methods:
125
129
### pre-built animators
126
130
127
131
Currently the following animators are provided:
132
+
128
133
-`animate.oscillator`: generate a variable integer that can be used by painters as a cyclic value (brightness, size, speed...)
129
134
-`animate.palette`: cycle through a color palette with smooth transitions
130
135
@@ -229,15 +234,3 @@ ESP32S2|4
229
234
ESP32C3|2
230
235
231
236
Currently `RMT` channel 0 is used by default if no GPIO `WS2812-1` is configured, `RMT` channel 1 otherwise.
232
-
<!--
233
-
## Example
234
-
235
-
Pulsating round on M5Stack Atom Matrix if GPIO 27 is configured as `WS1812 - 2`
236
-
237
-
```berry
238
-
var strip = Leds_matrix(5,5, gpio.pin(gpio.WS2812, 1))
0 commit comments