Skip to content

Commit

Permalink
add ptt commands to constructor in red_pitaya_sink
Browse files Browse the repository at this point in the history
  • Loading branch information
pavel-demin committed Nov 29, 2015
1 parent 7e2ed36 commit d88abd7
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions projects/sdr_transceiver/gnuradio/red_pitaya.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,16 @@ def __init__(self, addr, port, freq, rate, corr, ptt):
fd = os.dup(self.data_sock.fileno())
self.null_sink = blocks.null_sink(gr.sizeof_gr_complex)
self.file_sink = blocks.file_descriptor_sink(gr.sizeof_gr_complex, fd)
self.connect(self, self.null_sink)
self.ptt = ptt
self.set_freq(freq, corr)
self.set_rate(rate)
if ptt:
self.ptt = True
self.ctrl_sock.send(struct.pack('<I', 2<<28))
self.connect(self, self.file_sink)
else:
self.ptt = False
self.ctrl_sock.send(struct.pack('<I', 3<<28))
self.connect(self, self.null_sink)

def set_freq(self, freq, corr):
self.ctrl_sock.send(struct.pack('<I', 0<<28 | int((1.0 + 1e-6 * corr) * freq)))
Expand Down

0 comments on commit d88abd7

Please sign in to comment.