Set the frequency for all PWM output

        :param value: the frequency in Hz
196412
def set_pwm_frequency(self, value):
        
        self.__check_range('pwm_frequency', value)
        reg_val = self.calc_pre_scale(value)
        logger.debug("Calculated prescale value is %s" % reg_val)
        self.sleep()
        self.write(Registers.PRE_SCALE, reg_val)
        self.wake()
1288862
def _clean_frequency(frequency):
    
    if isinstance(frequency, int):
        return frequency
    elif isinstance(frequency, datetime.timedelta):
        return int(frequency.total_seconds())

    raise ValueError('Invalid frequency {!r}'.format(frequency))
734246
def value(self):
        
        if self.pwm_device.pin.frequency is None:
            return None
        else:
            try:
                return log2(
                    self.pwm_device.pin.frequency / self.mid_tone.frequency
                ) / self.octaves
            except ZeroDivisionError:
                return 0.0
261673
def set_freqsweep_ext(self, amplitude, sweep_low_end, sweep_high_end, offset=0.0, output_state=True):
        """"""

        sweep_deviation = round(abs(sweep_low_end - sweep_high_end)/2.0,6)
        freq = sweep_low_end + sweep_deviation
        commands = ['TYPE 3', #set to sweep
                    'SFNC 5',  #external modulation
                    'FREQ {0}'.format(freq),
                    'SDEV {0}'.format(sweep_deviation),
                    'MODL 1'   #enable modulation
                    ]
        if freq > 4.05e9:
            commands.append('AMPH {0}'.format(amplitude)) #set rear RF doubler amplitude
            if offset > 0.0:
                print('HIGH FREQUENCY OUTPUT IS AC ONLY')
            if output_state is True:
                commands.append('ENBH 1') #enable output
            else:
                commands.append('ENBH 0')
        elif freq < 62.5e6:
            commands.extend(['AMPL {0}'.format(amplitude), 'OFSL {0}'.format(offset)]) #set front BNC amplitude
            if output_state is True:
                commands.append('ENBL 1') #enable output
            else:
                commands.append('ENBL 0')

        command_string = '\n'.join(commands)
        print_string = '\n\t' + command_string.replace('\n', '\n\t')
        logging.info(print_string)
        self.instr.write(command_string)
123283
def set(self, is_on=None, brightness=None, cancel_transition=True):
        
        if cancel_transition:
            self._cancel_active_transition()

        if is_on is not None:
            self._is_on = is_on

        if brightness is not None:
            self._assert_is_brightness(brightness)
            self._brightness = brightness

        self._update_pwm()
515810
def start_timer(self, reprate):
        """"""
        print 'starting digital output at rate {} Hz'.format(reprate)
        self.trigger_task = DigitalOutTask(self.trigger_src, reprate)
        self.trigger_task.start()
1255902
def set_freq(self, fout, freq):
        
        hsdiv_tuple = (4, 5, 6, 7, 9, 11)           # possible dividers
        n1div_tuple = (1,) + tuple(range(2,129,2))  #
        fdco_min = 5670.0           # set maximum as minimum
        hsdiv = self.get_hs_div()   # read curent dividers
        n1div = self.get_n1_div()   #

        if abs((freq-fout)*1e6/fout) > 3500:  
            # Large change of frequency      
            fdco = fout * hsdiv * n1div # calculate high frequency oscillator
            fxtal =  fdco / self.get_rfreq()  # should be fxtal = 114.285        
        
            for hsdiv_iter in hsdiv_tuple:      # find dividers with minimal power consumption
                for n1div_iter in n1div_tuple:
                    fdco_new = freq * hsdiv_iter * n1div_iter
                    if (fdco_new >= 4850) and (fdco_new <= 5670):
                        if (fdco_new <= fdco_min):
                            fdco_min = fdco_new        
                            hsdiv = hsdiv_iter
                            n1div = n1div_iter
            rfreq = fdco_min / fxtal        
        
            self.freeze_dco()       # write registers
            self.set_hs_div(hsdiv)
            self.set_n1_div(n1div)
            self.set_rfreq(rfreq)
            self.unfreeze_dco()
            self.new_freq()
        else:
            # Small change of frequency
            rfreq = self.get_rfreq() * (freq/fout)

            self.freeze_m()         # write registers           
            self.set_rfreq(rfreq)
            self.unfreeze_m()
258839
def set_pulse_duration(self, duration):
        
        if duration > 4294967295:
            raise ValueError('Duration is too long. Please choose a value '
                             'less than 4294967296.')

        big_endian = hex(duration)[2:]
        if len(big_endian) % 2 != 0:
            big_endian = '0'+big_endian

        little_endian = []

        for i in range(0, len(big_endian), 2):
            little_endian.insert(0, big_endian[i:i+2])

        for i in range(0, 4-len(little_endian)):
            little_endian.append('00')

        command = 'mp'
        for i in little_endian:
            command += chr(int(i, 16))

        self.con.send_xid_command(command, 0)
469371
def clock(frequency)
      options = {4000     => 0,      #4 kHz
                 8000     => 32768,  #8 kHz
                 15625    => 16384,  #15.625 kHz
                 31250    => 8192,   #31.25 kHz
                 62500    => 4096,   #62.5 kHz
                 125000   => 2048,   #125 kHz
                 250000   => 1024,   #250 kHz
                 500000   => 512,    #500 kHz
                 1000000  => 256,    #1 MHz
                 2000000  => 128,    #2 MHz
                 4000000  => 64,     #4 MHz
                 8000000  => 32,     #8 MHz
                 20000000 => 16      #20 MHz
               }
      divider = options[frequency]
      PiPiper.driver.spi_clock(divider)
    end
1264933
function( value ) {
		this.output.setGrayscale( value & 0x1 );
		this.output.setIntensity( value & 0x20, value & 0x40, value & 0x80 );

		this.sprites.toggle( value & 0x10 );
		this.sprites.toggleLeft( value & 0x4 );

		this.background.toggle( value & 0x8 );
		this.background.toggleLeft( value & 0x2 );

		this.enabled = ( this.sprites.enabled || this.background.enabled );
	}
439545
def update_values(self):
        """"""
        self.method = self.idx_method.currentText()
        sw_det = DetectSlowWave(method=self.method)

        self.index['f1'].set_value(sw_det.det_filt['freq'][0])
        self.index['f2'].set_value(sw_det.det_filt['freq'][1])
        self.index['min_trough_dur'].set_value(sw_det.trough_duration[0])
        self.index['max_trough_dur'].set_value(sw_det.trough_duration[1])
        self.index['max_trough_amp'].set_value(sw_det.max_trough_amp)
        self.index['min_ptp'].set_value(sw_det.min_ptp)
        self.index['min_dur'].set_value(sw_det.min_dur)
        self.index['max_dur'].set_value(sw_det.max_dur)
855530
def values(self):
        
        if self.ui.hzBtn.isChecked():
            fscale = SmartSpinBox.Hz
        else:
            fscale = SmartSpinBox.kHz

        if self.ui.msBtn.isChecked():
            tscale = SmartSpinBox.MilliSeconds
        else:
            tscale = SmartSpinBox.Seconds

        return fscale, tscale
1100181
def modulate(data):
	'''
	 
	'''
	seconds_per_sample = 1.0 / audiogen.sampler.FRAME_RATE
	phase, seconds, bits = 0, 0, 0

	# construct generators
	clock = (x / BAUD_RATE for x in itertools.count(1))
	tones = (MARK_HZ if bit else SPACE_HZ for bit in data)

	for boundary, frequency in itertools.izip(clock, tones):
		# frequency of current symbol is determined by how much 
		# we advance the signal's phase in each audio frame
		phase_change_per_sample = TWO_PI / (audiogen.sampler.FRAME_RATE / frequency)

		# produce samples for the current symbol 
		# until we reach the next clock boundary
		while seconds < boundary:
			yield math.sin(phase)

			seconds += seconds_per_sample
			phase += phase_change_per_sample

			if phase > TWO_PI:
				phase -= TWO_PI

		bits += 1
		logger.debug("bits = %d, time = %.7f ms, expected time = %.7f ms, error = %.7f ms, baud rate = %.6f Hz" \
			% (bits, 1000 * seconds, 1000 * bits / BAUD_RATE, 1000 * (seconds - bits / BAUD_RATE), bits / seconds))
1044134
def vlm_set_output(self, psz_name, psz_output):
        '''
        '''
        return libvlc_vlm_set_output(self, str_to_bytes(psz_name), str_to_bytes(psz_output))
1084622
def set_value(self, value):
        
        v = 0
        measure_unit = 'px'
        try:
            v = int(float(value.replace('px', '')))
        except ValueError:
            try:
                v = int(float(value.replace('%', '')))
                measure_unit = '%'
            except ValueError:
                pass
        self.numInput.set_value(v)
        self.dropMeasureUnit.set_value(measure_unit)
757832
def set_enable(self, channel, value):
        '''
        '''
        try:
            bit = self._ch_map[channel]['GPIOEN']['bit']
        except KeyError:
            raise ValueError('set_enable() not supported for channel %s' % channel)
        self._set_power_gpio_value(bit=bit, value=value)
891923
function(eventName, cpuNumber, pid, ts, eventBase) {
      var event = /frequency=(\d+)/.exec(eventBase.details);
      if (!event)
        return false;

      this.exynosBusfreqSample('INT Frequency', ts, parseInt(event[1]));
      return true;
    }