def test_const_s(self): tb = self.tb expected_result = (1, 1, 1, 1) src1 = gr.sig_source_s(1e6, gr.GR_CONST_WAVE, 0, 1) op = gr.head(gr.sizeof_short, 4) dst1 = gr.vector_sink_s() tb.connect(src1, op) tb.connect(op, dst1) tb.run() dst_data = dst1.data() self.assertEqual(expected_result, dst_data)
def test_sqr_s(self): tb = self.tb expected_result = (0, 0, 0, 0, 1, 1, 1, 1, 0) src1 = gr.sig_source_s(8, gr.GR_SQR_WAVE, 1.0, 1.0) op = gr.head(gr.sizeof_short, 9) dst1 = gr.vector_sink_s() tb.connect(src1, op) tb.connect(op, dst1) tb.run() dst_data = dst1.data() self.assertEqual(expected_result, dst_data)
def build_graph(self, device, speed): self.src = gr.sig_source_s(2, gr.GR_CONST_WAVE, 1, 0, 1) self.sink = gr.null_sink(gr.sizeof_short) self.spi = gr_spi.gr_spi_srcsink_ss() sys.stdout.write("Blocks created\n") self.spi.open_spi(device, speed) sys.stdout.write("SPI device open\n") self.connect(self.src, self.spi) sys.stdout.write("Source connected\n") self.connect(self.spi, self.sink) sys.stdout.write("Sink connected\n")
def build_graph(self,device,speed): self.src = gr.sig_source_s(2,gr.GR_CONST_WAVE,1,0,1) self.sink = gr.null_sink(gr.sizeof_short) self.spi = gr_spi.gr_spi_srcsink_ss() sys.stdout.write("Blocks created\n") self.spi.open_spi(device,speed) sys.stdout.write("SPI device open\n") self.connect(self.src,self.spi) sys.stdout.write("Source connected\n") self.connect(self.spi,self.sink) sys.stdout.write("Sink connected\n")
def test_const_s (self): tb = self.tb expected_result = (1, 1, 1, 1) src1 = gr.sig_source_s (1e6, gr.GR_CONST_WAVE, 0, 1) op = gr.head (gr.sizeof_short, 4) dst1 = gr.vector_sink_s () tb.connect (src1, op) tb.connect (op, dst1) tb.run () dst_data = dst1.data () self.assertEqual (expected_result, dst_data)
def test_sqr_s (self): tb = self.tb expected_result = (0, 0, 0, 0, 1, 1, 1, 1, 0) src1 = gr.sig_source_s (8, gr.GR_SQR_WAVE, 1.0, 1.0) op = gr.head (gr.sizeof_short, 9) dst1 = gr.vector_sink_s () tb.connect (src1, op) tb.connect (op, dst1) tb.run () dst_data = dst1.data () self.assertEqual (expected_result, dst_data)