RKTK API Docs RKTK Home Repo

Module layout

Module layout 

Source
Expand description

§LED Layouts

A layout defines the physical or logical positions of the LEDs in your setup, as arrangements in 1D, 2D, and 3D space.

The layout traits provide a PIXEL_COUNT constant, which is the number of LEDs, and a .points(). method, which maps each LED pixel into a 1D, 2D, or 3D space between -1.0 and 1.0.

§1D Layouts

For simple linear arrangements, use the layout1d! macro:

use blinksy::layout1d;

// Define a strip with 60 LEDs
layout1d!(Layout, 60);

§2D Layouts

For 2D layouts, use the layout2d! macro with one or more Shape2d definitions:

use blinksy::{layout2d, layout::Shape2d, layout::Vec2};

// Define a 16x16 LED grid
layout2d!(
    Layout,
    [Shape2d::Grid {
        start: Vec2::new(-1., -1.),
        horizontal_end: Vec2::new(1., -1.),
        vertical_end: Vec2::new(-1., 1.),
        horizontal_pixel_count: 16,
        vertical_pixel_count: 16,
        serpentine: true,
    }]
);

§3D Layouts

For 3D layouts, use the layout3d! macro with one or more Shape3d definitions.

Structs§

ArcStepIterator
Iterator for points along an arc (circular or elliptical) in 2D or 3D.
GridStepIterator
Iterator for grid points with support for serpentine (zigzag) patterns.
LineStepIterator
Iterator that produces values by stepping from a start point.
Vec2
A 2-dimensional vector.
Vec3
A 3-dimensional vector.

Enums§

Shape2d
Enumeration of two-dimensional shape primitives.
Shape2dPointsIterator
Iterator over points in a 2D shape.
Shape3d
Enumeration of three-dimensional shape primitives.
Shape3dPointsIterator
Iterator over points in a 3D shape.

Traits§

Layout1d
Trait for one-dimensional LED layouts.
Layout2d
Trait for two-dimensional LED layouts.
Layout3d
Trait for three-dimensional LED layouts.
LayoutForDim
Trait for associating layout types with dimension markers.