diff options
| author | Yuval Adam <_@yuv.al> | 2021-04-16 15:25:19 +0300 |
|---|---|---|
| committer | Yuval Adam <_@yuv.al> | 2021-04-17 10:33:57 +0300 |
| commit | 10d566acd2bcd35c8969fc7991b050da01ceb74c (patch) | |
| tree | a641014fb02c69eabbe1ab1ca1cde19b4179d209 /src/devices | |
| parent | ef64d358a25e69e440305e1216824921536d5587 (diff) | |
Pass handle as reference to tuner and implement Drop
Diffstat (limited to 'src/devices')
| -rw-r--r-- | src/devices/r820t.rs | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/devices/r820t.rs b/src/devices/r820t.rs index 92ba509..a257b56 100644 --- a/src/devices/r820t.rs +++ b/src/devices/r820t.rs @@ -3,9 +3,9 @@ use usb::RtlSdrDeviceHandle; const R82XX_IF_FREQ: u32 = 3570000; -pub struct R820T { +pub struct R820T<'a> { pub device: DeviceInfo, - pub handle: RtlSdrDeviceHandle, + pub handle: &'a RtlSdrDeviceHandle, } pub const DEVICE_INFO: DeviceInfo = DeviceInfo { @@ -16,8 +16,8 @@ pub const DEVICE_INFO: DeviceInfo = DeviceInfo { check_val: 0x69, }; -impl R820T { - pub fn new(handle: RtlSdrDeviceHandle) -> R820T { +impl<'a> R820T<'a> { + pub fn new(handle: &'a RtlSdrDeviceHandle) -> R820T<'a> { R820T { device: DEVICE_INFO, handle: handle, @@ -25,7 +25,11 @@ impl R820T { } } -impl Device for R820T { +impl<'a> Drop for R820T<'a> { + fn drop(&mut self) {} +} + +impl<'a> Device for R820T<'a> { fn init(&self) { // disable Zero-IF mode self.handle.demod_write_reg(1, 0xb1, 0x1a, 1); |
