Struct SweepParams

Source
pub struct SweepParams {
    pub sample_rate_hz: u32,
    pub freq_mhz: Vec<(u16, u16)>,
    pub blocks_per_tuning: u16,
    pub step_width_hz: u32,
    pub offset_hz: u32,
    pub mode: SweepMode,
}
Expand description

Configuration settings for a receive sweep across multiple frequencies.

The easiest way to configure this is to call SweepParams::init_sample_rate, then to add the desired frequency pairs to sweep over. There shouldn’t be more than 10 pairs.

The recommended usage adds an offset to the center frequency, such that the lower edge of the baseband filter aligns with the lower limit of the sweep. The step width is then 4/3 of the baseband filter.

The blocks_per_tuning parameter determines how many SweepBuf blocks at a tuned frequency come out in a row. The blocks are not consecutive samples; the HackRF briefly turns off between sample blocks.

It’s really best to think of this is a tool for spectrum sensing, not active demodulation.

Fields§

§sample_rate_hz: u32

Sample rate to operate at.

§freq_mhz: Vec<(u16, u16)>

List of frequency pairs to sweep over, in MHz. There can be up to 10.

§blocks_per_tuning: u16

Number of blocks to capture per tuning. Each block is 16384 bytes, or 8192 samples.

§step_width_hz: u32

Width of each tuning step, in Hz. sample_rate is a good value, in general.

§offset_hz: u32

Frequency offset added to tuned frequencies. Sample_rate*3/8 is a good value for Interleaved sweep mode.

§mode: SweepMode

Sweep mode.

Implementations§

Source§

impl SweepParams

Source

pub fn init_sample_rate(sample_rate_hz: u32) -> Self

Initialize the sweep parameters with some sane defaults, given a sample rate.

See the main SweepParams documentation for more info.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.