Skip to content

Rust no-std, no-alloc LED control library designed for 1D, 2D, and 3D layouts

License

Notifications You must be signed in to change notification settings

ahdinosaur/blinksy

Repository files navigation

Blinksy

Blinksy is a Rust no-std, no-alloc LED control library designed for 1D, 2D, and 3D (audio-reactive) LED setups, inspired by FastLED and WLED.

  • Define LED layouts in 1D, 2D, or 3D space
  • Choose visual patterns (effects)
  • Compute colors for each LED based on its position
  • Drive various LED chipsets with each frame of colors

Features

  • No-std, No-alloc: Designed to run on embedded targets.
  • Layout Abstraction: Define 1D, 2D, or 3D LED positions with shapes (grids, lines, arcs, points, etc).
  • Pattern (Effect) Library:
    • Rainbow: Gradual, colorful gradient transition across your layout.
    • Noise: Dynamic noise‑based visuals using noise functions (Perlin, Simplex, OpenSimplex, etc).
    • Make an issue if you want help to port a pattern from FastLED / WLED to Rust!
  • Multi‑Chipset Support:
    • APA102
    • WS2812B
    • Make an issue if you want help to support a new chipset!
  • Board Support Packages:
    • Gledopto: A great LED controller available on AliExpress: Gledopto GL-C-016WL-D
    • (TODO) QuinLED: The best DIY and pre-assembled LED controller boards
  • Desktop Simulation: Run a simulation of a layout and pattern on your computer to experiment with ideas.
  • (TODO) Audio-Reactive: Easily integrate audio reactivity into visual patterns.

Modules

Examples

For all examples, see:

2D APA102 Grid with Noise Pattern

VID20250401221726.mp4
#![no_std]
#![no_main]

use blinksy::{
    layout::{Shape2d, Vec2},
    layout2d,
    patterns::{noise_fns, Noise2d, NoiseParams},
    ControlBuilder,
};
use gledopto::{apa102, board, elapsed, main};

#[main]
fn main() -> ! {
    let p = board!();

    layout2d!(
        Layout,
        [Shape2d::Grid {
            start: Vec2::new(-1., -1.),
            row_end: Vec2::new(1., -1.),
            col_end: Vec2::new(-1., 1.),
            row_pixel_count: 16,
            col_pixel_count: 16,
            serpentine: true,
        }]
    );
    let mut control = ControlBuilder::new_2d()
        .with_layout::<Layout>()
        .with_pattern::<Noise2d<noise_fns::Perlin>>(NoiseParams {
            ..Default::default()
        })
        .with_driver(apa102!(p))
        .build();

    control.set_brightness(0.1);

    loop {
        let elapsed_in_ms = elapsed().as_millis();
        control.tick(elapsed_in_ms).unwrap();
    }
}

1D WS2812 Strip with Rainbow Pattern

VID20250327160955.mp4
#![no_std]
#![no_main]

use blinksy::{
    layout::Layout1d,
    layout1d,
    patterns::{Rainbow, RainbowParams},
    ControlBuilder,
};
use gledopto::{board, elapsed, main, ws2812};

#[main]
fn main() -> ! {
    let p = board!();

    layout1d!(Layout, 60 * 5);

    let mut control = ControlBuilder::new_1d()
        .with_layout::<Layout>()
        .with_pattern::<Rainbow>(RainbowParams {
            ..Default::default()
        })
        .with_driver(ws2812!(p, Layout::PIXEL_COUNT))
        .build();

    control.set_brightness(0.2);

    loop {
        let elapsed_in_ms = elapsed().as_millis();
        control.tick(elapsed_in_ms).unwrap();
    }
}

Contributing

Contributions are welcome! Please see CONTRIBUTING.md for details and join the discussion on how to make Blinksy even better.

License

Blinksy is licensed under the European Union Public License (EUPL).

We chose the EUPL, a copyleft license which combines reciprocity and share-alike, to ensure that Blinksy remains free and open.

You are free to use, modify, and share Blinksy freely. Whether for personal projects, art installations, or commercial products.

Only once you start distributing something based on changes to Blinksy, you must share any improvements back with the community by releasing your source code.

Unlike more viral copyleft licenses, you will not be required to release the source code for your entire project, only changes to Blinksy.

About

Rust no-std, no-alloc LED control library designed for 1D, 2D, and 3D layouts

Resources

License

Code of conduct

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published