Crate gledopto

Crate gledopto 

Source
Expand description

§Gledopto Board Support Package

Rust no-std embedded board support crate for Gledopto ESP32 Digital LED controllers.

Uses Blinksy: an LED control library for 1D, 2D, and 3D LED setups, inspired by FastLED and WLED.

§Supported Boards

Select the board by using its respective feature.

§Features

  • LED control using blinksy
  • Built-in “Function” button
  • Alternative “IO33” button
  • Built-in microphone

§Getting started

To quickstart a project, see blinksy-quickstart-gledopto.

§Examples

§1D WS2812 Strip with Rainbow Pattern

#![no_std]
#![no_main]

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

bootloader!();

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

    layout1d!(Layout, 60 * 5);

    let mut control = ControlBuilder::new_1d()
        .with_layout::<Layout, { Layout::PIXEL_COUNT }>()
        .with_pattern::<Rainbow>(RainbowParams {
            ..Default::default()
        })
        .with_driver(ws2812!(p, Layout::PIXEL_COUNT, { Layout:: PIXEL_COUNT * 3 * 8 + 1 }))
        .with_frame_buffer_size::<{ Ws2812::frame_buffer_size(Layout::PIXEL_COUNT) }>()
        .build();

    control.set_brightness(0.2);

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

§2D APA102 Grid with Noise Pattern

#![no_std]
#![no_main]

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

bootloader!();

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

    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,
        }]
    );
    let mut control = ControlBuilder::new_2d()
        .with_layout::<Layout, { Layout::PIXEL_COUNT }>()
        .with_pattern::<Noise2d<noise_fns::Perlin>>(NoiseParams {
            ..Default::default()
        })
        .with_driver(apa102!(p))
        .with_frame_buffer_size::<{ Apa102::frame_buffer_size(Layout::PIXEL_COUNT) }>()
        .build();

    control.set_brightness(0.1);

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

Re-exports§

pub use blinksy;
pub use blinksy_esp;
pub use esp_hal as hal;
pub use esp_rtos as rtos;
pub use esp_bootloader_esp_idf as bootloader;
pub use esp_backtrace as backtrace;
pub use esp_println as println;

Modules§

button
Button handling functionality

Macros§

apa102
Creates a APA102 LED driver using the SPI interface.
apa102_async
Creates an async APA102 LED driver using the SPI interface.
board
Initializes the ESP32 board with optimal settings.
bootloader
Populates the bootloader application descriptor
clocked
Creates a clocked LED driver using the SPI interface.
clocked_async
Creates an async clocked LED driver using the SPI interface.
clockless
Creates a clockless LED driver using the RMT peripheral.
clockless_async
Creates an async clockless LED driver using the RMT peripheral.
function_button
Creates a function button instance connected to GPIO0.
init_embassy
rmt
spi
ws2812
Creates a WS2812 LED driver using the RMT peripheral.
ws2812_async
Creates an async WS2812 LED driver using the RMT peripheral.

Functions§

elapsed
Returns the elapsed time since system boot.

Attribute Macros§

main
Re-export the main macro from esp_hal for entry point definition Attribute to declare the entry point of the program
main_embassy
Re-export the main macro from esp_rtos for async entry point definition Creates a new instance of esp_rtos::embassy::Executor and declares an application entry point spawning the corresponding function body as an async task.