Crate seify_hackrfone

Source
Expand description

§HackRF One API

This crate provides a Rust interface to the HackRF One, a popular software-defined radio (SDR) peripheral. It allows for transmitting and receiving radio signals using the HackRF One device in pure Rust.

§Example

use anyhow::Result;
use seify_hackrfone::{Config, HackRf};

fn main() -> Result<()> {
    let radio = HackRf::open_first()?;

    radio.start_rx(&Config {
        vga_db: 0,
        txvga_db: 0,
        lna_db: 0,
        amp_enable: false,
        antenna_enable: false,
        frequency_hz: 915_000_000,
        sample_rate_hz: 2_000_000,
        sample_rate_div: 1,
    })?;

    let mut buf = vec![0u8; 32 * 1024];
    loop {
        radio.read(&mut buf)?;
        // Process samples...
    }
}

§License

This crate is licensed under the MIT License.

Structs§

AtomicMode
A wrapper around Mode which can be safely shared between threads.
Config
Configurable parameters on the hackrf
HackRf
HackRF One software defined radio.
RxStream
Represents an asynchronous receive stream from the HackRF device.
UsbVersion
A three-part version consisting of major, minor, and sub minor components.

Enums§

Error
HackRF One errors.
Mode
Operating modes of the HackRF One.

Type Aliases§

Result
Result type for operations that may return an Error.