6 releases (stable)

Uses old Rust 2015

2.2.0 Apr 7, 2022
2.1.0 Nov 13, 2019
2.0.1 Jan 17, 2018
2.0.0 Jan 15, 2018

#520 in Hardware support

Download history 3/week @ 2024-11-17 11/week @ 2024-11-24 17/week @ 2024-12-01 32/week @ 2024-12-08 11/week @ 2024-12-15 53/week @ 2025-01-05 19/week @ 2025-01-12 6/week @ 2025-01-19 2/week @ 2025-01-26 27/week @ 2025-02-02 10/week @ 2025-02-09 28/week @ 2025-02-16 49/week @ 2025-02-23 36/week @ 2025-03-02

141 downloads per month
Used in rtltcp

GPL-2.0+

11KB
162 lines

rtlsdr_mt – High-level, multithreading interface to RTL-SDR

Documentation

This crate provides a high-level interface to the RTL-SDR that separates controlling the device and reading samples, for integration into multithreaded applications.

Example

This example reads incoming samples, printing the first I/Q pair, in the main thread while incrementing the receive frequency by 1kHz every second in a subthread.

let (mut ctl, mut reader) = rtlsdr_mt::open(0).unwrap();

ctl.enable_agc().unwrap();
ctl.set_ppm(-2).unwrap();
ctl.set_center_freq(774_781_250).unwrap();

std::thread::spawn(move || {
    loop {
        let next = ctl.center_freq() + 1000;
        ctl.set_center_freq(next).unwrap();

        std::thread::sleep(std::time::Duration::from_secs(1));
    }
});

reader.read_async(4, 32768, |bytes| {
    println!("i[0] = {}", bytes[0]);
    println!("q[0] = {}", bytes[1]);
}).unwrap();

Usage

This crate can be used through cargo by adding it as a dependency in Cargo.toml:

[dependencies]
rtlsdr_mt = "2.0.0"

and importing it in the crate root:

extern crate rtlsdr_mt;

Dependencies

~56KB