[][src]Crate blinq

blinq - a blinking queue

A queue for toggling a GPIO or blinking an LED, with binary patterns encoded as a u32.

Example

use blinq::{Pattern, Blinq, patterns, consts};

// Create a blink queue with room for 8 patterns, that is active-low
let mut blinq: Blinq<consts::U8, 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();

Modules

consts

Type aliases for many constants.

patterns

Handy patterns to blink

Structs

Blinq

A blinking queue

Pattern

A blinking pattern encoded as a u32