|
From: | Pradeep M C |
Subject: | [Discuss-gnuradio] Need help with debugging a source block OOT |
Date: | Wed, 31 Jul 2019 11:27:50 +0530 |
gr.sync_block.__init__(self,name="usb_com_read",in_sig=None,out_sig=[numpy.int32])
"""code to initialise serial port and create self.buff"""
"""
Lock mutex
read from the serial port.
write the data into self.buff[]
Unlock mutex
"""
# Acquire the lock
# copy buffer to out
# delete the self.buff contents
# Release the lock
out = output_items[0]
out_len = len(out)
buff_len = len(self.buff)
# take care of overflow
if out_len < buff_len:
copy_len = out_len
else:
copy_len = buff_len
with self.buff_lock:
out[0:copy_len] = self.buff[0:copy_len]
# debug prints
if copy_len:
print(self.buff[:])
print(out[:copy_len])
# empty the buffer
del self.buff[:]
return copy_len
# return len(out)
[Prev in Thread] | Current Thread | [Next in Thread] |