pi_ir_remote 0.1.0

A crate to read infrared signals from a 44-button LED remote.
Documentation
  • Coverage
  • 10.53%
    6 out of 57 items documented0 out of 0 items with examples
  • Size
  • Source code size: 15.2 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.6 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 14s Average build duration of successful builds.
  • all releases: 14s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • fhennig/pi_ir_remote
    6 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • fhennig

IR Remote Receiver

This crate provides a signal decoder for the commonly found 44-button infra red remote used commonly with LED strips. When an IR sensor is connected to a GPIO pin, this crate can decode the IR signals into which button was pressed.

Usage

This will read signals on GPIO 4 and print them:

use pi_ir_remote::read_ir_remote;
use pi_ir_remote::PrintSignalHandler;

fn main() {
    let handler = PrintSignalHandler::new();
    read_ir_remote(4, Box::new(handler));
}

You can make your own signal handler by implementing the SignalHandler trait:

pub trait SignalHandler {
    fn handle_signal(&mut self, signal: &Signal);
}

How it works

The IR remote sends pulse length encoded signals. Among other special pulses, there are a short and long pulse, corresponding to 0 and 1, allowing the transmission of binary data.

Every button is associated to a 32 bit word. This library includes the mapping of binary codes to buttons in the Signal enum.