Crate blinq[][src]

Expand description

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};

// Create a blink queue with room for 8 patterns, that is active-low.
// Note that the queue size must be one larger than the amount of patterns
// that you wish to store!
let mut blinq: Blinq<FakeGpio, 9> = 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

Handy patterns to blink

Structs

A blinking queue

A blinking pattern encoded as a u32