aboutsummaryrefslogtreecommitdiffstats
path: root/python/trx/radio_if.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/trx/radio_if.py')
-rw-r--r--python/trx/radio_if.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/python/trx/radio_if.py b/python/trx/radio_if.py
index d2afcf6..407e724 100644
--- a/python/trx/radio_if.py
+++ b/python/trx/radio_if.py
@@ -4,7 +4,7 @@
# GR-GSM based transceiver
# Follow graph implementation
#
-# (C) 2016-2017 by Vadim Yanitskiy <axilirator@gmail.com>
+# (C) 2016-2018 by Vadim Yanitskiy <axilirator@gmail.com>
# (C) 2017 by Piotr Krysik <ptrkrysik@gmail.com>
#
# All Rights Reserved
@@ -29,6 +29,7 @@ import grgsm
from math import pi
+from gnuradio import eng_notation
from gnuradio import digital
from gnuradio import blocks
from gnuradio import uhd
@@ -59,6 +60,7 @@ class dict_toggle_sign(gr.basic_block):
class radio_if(gr.top_block):
# PHY specific variables
+ freq_offset_hz = None
rx_freq = 935e6
tx_freq = 890e6
osr = 4
@@ -274,11 +276,21 @@ class radio_if(gr.top_block):
return self.ppm / 1.0e6 * 2 * pi * fc / self.sample_rate
def set_rx_freq(self, fc):
+ if self.freq_offset_hz is not None:
+ fc += self.freq_offset_hz
+ print("[#] Shifting RX freq. to %s (offset is %s)"
+ % (eng_notation.num_to_str(fc),
+ eng_notation.num_to_str(self.freq_offset_hz)))
self.phy_src.set_center_freq(fc, 0)
self.rotator_src.set_phase_inc(self.calc_phase_inc(fc))
self.rx_freq = fc
def set_tx_freq(self, fc):
+ if self.freq_offset_hz is not None:
+ fc += self.freq_offset_hz
+ print("[#] Shifting TX freq. to %s (offset is %s)"
+ % (eng_notation.num_to_str(fc),
+ eng_notation.num_to_str(self.freq_offset_hz)))
self.phy_sink.set_center_freq(fc, 0)
self.rotator_sink.set_phase_inc(-self.calc_phase_inc(fc))
self.tx_freq = fc