def __init__(self, *args, **kwargs): """ Hierarchical block for cc1k FSK modulation. The input is a byte stream (unsigned char) and the output is the complex modulated signal at baseband. @param spb: samples per baud >= 2 @type spb: integer """ try: self.spb = kwargs.pop('spb') except KeyError: pass gr.hier_block2.__init__(self, "ieee802_15_4_mod", gr.io_signature(1, 1, 1), # Input gr.io_signature(1, 1, gr.sizeof_gr_complex)) # Output if not isinstance(self.spb, int) or self.spb < 2: raise TypeError, "sbp must be an integer >= 2" self.symbolsToChips = ucla.symbols_to_chips_bi() self.chipsToSymbols = gr.packed_to_unpacked_ii(2, gr.GR_MSB_FIRST) self.symbolsToConstellation = gr.chunks_to_symbols_ic((-1-1j, -1+1j, 1-1j, 1+1j)) self.pskmod = ucla.qpsk_modulator_cc() self.delay = ucla.delay_cc(self.spb) # Connect self.connect(self, self.symbolsToChips, self.chipsToSymbols, self.symbolsToConstellation, self.pskmod, self.delay, self)
def __init__(self, *args, **kwargs): """ Hierarchical block for cc1k FSK modulation. The input is a byte stream (unsigned char) and the output is the complex modulated signal at baseband. @param spb: samples per baud >= 2 @type spb: integer """ try: self.spb = kwargs.pop('spb') except KeyError: pass gr.hier_block2.__init__(self, "ieee802_15_4_mod", gr.io_signature(1, 1, 1), # Input gr.io_signature(1, 1, gr.sizeof_gr_complex)) # Output if not isinstance(self.spb, int) or self.spb < 2: raise TypeError, "spb must be an integer >= 2" self.symbolsToChips = ucla.symbols_to_chips_bi() self.chipsToSymbols = gr.packed_to_unpacked_ii(2, gr.GR_MSB_FIRST) self.symbolsToConstellation = gr.chunks_to_symbols_ic((-1-1j, -1+1j, 1-1j, 1+1j)) self.pskmod = ucla.qpsk_modulator_cc() self.delay = ucla.delay_cc(self.spb) # Connect self.connect(self, self.symbolsToChips, self.chipsToSymbols, self.symbolsToConstellation, self.pskmod, self.delay, self)
def __init__(self, fg, spb = 2): """ Hierarchical block for cc1k FSK modulation. The input is a byte stream (unsigned char) and the output is the complex modulated signal at baseband. @param fg: flow graph @type fg: flow graph @param spb: samples per baud >= 2 @type spb: integer """ if not isinstance(spb, int) or spb < 2: raise TypeError, "sbp must be an integer >= 2" self.spb = spb self.symbolsToChips = ucla.symbols_to_chips_bi() self.chipsToSymbols = gr.packed_to_unpacked_ii(2, gr.GR_MSB_FIRST) self.symbolsToConstellation = gr.chunks_to_symbols_ic((-1-1j, -1+1j, 1-1j, 1+1j)) self.pskmod = ucla.qpsk_modulator_cc() self.delay = ucla.delay_cc(self.spb) # Connect fg.connect(self.symbolsToChips, self.chipsToSymbols, self.symbolsToConstellation, self.pskmod, self.delay) # Initialize base class gr.hier_block.__init__(self, fg, self.symbolsToChips, self.delay)
def build_graph(outfile): # Initialize our top block fg = gr.top_block() # Input input = [0x00, 0xa7] # Unsigned char source to use the input src = gr.vector_source_b(input) symbolsToChips = ucla.symbols_to_chips_bi() chipsToSymbols = gr.packed_to_unpacked_ii(2, gr.GR_MSB_FIRST) symbolsToConstellation = gr.chunks_to_symbols_ic((-1-1j, -1+1j, 1-1j, 1+1j)) pskmod = ucla.qpsk_modulator_cc() delay = ucla.delay_cc(2) # File sink fsink = gr.file_sink(gr.sizeof_gr_complex, outfile) fg.connect(src, symbolsToChips, chipsToSymbols, symbolsToConstellation, pskmod, delay, fsink) return fg