| Crates.io | dverf |
| lib.rs | dverf |
| version | 0.1.5 |
| created_at | 2025-03-28 21:06:09.985952+00 |
| updated_at | 2025-05-15 11:11:02.643142+00 |
| description | HackRF One toolkit in pure Rust |
| homepage | https://github.com/sigma-logic/dverf#readme |
| repository | https://github.com/sigma-logic/dverf.git |
| max_upload_size | |
| id | 1610400 |
| size | 35,588 |
Powerful SDR toolkit designed in pure Rust for HackRF One
Open usb device as you like with nusb crate
use dverf::{Device, VENDOR_ID};
fn open() -> anyhow::Result<Device> {
let device_info = nusb::list_devices()?
.find(|dev| dev.vendor_id() == VENDOR_ID && dev.product_id() == 0x6089)
.context("device not connected")?;
let device = device_info.open().context("failed to open device")?;
let interface = device.claim_interface(0)?;
Ok(Device::from_interface(interface))
}
Identical interface to libhackrf
device.set_freq(2412, 0).await?;
device.set_sample_rate(200_000_000, 10).await?;
device.set_baseband_filter_bandwidth(15_000_000).await?;
device.set_lna_gain(40).await?;
device.set_vga_gain(8).await?;
device.set_transceiver_mode(TransceiverMode::Receive).await?;
Device implements futures::Stream, so just do what you normally do with async streams
// Returns Option<Result<Vec<Sample>>>
// Just like ordinary async stream
let chunk = device.next().await;
// Do something with the chunk received
Device implements futures::Sink for transmitting by pushing chunk of samples into Sink.
Note that you must have precise control over the sample chunk feed to avoid gaps.
device.set_transceiver_mode(TransceiverMode::Transmit).await?;
// Cast Device to `&mut impl Sink<...> + Unpin`
// to keep type across `SinkExt` calls
let sink = device.as_sink();
// Feed chunks
for chunk in samples_iter {
sink.feed(chunk).await?;
}
// Flush when you finish transmitting
sink.flush().await?;
Licensed under either of
at your option.