diff options
| author | Yuval Adam <_@yuv.al> | 2018-08-03 16:19:11 +0300 |
|---|---|---|
| committer | Yuval Adam <_@yuv.al> | 2018-08-03 16:19:11 +0300 |
| commit | a792fa11bea0bde00aa9aaf0aa6c2640bdb633a3 (patch) | |
| tree | 326a8959e28d331668fcc7b77d432470f342ce6f /src/devices | |
| parent | 66a288ca16b3490557d3d0f0357c21e28d9f3203 (diff) | |
Implement r820t init
Diffstat (limited to 'src/devices')
| -rw-r--r-- | src/devices/mod.rs | 4 | ||||
| -rw-r--r-- | src/devices/r820t.rs | 18 |
2 files changed, 19 insertions, 3 deletions
diff --git a/src/devices/mod.rs b/src/devices/mod.rs index 05dd2a3..659b131 100644 --- a/src/devices/mod.rs +++ b/src/devices/mod.rs @@ -1,3 +1,5 @@ +use usb::Usb; + pub mod fc0013; pub mod r820t; @@ -10,5 +12,5 @@ pub struct DeviceInfo { } pub trait Device { - fn init(&self); + fn init(&self, &Usb); } diff --git a/src/devices/r820t.rs b/src/devices/r820t.rs index fec572c..46046bc 100644 --- a/src/devices/r820t.rs +++ b/src/devices/r820t.rs @@ -1,4 +1,7 @@ use super::{DeviceInfo, Device}; +use usb::Usb; + +const R82XX_IF_FREQ: u32 = 3570000; pub struct R820T { pub device: DeviceInfo @@ -21,7 +24,18 @@ impl R820T { } impl Device for R820T { - fn init(&self) { - println!("Init {}", self.device.name); + fn init(&self, usb: &Usb) { + // disable Zero-IF mode + usb.demod_write_reg(1, 0xb1, 0x1a, 1); + + // only enable In-phase ADC input + usb.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 + usb.set_if_freq(R82XX_IF_FREQ); + + // enable spectrum inversion + usb.demod_write_reg(1, 0x15, 0x01, 1); } } |
