summaryrefslogtreecommitdiff
path: root/src/tuners/mod.rs
blob: 77341262e3d87e7d7c8f439bdd30dbc829e0cd47 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
use super::RtlSdrDeviceHandle;

pub mod fc0013;
pub mod r820t;

pub const KNOWN_TUNERS: [TunerInfo; 2] = [r820t::TUNER_INFO, fc0013::TUNER_INFO];

pub struct TunerInfo {
    pub id: &'static str,
    pub name: &'static str,
    pub i2c_addr: u8,
    pub check_addr: u8,
    pub check_val: u8,
    // pub gains: Vec<i8>,
}

pub trait Tuner {
    fn init(&self, handle: &RtlSdrDeviceHandle);
    fn exit(&self, handle: &RtlSdrDeviceHandle);
    fn set_frequency(&self, freq: u32, handle: &RtlSdrDeviceHandle);
    fn set_bandwidth(&mut self, rate: u32, handle: &RtlSdrDeviceHandle);
    fn set_gain(&self, gain: u32, handle: &RtlSdrDeviceHandle);
    fn set_if_gain(&self, if_gain: u32, handle: &RtlSdrDeviceHandle);
    fn set_gain_mode(&self, mode: bool, handle: &RtlSdrDeviceHandle);
    fn display(&self) -> &str;
}

pub enum Tuners {
    R820T(r820t::R820T),
    FC0013(fc0013::FC0013),
}