rfe
rfe is a Rust library for communicating with RF Explorer spectrum analyzers and signal generators over a USB virtual serial port.
Usage
Add the following to your Cargo.toml:
[]
= "0.1.0"
Connecting to an RF Explorer
rfe can search for an attached RF Explorer without knowing its port name or baud rate. It tries USB serial ports with the VID and PID used by the RF Explorer's Silicon Labs CP210x USB-to-UART bridge.
use ;
let spectrum_analyzer = connect?;
let signal_generator = connect?;
You can also connect to a known serial port and baud rate.
use ;
let spectrum_analyzer = connect_with_name_and_baud_rate?;
let signal_generator = connect_with_name_and_baud_rate?;
Collecting spectrum analyzer sweeps
rfe provides three APIs for reading spectrum analyzer sweeps.
Waiting for the next sweep
SpectrumAnalyzer::wait_for_next_sweep() blocks until the device reports a new sweep or the timeout elapses.
use SpectrumAnalyzer;
let rfe = connect?;
let sweep = rfe.wait_for_next_sweep?;
println!;
Reading the latest cached sweep
SpectrumAnalyzer::sweep() returns the most recently measured sweep, or None if no sweep has been received yet.
use SpectrumAnalyzer;
let rfe = connect?;
let sweep = rfe.sweep;
Receiving sweeps with a callback
SpectrumAnalyzer::set_sweep_callback() registers a callback that runs on a separate thread whenever a sweep is received.
use SpectrumAnalyzer;
let rfe = connect?;
rfe.set_sweep_callback;
Generating a signal with an RF Explorer Signal Generator
use ;
let rfe = connect?;
rfe.start_cw?;
Examples
Run the included examples with:
Troubleshooting
rfe uses the tracing crate to emit structured, event-based diagnostic information that can be collected by executables using the rfe library.
On Linux, the current user usually needs serial port access through the dialout or uucp group. See the top-level README for platform setup details.
License
This project is dual-licensed under the MIT License or Apache 2.0 License.