Infrared r0.12

Infrared Release 0.12 - Type states and const generics

New and exciting release with lots of new code and ideas incorporated.

1. Unified the Receivers

EventReceiver/PollReceiver and their Embedded-hal counterparts are now all defined by a single Receiver struct with type state defining their semantics.

A Builder was also added to help with the construction of the Receiver struct.

Example of a couple of different Receiver configurations, and a couple of different ways to create them.

use infrared::{
    Receiver,
    receiver::{Event, Poll, DefaultInput, PinInput, BufferInput, Builder},
    protocol::{Rc6, Nec},
};
use dummy_pin::DummyPin;

// Receiver for Rc6 signals, event based with embedded-hal pin
let pin = DummyPin::new_low();
let r1: Receiver<Rc6, Event, PinInput<DummyPin>> = Receiver::with_pin(40_000, pin);

// Periodic polled Nec-Receiver without any
let r2: Receiver<Nec, Poll, DefaultInput> = Receiver::new(40_000, DefaultInput {});

let buf = &[20, 40, 20];
let mut r3: Receiver<Rc6, Event, BufferInput> = Receiver::builder().rc6().buffer(buf).build();

let cmd_iter = r3.iter();

2. Const Generic Receiver

The Receiver can be built to be const over the frequency of timer/clock.

let r = Receiver::builder()
    .nec()
    // ... other configuration
    .build_const::<40_000>();

3. Const generic Sender

The Sender struct is now const generic over both timer frequency and buffer size.

4. Usize everywhere

Most of the API use usize now instead of u32. This makes most of the library work with the AVR backend for Rust.

What's next?