summaryrefslogtreecommitdiff
path: root/src/tuners
diff options
context:
space:
mode:
Diffstat (limited to 'src/tuners')
-rw-r--r--src/tuners/fc0013.rs25
-rw-r--r--src/tuners/mod.rs5
-rw-r--r--src/tuners/r820t.rs33
3 files changed, 34 insertions, 29 deletions
diff --git a/src/tuners/fc0013.rs b/src/tuners/fc0013.rs
index fed1289..14e7970 100644
--- a/src/tuners/fc0013.rs
+++ b/src/tuners/fc0013.rs
@@ -1,9 +1,9 @@
use super::{Tuner, TunerInfo};
use usb::RtlSdrDeviceHandle;
-pub struct FC0013<'a> {
+pub struct FC0013 {
pub device: TunerInfo,
- pub handle: &'a RtlSdrDeviceHandle,
+ // pub handle: &'a RtlSdrDeviceHandle,
}
pub const TUNER_ID: &str = "fc0013";
@@ -14,22 +14,23 @@ pub const TUNER_INFO: TunerInfo = TunerInfo {
i2c_addr: 0xc6,
check_addr: 0x00,
check_val: 0xa3,
+ // gains: vec![
+ // -99, -73, -65, -63, -60, -58, -54, 58, 61, 63, 65, 67, 68, 70, 71, 179, 181, 182, 184, 186,
+ // 188, 191, 197,
+ // ],
};
-impl<'a> FC0013<'a> {
- pub fn new(handle: &'a RtlSdrDeviceHandle) -> FC0013<'a> {
- let tuner = FC0013 {
- device: TUNER_INFO,
- handle: handle,
- };
- tuner.init();
+impl FC0013 {
+ pub fn new(handle: &RtlSdrDeviceHandle) -> FC0013 {
+ let tuner = FC0013 { device: TUNER_INFO };
+ tuner.init(handle);
tuner
}
}
-impl<'a> Tuner for FC0013<'a> {
- fn init(&self) {
- println!("Init {}", self.device.name);
+impl Tuner for FC0013 {
+ fn init(&self, _handle: &RtlSdrDeviceHandle) {
+ unimplemented!()
}
fn exit(&self) {
diff --git a/src/tuners/mod.rs b/src/tuners/mod.rs
index 0739fad..ae64384 100644
--- a/src/tuners/mod.rs
+++ b/src/tuners/mod.rs
@@ -1,3 +1,5 @@
+use super::RtlSdrDeviceHandle;
+
pub mod fc0013;
pub mod r820t;
@@ -7,10 +9,11 @@ pub struct TunerInfo {
pub i2c_addr: u8,
pub check_addr: u8,
pub check_val: u8,
+ // pub gains: Vec<i8>,
}
pub trait Tuner {
- fn init(&self);
+ fn init(&self, handle: &RtlSdrDeviceHandle);
fn exit(&self);
fn set_freq(&self, freq: u32);
fn set_bw(&self, bw: u32);
diff --git a/src/tuners/r820t.rs b/src/tuners/r820t.rs
index 9844b41..14d54e8 100644
--- a/src/tuners/r820t.rs
+++ b/src/tuners/r820t.rs
@@ -3,9 +3,9 @@ use usb::RtlSdrDeviceHandle;
const R82XX_IF_FREQ: u32 = 3570000;
-pub struct R820T<'a> {
+pub struct R820T {
pub device: TunerInfo,
- pub handle: &'a RtlSdrDeviceHandle,
+ // pub handle: &'a RtlSdrDeviceHandle,
}
pub const TUNER_ID: &str = "r820t";
@@ -16,39 +16,40 @@ pub const TUNER_INFO: TunerInfo = TunerInfo {
i2c_addr: 0x34,
check_addr: 0x00,
check_val: 0x69,
+ // gains: vec![
+ // 0, 9, 14, 27, 37, 77, 87, 125, 144, 157, 166, 197, 207, 229, 254, 280, 297, 328, 338, 364,
+ // 372, 386, 402, 421, 434, 439, 445, 480, 496,
+ // ],
};
-impl<'a> R820T<'a> {
- pub fn new(handle: &'a RtlSdrDeviceHandle) -> R820T<'a> {
- let tuner = R820T {
- device: TUNER_INFO,
- handle: handle,
- };
- tuner.init();
+impl R820T {
+ pub fn new(handle: &RtlSdrDeviceHandle) -> R820T {
+ let tuner = R820T { device: TUNER_INFO };
+ tuner.init(handle);
tuner
}
}
-impl<'a> Drop for R820T<'a> {
+impl Drop for R820T {
fn drop(&mut self) {
self.exit();
}
}
-impl<'a> Tuner for R820T<'a> {
- fn init(&self) {
+impl Tuner for R820T {
+ fn init(&self, handle: &RtlSdrDeviceHandle) {
// disable Zero-IF mode
- self.handle.demod_write_reg(1, 0xb1, 0x1a, 1);
+ handle.demod_write_reg(1, 0xb1, 0x1a, 1);
// only enable In-phase ADC input
- self.handle.demod_write_reg(0, 0x08, 0x4d, 1);
+ handle.demod_write_reg(0, 0x08, 0x4d, 1);
// the R82XX use 3.57 MHz IF for the DVB-T 6 MHz mode, and
// 4.57 MHz for the 8 MHz mode
- self.handle.set_if_freq(R82XX_IF_FREQ);
+ handle.set_if_freq(R82XX_IF_FREQ);
// enable spectrum inversion
- self.handle.demod_write_reg(1, 0x15, 0x01, 1);
+ handle.demod_write_reg(1, 0x15, 0x01, 1);
}
fn exit(&self) {}