Crates.io | blinq |
lib.rs | blinq |
version | 0.2.0 |
source | src |
created_at | 2020-07-26 01:45:01.339091 |
updated_at | 2021-09-17 15:08:00.50131 |
description | An embedded-hal blinking queue |
homepage | |
repository | https://github.com/jamesmunns/blinq |
max_upload_size | |
id | 269613 |
size | 34,634 |
A queue for toggling a GPIO or blinking an LED, with binary patterns encoded as a u32.
use blinq::{Pattern, Blinq, patterns, consts};
// Create a blink queue with room for 8 patterns (note: the capacity must be 1 higher
// then the amount of patterns you wish to store), that is active-low
let mut blinq: Blinq<9, FakeGpio> = Blinq::new(gpio, true);
// Insert "HELLO." in morse code
blinq.enqueue(patterns::morse::H); // 8 steps
blinq.enqueue(patterns::morse::E); // 2 steps
blinq.enqueue(patterns::morse::L); // 10 steps
blinq.enqueue(patterns::morse::L); // 10 steps
blinq.enqueue(patterns::morse::O); // 12 steps
blinq.enqueue(patterns::morse::FULL_STOP); // 18 steps
// This is 60 steps
for _ in 0..60 {
blinq.step();
}
// The queue is now exhausted, and the GPIO will be driven to the
// inactive state
blinq.step();
Licensed under either of
Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.