Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bias-T checkbox for RTL-SDR device settings screen #1056

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/urh/dev/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@
"bandwidth": dev_range(start=1, stop=int(3.2 * M), step=1),
"rx_rf_gain": list(range(-100, 500)),
"direct_sampling": ["disabled", "I-ADC input enabled", "Q-ADC input enabled"],
"freq_correction": dev_range(start=-1 * 10 ** 3, stop=1 * 10 ** 3, step=1)
"freq_correction": dev_range(start=-1 * 10 ** 3, stop=1 * 10 ** 3, step=1),
"bias_tee_enabled": [False, True]
}

DEVICE_CONFIG["RTL-TCP"] = copy.deepcopy(DEVICE_CONFIG["RTL-SDR"])
Expand Down
4 changes: 3 additions & 1 deletion src/urh/dev/native/RTLSDR.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ class RTLSDR(Device):
Device.Command.SET_RF_GAIN.name+"_get_allowed_values": "get_tuner_gains",
Device.Command.SET_BANDWIDTH.name: "set_tuner_bandwidth",
Device.Command.SET_FREQUENCY_CORRECTION.name: "set_freq_correction",
Device.Command.SET_DIRECT_SAMPLING_MODE.name: "set_direct_sampling"
Device.Command.SET_DIRECT_SAMPLING_MODE.name: "set_direct_sampling",
Device.Command.SET_BIAS_TEE_ENABLED.name: "set_bias_tee"
})

DATA_TYPE = np.int8
Expand Down Expand Up @@ -77,6 +78,7 @@ def device_parameters(self):
(self.Command.SET_FREQUENCY_CORRECTION.name, self.freq_correction),
(self.Command.SET_DIRECT_SAMPLING_MODE.name, self.direct_sampling_mode),
(self.Command.SET_RF_GAIN.name, self.gain),
(self.Command.SET_BIAS_TEE_ENABLED.name, self.bias_tee_enabled),
("identifier", self.device_number)])

@property
Expand Down
2 changes: 2 additions & 0 deletions src/urh/dev/native/lib/crtlsdr.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,5 @@ cdef extern from "rtl-sdr.h":

int rtlsdr_read_async(rtlsdr_dev_t *dev, rtlsdr_read_async_cb_t cb, void *ctx, uint32_t buf_num, uint32_t buf_len);
int rtlsdr_cancel_async(rtlsdr_dev_t *dev)

int rtlsdr_set_bias_tee(rtlsdr_dev_t *dev, int on)
8 changes: 8 additions & 0 deletions src/urh/dev/native/lib/rtlsdr.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -332,3 +332,11 @@ cpdef int cancel_async():
:return: 0 on success
"""
return crtlsdr.rtlsdr_cancel_async(_c_device)

cpdef int set_bias_tee(int on):
"""
Enable or disable the bias tee on GPIO PIN 0.

return -1 if device is not initialized. 0 otherwise.
"""
return crtlsdr.rtlsdr_set_bias_tee (_c_device, on)
Loading