def _build_subpanel4(self, vbox_arg):

        panel = self.panel
        vbox = vbox_arg
        myform = self.myform

        hbox = wx.BoxSizer(wx.HORIZONTAL)


        hbox.Add((5,0), 0, 0)#Add space between the previous and next box, horizontally

        # Create a bar or slider horizontally, it is labeled "LO frequency" and it moves in the interval [20M,30M] Hz,once it is moved it calls back to the function set_lo_freq 
        myform['lofreq'] = form.slider_field(parent=self.panel,
                                               sizer=hbox, label="LO frequency (Hz)",
                                               weight=3,
                                               min=20000000, max=30000000,
                                               callback=self.set_lo_freq)
        hbox.Add((10,0), 0)

	#Create a checkbox to produce LO signal (the signal will go out when the box is ticked)
        myform['LO'] = form.checkbox_field(parent=panel,        label="LO generator", sizer=hbox, callback=self.begin_thread2)
       
        

        vbox.AddSpacer(5)

        vbox.Add(hbox, 0, wx.EXPAND)
        vbox.AddSpacer(5)
Beispiel #2
0
    def _create_dac_offset_helper(self, vbox, i_or_q):

        def doit(kv):
            drive_positive = kv['drive_positive']
            dac_offset = kv['dac_offset']
            print "drive_positive =", drive_positive
            print "dac_offset[%d] = %4d" % (i_or_q, dac_offset)
            
            # FIXME signed magnitude??
            # dac_offset = signed_mag10(dac_offset)
            return self._set_dac_offset(i_or_q, dac_offset, int(drive_positive))
        
        def signed_mag10(x):
            # not clear from doc if this is really 2's comp or 10-bit signed magnitude
            # we'll guess it's 10-bit signed mag
            if x < 0:
                return (1 << 9) | min(511, max(0, abs(x)))
            else:
                return (0 << 9) | min(511, max(0, abs(x)))

        myform = form.form()
        hbox = wx.BoxSizer(wx.HORIZONTAL)
        vbox.Add(hbox, 0, wx.EXPAND)
        myform['drive_positive'] = form.checkbox_field(parent=self.panel, sizer=hbox,
                                                       callback=myform.check_input_and_call(doit),
                                                       weight=0,
                                                       label="drive +ve")
        myform['dac_offset'] = form.slider_field(parent=self.panel, sizer=hbox,
                                                 callback=myform.check_input_and_call(doit),
                                                 min=-512, max=511, value=0,
                                                 weight=5)
    def _build_subpanel3(self, vbox_arg):

        panel = self.panel
        vbox = vbox_arg
        myform = self.myform

	def _form_set_nsamples(kv):
            return self.set_nsamples(kv['numsamp'])



 

	def _form_set_filename(kv):
            return self.set_filename(kv['fname'])

        hbox = wx.BoxSizer(wx.HORIZONTAL)
	hbox.Add((5,0), 0)
        myform['fname'] = form.text_field(
            parent=panel, sizer=hbox, label="Filename",
            callback=myform.check_input_and_call(_form_set_filename,
                                                 self._set_status_msg))
	hbox.Add((5,0), 0)
        myform['numsamp'] = form.float_field(
            parent=panel, sizer=hbox, label="Number of Samples",
            callback=myform.check_input_and_call(_form_set_nsamples,
                                                 self._set_status_msg))



        hbox.Add((10,0), 0)

	#Create a button to save data
        #myform['savefile'] = form.button_with_callback(parent=panel,      label="Save Data", callback=myform.check_input_and_call(self.set_gain))
        myform['savefile'] = form.checkbox_field(parent=panel,        label="Save Data", sizer=hbox, callback=self.save_data)
       
        

        vbox.AddSpacer(5)

        vbox.Add(hbox, 0, wx.EXPAND)
        vbox.AddSpacer(5)
    def _build_subpanel5(self, vbox_arg):

        panel = self.panel
        vbox = vbox_arg
        myform = self.myform

        hbox = wx.BoxSizer(wx.HORIZONTAL)



        hbox.Add((10,0), 0)

	#Create a checkbox to produce LO signal (the signal will go out when the box is ticked)
        myform['inte'] = form.checkbox_field(parent=panel,        label="Begin integration", sizer=hbox, callback=self.integrate)
       
        

        vbox.AddSpacer(5)

        vbox.Add(hbox, 0, wx.EXPAND)
        vbox.AddSpacer(5)
Beispiel #5
0
    def _create_dac_offset_helper(self, vbox, i_or_q):
        def doit(kv):
            drive_positive = kv['drive_positive']
            dac_offset = kv['dac_offset']
            print "drive_positive =", drive_positive
            print "dac_offset[%d] = %4d" % (i_or_q, dac_offset)

            # FIXME signed magnitude??
            # dac_offset = signed_mag10(dac_offset)
            return self._set_dac_offset(i_or_q, dac_offset,
                                        int(drive_positive))

        def signed_mag10(x):
            # not clear from doc if this is really 2's comp or 10-bit signed magnitude
            # we'll guess it's 10-bit signed mag
            if x < 0:
                return (1 << 9) | min(511, max(0, abs(x)))
            else:
                return (0 << 9) | min(511, max(0, abs(x)))

        myform = form.form()
        hbox = wx.BoxSizer(wx.HORIZONTAL)
        vbox.Add(hbox, 0, wx.EXPAND)
        myform['drive_positive'] = form.checkbox_field(
            parent=self.panel,
            sizer=hbox,
            callback=myform.check_input_and_call(doit),
            weight=0,
            label="drive +ve")
        myform['dac_offset'] = form.slider_field(
            parent=self.panel,
            sizer=hbox,
            callback=myform.check_input_and_call(doit),
            min=-512,
            max=511,
            value=0,
            weight=5)
Beispiel #6
0
    def make_control(self):
        bspace = 10
        vbox = wx.BoxSizer(wx.VERTICAL)
        
        """ Frequency """
        nbox = wx.BoxSizer(wx.HORIZONTAL)
        self.make_label("Carrier Frequency", nbox, 46)
        self.freq = form.float_field (self, nbox, \
                value=default_control_setup.d_options['freq'], callback=self.SetFreq)
        self.AddParam('freq',self.SetFreq)
        self.SetParam('freq', self.options.freq)
        vbox.AddSpacer((10,10) )
        vbox.Add(nbox, 0, wx.ALIGN_LEFT|wx.BOTTOM|wx.LEFT|wx.RIGHT, border=bspace)
        
        """ Sample Rate """
        nbox = wx.BoxSizer(wx.HORIZONTAL)
        self.make_label("Sample Rate", nbox, 80)
        self.sample_rate = form.float_field (self, nbox, \
                value=self.options.sample_rate, callback=self.SetSampleRate)
        self.AddParam('sample_rate', self.SetSampleRate)
        self.SetParam('sample_rate', self.options.sample_rate)
        vbox.Add(nbox, 0, wx.ALIGN_LEFT|wx.BOTTOM|wx.LEFT|wx.RIGHT, border=bspace)
        
        """ Upsampling Factor """
        nbox = wx.BoxSizer(wx.HORIZONTAL)
        self.make_label("Upsampling Factor", nbox, 43)
        self.upsample = form.int_field (self, nbox, \
                value=self.options.upsample, callback=self.SetUpsample)
        self.AddParam('upsampling_factor', self.SetUpsample)
        self.SetParam('upsampling_factor', self.options.upsample)
        vbox.Add(nbox, 0, wx.ALIGN_LEFT|wx.BOTTOM|wx.LEFT|wx.RIGHT, border=bspace)
        self.upsamplebox = nbox

        """ TxGain """
        box = wx.BoxSizer(wx.HORIZONTAL)
        self.txgain = form.slider_field(self, box, "Transmit Gain",\
                value=self.options.tx_gain, callback=self.SetTxGain,
                min=0, max=10000.0)
        box.AddSpacer((10,10) )
        self.autotxgain = form.checkbox_field(self, box, "auto", \
                value=self.options.auto_tx_gain, callback=self.SetAutoTxGain, \
                weight=0)
        box.GetItem(self.autotxgain.f).SetFlag(wx.ALIGN_LEFT|wx.ALIGN_BOTTOM)
        self.AddParam('auto_tx_gain', self.SetAutoTxGain)
        self.SetParam('auto_tx_gain', self.options.auto_tx_gain)
        self.AddParam('tx_gain', self.SetTxGain)
        self.SetParam('tx_gain', self.options.tx_gain)
        vbox.Add(box, 0, wx.ALIGN_LEFT|wx.BOTTOM|wx.LEFT|wx.RIGHT, border=bspace)
        self.txgainbox = box

        """ RxGain """
        box = wx.BoxSizer(wx.HORIZONTAL)
        self.rxgain = form.slider_field(self, box, "Receive Gain", \
                value=self.options.rx_gain, callback=self.SetRxGain,
                min=0, max=75)
        self.AddParam('rx_gain', self.SetRxGain)
        self.SetParam('rx_gain', self.options.rx_gain)
        vbox.Add(box, 0, wx.ALIGN_LEFT|wx.BOTTOM|wx.LEFT|wx.RIGHT, border=bspace)

        self.topbox.Add(vbox, 0, wx.GROW)
        self.cbox = vbox
        self.Fit()
Beispiel #7
0
    def make_control(self):
        bspace = 10
        PyHydra.control.make_control(self)

        self.AddLocalMacAddress()
        
        """ Create MCS choicebox_field """
        box = wx.BoxSizer(wx.HORIZONTAL)
        self.make_label("MCS", box, 35)
        self.mcsfield = PyHydra.choicebox_field(self, box, \
                        value="Auto", callback = self.SetMCS, \
                        choices = MimoControl.MCS_CHOICES)
        self.mcsfield.f.SetToolTipString("Select Modulation and Coding Scheme")
        self.AddParam('rate', self.SetMCS)
        self.AddParam('mcs', self.SetMCS)
        if self.options.rate<0: self.SetParam('mcs', "Auto")
        else: self.SetParam('mcs', self.options.rate)
        self.cbox.Add (box, 0, wx.ALIGN_LEFT|wx.ALL, border = bspace)

        ## Create divider
        divider = PyHydra.Divider(self)
        divider.SetBackgroundColour(wx.Colour(200,200,200) )
        self.cbox.AddSpacer((10,10))
        self.cbox.Add(divider, 0, wx.EXPAND|wx.GROW)
        self.cbox.AddSpacer((10,10))
        
        """ Packet Detector Threshold """
        box = wx.BoxSizer(wx.VERTICAL)
        self.pd_threshold = form.slider_field(self, box,  \
                "Packet Detector Threshold (%)", value=self.options.pd_threshold,
                callback=self.SetPacketDetectorThreshold, min=20, max=100)
        self.AddParam('pd_threshold', self.SetPacketDetectorThreshold)
        self.SetParam('pd_threshold', self.options.pd_threshold)
        self.cbox.Add(box, 0, wx.ALIGN_LEFT|wx.ALL, border=bspace)

        """ Enable Beamforming """
        box = wx.BoxSizer(wx.HORIZONTAL)
        self.make_label("Enable Beamforming: ", box, 20)
        self.enable_beamforming = form.radiobox_field(self, box, label="", \
                value = MimoControl.ENABLE_CHOICES[self.options.enable_beamforming], \
                callback=self.SetEnableBeamforming,     \
                choices = MimoControl.ENABLE_CHOICES, major_dimension=0)
        #box.Hide(1, recursive=True), box.Remove(1) # Remove default form label
        self.enable_beamforming.f.SetLabel("")
        self.AddParam('enable_beamforming', self.SetEnableBeamforming)
        self.SetParam('enable_beamforming', self.options.enable_beamforming)
        self.cbox.Add(box, 0, wx.ALIGN_LEFT|wx.ALL, border=bspace)

        """ MAC Monitor Address """
        vbox = wx.BoxSizer(wx.VERTICAL)
        self.monitor = MimoControl.BROADCAST_ADDR
        f = form.static_text_field(self, vbox, value="Monitoring MAC Address: ")
        vbox.AddSpacer((10,10) )
        box = wx.BoxSizer(wx.HORIZONTAL)
        self.fmonitor = form.text_field(self, box, \
                value="FF:"*(mimo.mac_monitor.MAC_ADDR_SIZE-1)+"FF", \
                callback=self.SetMonitor, weight=1)
        self.AddParam('mac_monitor', self.SetMonitor)
        box.AddSpacer((10,10) )
        self.enable_monitor = form.checkbox_field(self, box, "monitor?", \
                value=False, callback=self.SetEnableMonitor, \
                weight=0)
        box.AddSpacer((100,10) )
        vbox.Add(box, 0, wx.EXPAND)
        self.cbox.Add(vbox, 1, wx.EXPAND|wx.ALIGN_LEFT|wx.ALL, border=bspace)
        self.Fit()