|
M5Unit-RGB 0.0.2 git rev:51dfbe6
|
LED base unit. More...
#include <unit_LED.hpp>
Classes | |
| struct | config_t |
| Settings for begin. More... | |
Public Types | |
| using | container_type = std::vector<uint8_t> |
| pixel container | |
| using | item_container_type = std::vector<gpio::m5_rmt_item_t> |
| item container | |
Public Member Functions | |
| virtual | ~UnitLED () |
| Destructor. | |
| bool | add (UnitLED &c, const int16_t channel) |
| Connect an LED unit as a daisy-chained child. | |
| virtual bool | begin () override |
| Begin the unit. | |
Configuration for begin | |
| config_t | config () |
| Gets the configuration. | |
| void | config (const config_t &cfg) |
| Set the configuration. | |
Properties | |
| uint16_t | numPixels () const |
| Number of the pixels. | |
| uint8_t | brightness () const |
| Brightness. | |
| virtual uint16_t | width () const |
| Logical width in pixels. | |
| virtual uint16_t | height () const |
| Logical height in pixels. | |
| bool | hasWhite () const |
| Has white data? | |
| rgb::Order | order () const |
| Color order. | |
| int8_t | offsetR () const |
| Offset of red. | |
| int8_t | offsetG () const |
| Offset of green. | |
| int8_t | offsetB () const |
| Offset of blue. | |
| int8_t | offsetW () const |
| Offset of white. | |
| const container_type & | pixels () const |
| pixels container | |
| rgb::Color | color (const uint16_t n) const |
| Get the Color. | |
| rgb::Color | absoluteColor (const uint16_t n) const |
| Get the Color. | |
Apply | |
| bool | writePixels () |
| Write pixel color to LED. | |
| bool | show () |
| Write pixel color to LED (alias) | |
Modifiers | |
| |
| void | setBrightness (const uint8_t b) |
| Set the brightness. | |
| bool | setPixelColor (const uint16_t n, const uint8_t r, const uint8_t g, const uint8_t b) |
| Set pixel color (RGB) | |
| bool | setPixelColor (const uint16_t n, const uint8_t r, const uint8_t g, const uint8_t b, const uint8_t w) |
| Set pixel color (RGBW) | |
| bool | setPixelColor (const uint16_t n, const rgb::wrgb32_color_t c) |
| Set pixel color. | |
| bool | setPixelColor (const uint16_t n, const rgb::Color &c) |
| Set pixel color. | |
| bool | fill (const rgb::Color &c, const uint16_t first=0, const uint16_t count=0) |
| Fill the specified range with the specified color. | |
| void | clear (void) |
| Clear pixels. | |
| bool | fillRainbow (const uint16_t first=0, const uint16_t count=0, const uint8_t firstHue=0) |
| Fill the specified range to rainbow. | |
| bool | fillGradation (const rgb::Color &firstClr, const rgb::Color &lastClr, const uint16_t first=0, const uint16_t count=0) |
| Fill the specified range to gradation pixels. | |
| bool | fillRandom (const uint16_t first=0, const uint16_t count=0) |
| Fill the specified range to random color pixels. | |
| void | shiftLeft (const uint16_t count=1) |
| Shift pixels left. | |
| void | shiftRight (const uint16_t count=1) |
| Shift pixels right. | |
| void | rotateLeft (const uint16_t count=1) |
| Rotate pixels left. | |
| void | rotateRight (const uint16_t count=1) |
| Rotate pixels right. | |
Rotation | |
| |
| virtual uint8_t | maxRotation () const |
| Get the max rotation. | |
| float | rotationDegree () const |
| Get the rotation angle per 1. | |
| int8_t | rotation () const |
| Get the rotation. | |
| void | setRotation (const int8_t rot) |
| Set the rotation. | |
Pixels element access | |
| |
| rgb::Color | operator[] (const uint16_t i) const |
| rvalue | |
| PixelProxy | operator[] (const uint16_t i) |
| lvalue | |
Protected Member Functions | |
| virtual types::category_t | unit_category () const override |
| virtual gpio::adapter_config_t | rmt_config () |
| virtual gpio::m5_rmt_item_t | rmt_item_one () |
| virtual gpio::m5_rmt_item_t | rmt_item_zero () |
| virtual gpio::m5_rmt_item_t | rmt_item_reset () |
| container_type & | pixels () |
| rgb::Color | get_pixel_color (const uint16_t n) const |
| bool | set_pixel_color (const uint16_t n, const rgb::Color &c) |
| uint8_t | rotation_of (const int8_t r) const |
| virtual uint16_t | index_of (const uint16_t n) const |
| container_type | rgb888_items () |
| item_container_type | items () |
| void | shift_left (const uint16_t count, const bool wrap) |
| void | shift_right (const uint16_t count, const bool wrap) |
| UnitLED (const uint16_t num_of_pixels, const rgb::Order order) | |
Friends | |
| class | InterfaceGPIO |
| class | InterfacePbHub |
LED base unit.
|
inline |
Get the Color.
| n | Position of the pixels |
| bool m5::unit::UnitLED::add | ( | UnitLED & | c, |
| const int16_t | channel ) |
Connect an LED unit as a daisy-chained child.
| c | Child LED unit |
| channel | Channel number |
|
overridevirtual |
Begin the unit.
Reimplemented in m5::unit::UnitAtomMatrixRGB, and m5::unit::UnitNeco.
|
inline |
Brightness.
|
inline |
Clear pixels.
|
inline |
Get the Color.
| n | Position of the pixels |
|
inline |
Set the configuration.
| cfg | config_t |
| bool m5::unit::UnitLED::fill | ( | const rgb::Color & | c, |
| const uint16_t | first = 0, | ||
| const uint16_t | count = 0 ) |
Fill the specified range with the specified color.
| c | rgb::Color |
| first | First position of the pixels |
| count | Number of pixels to fill (To the end if zero) |
| bool m5::unit::UnitLED::fillGradation | ( | const rgb::Color & | firstClr, |
| const rgb::Color & | lastClr, | ||
| const uint16_t | first = 0, | ||
| const uint16_t | count = 0 ) |
Fill the specified range to gradation pixels.
| firstClr | First Color |
| lastClr | Last Color |
| first | First position of the pixels |
| count | Number of pixels to fill (To the end if zero) |
| bool m5::unit::UnitLED::fillRainbow | ( | const uint16_t | first = 0, |
| const uint16_t | count = 0, | ||
| const uint8_t | firstHue = 0 ) |
Fill the specified range to rainbow.
| first | First position of the pixels |
| count | Number of pixels to fill (To the end if zero) |
| firstHue | The first hue value |
| bool m5::unit::UnitLED::fillRandom | ( | const uint16_t | first = 0, |
| const uint16_t | count = 0 ) |
Fill the specified range to random color pixels.
| first | First position of the pixels |
| count | Number of pixels to fill (To the end if zero) |
|
inline |
Has white data?
|
inlinevirtual |
Logical height in pixels.
Reimplemented in m5::unit::UnitHexLED37< UnitSK6812GRB >, m5::unit::UnitHexLED37< UnitWS2812 >, m5::unit::UnitRectLED< 18, 7, UnitWS2812 >, m5::unit::UnitRectLED< 5, 5, UnitWS2812 >, and m5::unit::UnitRectLED< 8, 8, UnitWS2812 >.
|
inlinevirtual |
Get the max rotation.
Reimplemented in m5::unit::UnitHexLED37< UnitSK6812GRB >, m5::unit::UnitHexLED37< UnitWS2812 >, m5::unit::UnitRectLED< 18, 7, UnitWS2812 >, m5::unit::UnitRectLED< 5, 5, UnitWS2812 >, and m5::unit::UnitRectLED< 8, 8, UnitWS2812 >.
|
inline |
Number of the pixels.
|
inline |
Offset of blue.
|
inline |
Offset of green.
|
inline |
Offset of red.
|
inline |
Offset of white.
|
inline |
lvalue
| i | Position of the pixels |
|
inline |
rvalue
| i | Position of the pixels |
|
inline |
Color order.
|
inline |
pixels container
|
inline |
Rotate pixels left.
| count | Number of rotates |
|
inline |
Rotate pixels right.
| count | Number of rotates |
|
inline |
Get the rotation.
|
inline |
Get the rotation angle per 1.
|
inline |
Set the brightness.
| b | brightness (255 = 100%) |
|
inline |
Set pixel color.
| n | Position of the pixels |
| c | rgb::Color |
|
inline |
Set pixel color.
| n | Position of the pixels |
| c | WRGB 32bits color |
| bool m5::unit::UnitLED::setPixelColor | ( | const uint16_t | n, |
| const uint8_t | r, | ||
| const uint8_t | g, | ||
| const uint8_t | b ) |
Set pixel color (RGB)
| n | Position of the pixels |
| r | Red |
| g | Green |
| b | Blue |
|
inline |
Set pixel color (RGBW)
| n | Position of the pixels |
| r | Red |
| g | Green |
| b | Blue |
| w | White |
| void m5::unit::UnitLED::setRotation | ( | const int8_t | rot | ) |
Set the rotation.
| rot | Rotation step |
|
inline |
Shift pixels left.
| count | Number of shifts |
|
inline |
Shift pixels right.
| count | Number of shifts |
|
inline |
Write pixel color to LED (alias)
|
inlinevirtual |
Logical width in pixels.
Reimplemented in m5::unit::UnitHexLED37< UnitSK6812GRB >, m5::unit::UnitHexLED37< UnitWS2812 >, m5::unit::UnitRectLED< 18, 7, UnitWS2812 >, m5::unit::UnitRectLED< 5, 5, UnitWS2812 >, and m5::unit::UnitRectLED< 8, 8, UnitWS2812 >.
| bool m5::unit::UnitLED::writePixels | ( | void | ) |
Write pixel color to LED.