#hackrf #api-bindings #sample-rate #libhackrf #set-freq

libhackrf

A modern libhackrf wrapper that supports receiving and transmitting

2 releases

0.1.1 Feb 22, 2025
0.1.0 Feb 21, 2025

#939 in Math

MIT license

17KB
357 lines

libhackrf-rs

A modern libhackrf wrapper that supports receiving and transmitting.

Example

See the fm_transmit crate for a more complete example of how to use this library, it allows transmitting and receiving frequency modulated audio signals.

let hackrf = HackRf::open()?;
hackrf.set_sample_rate(2_000_000)?;
hackrf.set_freq(100_000_000)?;
hackrf.set_txvga_gain(16)?;

hackrf.start_tx(
    |_hackrf, buffer, _user| {
        for sample in buffer.iter_mut() {
            *sample = Complex::ZERO;
        }
    },
    (),
)?;

loop { thread::park() }

Dependencies

~265KB