#blinksy #layout #desktop #red-square-green-square

blinksy-desktop

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

3 releases (breaking)

new 0.3.0 May 20, 2025
0.2.0 May 16, 2025
0.1.0 May 1, 2025

#23 in Multimedia

Download history 61/week @ 2025-04-25 66/week @ 2025-05-02 16/week @ 2025-05-09 238/week @ 2025-05-16

381 downloads per month

EUPL-1.2

195KB
3K SLoC

Blinksy simulation of 2D grid with noise pattern

Blinksy 🟥🟩🟦

A Rust no-std no-alloc LED control library.
For 1D, 2D, and soon 3D layouts.
Inspired by FastLED and WLED.

GitHub Repo stars GitHub Sponsors Chat License

How Blinksy works

  • Define your LED layout in 1D, 2D, or 3D space
  • Create your visual pattern (effect), or choose from our built-in patterns library
    • The pattern will compute colors for each LED based on its position
  • Setup a driver to send each frame of colors to your LEDs, using our built-in drivers library.

Features

  • No-std, no-alloc: Designed for embedded targets.
  • Spatial in 1D, 2D, or 3D: Map out the shape of your LEDs in space.
  • Full color support: Supports modern and classic color spaces.
  • Global settings: Control overall brightness and color correction.
  • Desktop simulation: Simulate your LEDs on your desktop to play with ideas.
  • RGB+W support: Supports RGB + White color channels

Multi‑Chipset Support

  • clockless: One-wire (only data, no clock)
    • WS2812B: Affordable RGB LED, aka NeoPixel
  • clocked: Two-wire (data and clock)
    • APA102: High-FPS RGB LED, aka DotStar

If you want help to support a new chipset, make an issue!

Pattern (Effect) Library:

  • Rainbow: A basic scrolling rainbow
  • Noise: A flow through random noise functions.

If you want help to port a pattern from FastLED / WLED to Rust, make an issue!

Board Support Packages

If you want help to support a new target, make an issue!

Modules

CI status

Examples

For all examples, see:

Desktop Simulation: 2D Grid with Noise Pattern

https://github.com/user-attachments/assets/22f388d0-189e-44bd-acbf-186a142b956d

Click to see code
use blinksy::{
    layout::{Shape2d, Vec2},
    layout2d,
    patterns::noise::{noise_fns, Noise2d, NoiseParams},
    ControlBuilder,
};
use blinksy_desktop::{
    driver::{Desktop, DesktopError},
    time::elapsed_in_ms,
};
use std::{thread::sleep, time::Duration};

fn main() {
    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(Desktop::new_2d::<Layout>())
        .build();

    loop {
        if let Err(DesktopError::WindowClosed) = control.tick(elapsed_in_ms()) {
            break;
        }

        sleep(Duration::from_millis(16));
    }
}

Embedded Gledopto: 2D APA102 Grid with Noise Pattern

https://github.com/user-attachments/assets/1c1cf3a2-f65c-4152-b444-29834ac749ee

Click to see code
#![no_std]
#![no_main]

use blinksy::{
    layout::{Shape2d, Vec2},
    layout2d,
    patterns::noise::{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();
    }
}

Embedded Gledopto: 1D WS2812 Strip with Rainbow Pattern

https://github.com/user-attachments/assets/703fe31d-e7ca-4e08-ae2b-7829c0d4d52e

Click to see code
#![no_std]
#![no_main]

use blinksy::{
    layout::Layout1d,
    layout1d,
    patterns::rainbow::{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.

If you want to help, the best thing to do is use Blinksy for your own LED project, and share about your adventures.

License

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

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.

Dependencies

~12–22MB
~384K SLoC