unicorn_hat_hd_2

Crates.iounicorn_hat_hd_2
lib.rsunicorn_hat_hd_2
version0.4.1
sourcesrc
created_at2021-05-17 20:01:55.248905
updated_at2022-05-09 14:06:56.173249
descriptionProvides an interface to the Pimoroni Unicorn HAT HD on a Raspberry PI
homepage
repositoryhttps://github.com/hstebbins-stash/unicorn-hat-hd-rs
max_upload_size
id398724
size12,981
Harrison (hstebbins-stash)

documentation

README

unicorn-hat-hd-2

Rust library for interacting with the Pimoroni Unicorn HAT HD. This is a fork that builds on stable Rust and updates dependencies.

Documentation

The docs can be found online at docs.rs, or be built using cargo doc.

Example

Add unicorn_hat_hd_2 to your Cargo.toml.

[dependencies]
unicorn_hat_hd_2 = "0.3"

Add unicorn_hat_hd_2 to your crate root.

extern crate unicorn_hat_hd_2;

Create a default UnicornHatHd, and start setting some pixels.

use unicorn_hat_hd::UnicornHatHd;

pub fn main() {
    let mut hat_hd = UnicornHatHd::default();
    loop {
        for y in 0..16 {
            for x in 0..16 {
                hat_hd.set_pixel(x, y, [255, 255, 255].into());
                hat_hd.display().unwrap();
                hat_hd.set_pixel(x, y, [0, 0, 0].into());
            }
        }
    }
}

Emulated display

In order to help make development of apps that use the library a little faster/easier/less-painful, you can turn on emulation of the physical display, so that it can compile on platforms other than Linux & the Raspberry PI.

In the Cargo.toml:

[dependencies.unicorn_hat_hd_2]
version = "*"
default-features = false
features = ["fake-hardware"]

Though, you should replace the version = "*" with an actual version constraint.

Copyright and license

Copyright (c) 2017 Jacob Helwig. Released under the BSD license.

Commit count: 39

cargo fmt