unicorn_hat_hd

Crates.iounicorn_hat_hd
lib.rsunicorn_hat_hd
version0.2.1
sourcesrc
created_at2017-12-16 07:41:48.091806
updated_at2017-12-30 20:34:17.745272
descriptionProvides an interface to the Pimoroni Unicorn HAT HD on a Raspberry PI
homepage
repositoryhttps://github.com/jhelwig/unicorn-hat-hd-rs
max_upload_size
id43280
size15,167
Jacob Helwig (jhelwig)

documentation

README

unicorn-hat-hd Build Status

Rust library for interacting with the Pimoroni Unicorn HAT HD.

Documentation

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

Example

Add unicorn_hat_hd to your Cargo.toml.

[dependencies]
unicorn_hat_hd = "0.2"

Add unicorn_hat_hd to your crate root.

extern crate unicorn_hat_hd;

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);
                hat_hd.display().unwrap();
                hat_hd.set_pixel(x, y, 0, 0, 0);
            }
        }
    }
}

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]
version = "*"
default-features = false
features = ["fake-hardware"]

Though, you should replace the version = "*" with an actual version constraint. Another thing of note is that the emulated display mode does not respect any display rotation that has been set, and will always output as though Rotate::RotNone were set.

Copyright and license

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

Commit count: 35

cargo fmt