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];
for _ in 0..10 {
radio.read(&mut buf)?;
// Process samples...
}
// The radio may continue transmitting/receiving if not dropped.
// Be sure to include a Control+C handler to cleanly return.
drop(radio);
Ok(())
}
§License
This crate is licensed under the MIT License.
Structs§
- Config
- Configurable parameters on the hackrf
- HackRf
- HackRF One software defined radio.
- RxStream
- Represents an asynchronous receive stream from the HackRF device.
- TxStream
- Represents an asynchronous transmit stream to the HackRF device.
- UsbVersion
- A three-part version consisting of major, minor, and sub minor components.
Enums§
Type Aliases§
- Result
- Result type for operations that may return an
Error
.