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
+12Lines changed: 12 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -32,6 +32,11 @@ Method|Details
32
32
:---|:---
33
33
create_segment<aclass="cmnd"id="leds_segment"></a>|`<strip>.create_segment(offset:int, pixels:int) -> instance<Leds_segment>`<br>Creates a virtual segment from a physical Leds strip, from Led number `offset` with `pixels` leds.
34
34
35
+
The `Leds_segment` class provides the same interface as the `Leds` class, with the following differences:
36
+
- It doesn't have its own buffer, it's a view into the parent strip's buffer
37
+
- The `show()` method takes an optional `force` parameter that, when `true`, forces a show even if the segment doesn't cover the entire strip
38
+
- The `pixels_buffer()` method returns `nil` since segments don't have their own buffer
@@ -45,13 +50,20 @@ clear<a class="cmnd" id="leds_clear"></a>|`clear() -> nil`<br>Clear all led (set
45
50
clear\_to<aclass="cmnd"id="leds_clear_to"></a>|`clear_to(col:color [, bri:int]) -> nil`<br>Set all leds to the specified color. `bri` (0..255) is optional and default to 255
46
51
show<aclass="cmnd"id="leds_show"></a>|`show() -> nil`<br>Pushes the internal buffer to leds. May be ignored if a show command is already in progress. Use `can_show()` to see if `show()` is possible
47
52
can\_show<aclass="cmnd"id="leds_can_show"></a>|`can_show() -> bool`<br>Indicates if `show()` is possible, i.e. no transfer is ongoing
53
+
can\_show\_wait<aclass="cmnd"id="leds_can_show_wait"></a>|`can_show_wait() -> nil`<br>Waits until `show()` is possible, i.e. no transfer is ongoing
48
54
is\_dirty<aclass="cmnd"id="leds_is_dirty"></a>|`is_dirty() -> bool`<br>Indicates if a led was changed since last `show()`
49
55
dirty<aclass="cmnd"id="leds_dirty"></a>|`dirty() -> nil`<br>Forces a refresh during next `show()`
50
56
pixel\_size<aclass="cmnd"id="leds_pixel_size"></a>|`pixel_size() -> int`<br>Returns the number of bytes per pixel
51
57
pixel\_count<aclass="cmnd"id="leds_pixel_count"></a>|`pixel_count() -> int`<br>Returns the number of leds in the strip
52
58
clear\_to<aclass="cmnd"id="leds_clear_to"></a>|`clear_to(col:color [, bri:int]) -> nil`<br>Clears all leds to the specified color. `bri` is optional and default to 255
53
59
set\_pixel\_color<aclass="cmnd"id="leds_set_pixel_color"></a>|`set_pixel_color(idx:int, col:color [, bri:int]) -> nil`<br>Set led number `idx` to the specified color. `bri` (0..255) is optional and default to 255
54
60
get\_pixel\_color<aclass="cmnd"id="leds_get_pixel_color"></a>|`get_pixel_color(idx:int) -> color:int`<br>Returns the color (including brightness and gamma correction) of led number `idx`
61
+
set\_gamma<aclass="cmnd"id="leds_set_gamma"></a>|`set_gamma(gamma:bool) -> nil`<br>Sets whether gamma correction is applied
62
+
get\_gamma<aclass="cmnd"id="leds_get_gamma"></a>|`get_gamma() -> bool`<br>Returns whether gamma correction is applied
63
+
set\_bri<aclass="cmnd"id="leds_set_bri"></a>|`set_bri(bri:int) -> nil`<br>Sets the brightness (0..255)
64
+
get\_bri<aclass="cmnd"id="leds_get_bri"></a>|`get_bri() -> int`<br>Returns the current brightness
65
+
set\_animate<aclass="cmnd"id="leds_set_animate"></a>|`set_animate(animate) -> nil`<br>Sets the animation object attached to this strip
66
+
get\_animate<aclass="cmnd"id="leds_get_animate"></a>|`get_animate() -> instance`<br>Returns the animation object attached to this strip
55
67
gamma<aclass="cmnd"id="leds_gamma"></a>|`gamma:bool`<br>Applies gamma correction if `true` (default)
56
68
pixels\_buffer<aclass="cmnd"id="leds_pixels_buffer"></a>|`pixels_buffer() -> bytes()`<br>Returns the internal buffer used by NeoPixelBus. The `byte()` object points to the original buffer, no new buffer is allocated; which means that raw data can be changed directly. Don't forget to call `dirty()` and `show()` afterwards
0 commit comments