Class Section¶
Defined in File section.h
Nested Relationships¶
Class Documentation¶
-
class
Section¶ Public Functions
-
Section(uint16_t x, uint16_t y, Section *parent = nullptr)¶ Constructor. Initializes the Pixel array.
-
~Section()¶
-
Section::Mirror *
get_mirror() const¶ Returns whether mirroring is enabled across each axis.
- Return
Mirror configuration.
-
Section *
get_parent_section() const¶ Returns this Section’s parent (if this is an Layer).
- Return
Parent Section.
-
Colors::RGB
get_pixel_color(uint16_t x, uint16_t y, Colors::RGB *base_color = nullptr)¶ Returns the final color of the specified Pixel.
-
Section::Scroll *
get_scroll() const¶ Returns the Section’s scrolling behavior.
- Return
Scrolling behavior.
-
bool
get_wrap() const¶ Returns whether to wrap Pixels on an offset Section.
- Return
If true, Pixels wrap.
-
void
remove_animation(bool clear_pixels)¶ Deletes the current Animation.
- Parameters
clear_pixels: If true, Pixels are cleared.
-
Animation &
set_animation(AnimationType animation_type, bool preserve_settings = true)¶ Sets a new Animation.
-
void
set_brightness(uint8_t brightness)¶ Sets the overall brightness of the Section. 255 is full brightness, and 0 is completely dark.
- Parameters
brightness: Brightness level (0 - 255).
-
Canvas &
set_canvas(uint16_t num_frames = 1)¶ Sets a new Canvas of the specified type. This will overwrite the existing Canvas.
-
void
set_dimensions(uint16_t x, uint16_t y)¶ Sets the size of the Section.
- Parameters
x: Number of Pixels along the x-coordinate.y: Number of Pixels along the y-coordinate.
-
Section::Layer &
set_layer(Colors::MixMode mix_mode = Colors::MixMode::Alpha, uint8_t alpha = 128)¶ Sets a new Layer. If an Layer already exists, this updates the existing Layer.
-
void
set_maestro(Maestro &maestro)¶ Sets the Section’s parent Maestro.
- Parameters
maestro: Parent Maestro.
-
Section::Mirror *
set_mirror(bool x, bool y)¶ Mirrors the Section across the axes. If both x and y are false, mirroring is disabled.
-
Point &
set_offset(uint16_t x, uint16_t y)¶ Sets the Section’s offset, which shifts the Section’s output along the Pixel grid.
- Return
Offset.
- Parameters
x: Offset along the x axis.y: Offset along the y axis.
-
void
set_pixel_color(uint16_t x, uint16_t y, const Colors::RGB &color)¶ Sets the specified Pixel to a new color.
-
Section::Scroll &
set_scroll(uint16_t x, uint16_t y, bool reverse_x = false, bool reverse_y = false)¶ Sets the direction and rate that the Section will scroll. The values determine the amount of time until the Section completes a single scroll along the respective axis. Using a negative value reverses the scrolling direction. Setting either axis to 0 disables scrolling on that axis.
- Parameters
x: Scrolling interval along the x axis.y: Scrolling interval along the y axis.reverse_x: If true, reverses the scrolling direction along the x axis.reverse_y: If true, reverses the scrolling direction along the y axis.
-
void
set_step_count(uint8_t step_count)¶ Sets the number of steps for fading Pixels.
- Parameters
step_count: When > 0, gradually fades Pixels from their current color to their next color.
-
void
set_wrap(bool wrap)¶ Sets whether to wrap Pixels across an offset Section.
- Parameters
wrap: If true, Pixels wrap. If not, Pixels display black.
-
void
sync(const uint32_t &new_time)¶ Sets the last update time of each component’s timer.
- Parameters
new_time: New last refresh time.
-
void
update(const uint32_t ¤t_time)¶ Main update routine.
- Parameters
current_time: Program runtime.
-
struct
Layer¶ Layers a second Section on top of the current one. When getting color output, use get_pixel_color(). This returns RGB values after blending the two Sections together.
-
struct
Mirror¶ Controls mirroring across the x and y axes.
-
struct
Scroll¶ Sets the Section’s scrolling behavior.
Public Functions
-
void
remove_timer_x()¶ Removes the x axis timer.
-
void
remove_timer_y()¶ Removes the y axis timer.
-
void
set(uint16_t refresh_interval, Point *dimensions, uint16_t interval_x, uint16_t interval_y, bool reverse_x = false, bool reverse_y = false)¶ Sets the scrolling behavior. The step count is calculated by factoring in the Pixel grid size and Maestro refresh rate.
- Parameters
refresh_interval: Amount of time between Maestro refreshes.dimensions: The dimensions of the parent Section.interval_x: The amount of time to complete a scroll along the x axis.interval_y: The amount of time to complete a scroll along the y axis.reverse_x: If true, reverses the scrolling direction along the x axis.reverse_y: If true, reverses the scrolling direction along the y axis.
-
~Scroll()¶
Public Members
-
uint16_t
interval_x= 0¶ The original x interval. This is really just storage for use in Cues.
-
uint16_t
interval_y= 0¶ The original y interval.
-
bool
reverse_x= false¶ If true, reverses the scrolling direction along the x axis.
-
bool
reverse_y= false¶ If true, reverses the scrolling direction along the y axis.
-
Timer *
timer_x= nullptr¶ Sets the amount of time between a single x-axis step. Overrides step_x when step_x is less than 1.
-
Timer *
timer_y= nullptr¶ Sets the amount of time between a single y-axis step. Overrides step_y when step_y is less than 1.
-
uint16_t
step_x= 0¶ Sets the number of y-axis steps to take with each update. Overridden by timer_x when this is calculated to be less than 1.
-
uint16_t
step_y= 0¶ Sets the number of y-axis steps to take with each update. Overridden by timer_y when this is calculated to be less than 1.
-
void
-