Function hackrfone::iq_to_cplx_i8[][src]

pub fn iq_to_cplx_i8(i: u8, q: u8) -> Complex<i8>
This is supported on crate feature num-complex only.
Expand description

Convert an IQ sample pair to a complex number.


Post-processing sample data.

use hackrfone::{iq_to_cplx_i8, HackRfOne, RxMode, UnknownMode};

let mut radio: HackRfOne<UnknownMode> = HackRfOne::new().unwrap();
let mut radio: HackRfOne<RxMode> = radio.into_rx_mode()?;
let data: Vec<u8> = radio.rx()?;

for iq in data.chunks_exact(2) {
    let cplx: num_complex::Complex<i8> = iq_to_cplx_i8(iq[0], iq[1]);
    // .. do whatever you want with cplx here

Guide level explanation.

use hackrfone::iq_to_cplx_i8;
use num_complex::Complex;

assert_eq!(iq_to_cplx_i8(255, 1), Complex::new(-1, 1));