def __init__(self, app, conf): BaseHardware.__init__(self, app, conf) self.use_sidetone = 1 self.clock = conf.sdriq_clock self.rf_gain_labels = ('RF +30', 'RF +20', 'RF +10', 'RF 0 dB') if conf.fft_size_multiplier == 0: conf.fft_size_multiplier = 3 # Set size needed by VarDecim
def __init__(self, app, conf): BaseHardware.__init__(self, app, conf) self.use_sidetone = 0 self.vfo_frequency = 52000000 self.vfo_sample_rate = conf.sample_rate self.vfo_test = 0 # JIM self.adf4351_freq = 52E6 self.tx_frequency = 0 self.firmware_version = None # firmware version is initially unknown self.rx_udp_socket = None self.got_udp_status = '' self.got_adf4351_status = '' self.rx_phase0 = self.rx_phase1 = 0 self.tx_phase = 0 self.scan_enable = 0 self.scan_blocks = 0 self.scan_samples = 1 self.scan_phase = 0 self.fft_scan_valid = 0.84 self.adf4351_int_mode = 1 # integer one, fractional zero self.adf4351_aux_rf_out = 0b101 self.adf4351_rf_divider = 4 # Fout = Fvco / 2 ** rf_divider self.adf4351_band_sel_clock_div = 40 self.adf4351_r_counter = 8 # Fpfd = Fref / 2 / r_counter self.adf4351_int_value = 1317 # Fvco = Fpfd * (int_value + frac_value / modulus) self.adf4351_frac_value = 0 self.adf4351_modulus = 23 self.decim3 = 10 self.SetDecim(192000) self.var_rates = ['31X', '19X', '9X', '5X', '3X', '2X', '1728', '1152', '768', '384', '192', '96', '48'] # supported sample rates as strings self.index = 0 self.NewUdpStatus() self.NewAdf4351(self.adf4351_freq)
def close(self): BaseHardware.close(self) if self.serial: self.serial.write('EX\r') time.sleep(1) # wait for output to drain, but don't block self.serial.close() self.serial = None
def __init__(self, app, conf): BaseHardware.__init__(self, app, conf) self.use_sidetone = 1 self.got_udp_status = '' # status from UDP receiver # want_udp_status is a string with numbers in little-endian order: # [0:2] 'St' # [2:6] Rx tune phase # [6:10] Tx tune phase # [10:11] Tx output level 0 to 255 # [11:12] Tx control bits # 0 No transmit # 1 CW # 2 SSB and IMD # [12:13] Rx control bits # Second stage decimation less one, 1-39, six bits # [13:14] zero self.rx_phase = 0 self.tx_phase = 0 self.tx_level = 0 self.tx_control = 0 self.rx_control = 0 self.index = 0 self.mode = None self.firmware_version = None # firmware version is initially unknown self.is_spot = 0 # Are we in Spot mode? self.rx_udp_socket = None self.vfo_frequency = 0 # current vfo frequency self.tx_frequency = 0 self.decimations = [] # supported decimation rates for dec in (40, 20, 10, 8, 5, 4, 2): self.decimations.append(dec * 64) if self.conf.fft_size_multiplier == 0: self.conf.fft_size_multiplier = 7 # Set size needed by VarDecim
def __init__(self, app, conf): BaseHardware.__init__(self, app, conf) global UseSdriq, UseRxudp, Application, Config Application = app Config = conf UseSdriq = conf.use_sdriq UseRxudp = conf.use_rx_udp self.use_sidetone = 1 self.vfo_frequency = 0 # current vfo frequency # Select receiver if conf.use_rx_udp: from n2adr import hardware_transceiver self.receiver = hardware_transceiver.Hardware(app, conf) self.rf_gain_labels = ('RF 0 dB', 'RF +16', 'RF -20', 'RF -10') elif UseSdriq: from sdriqpkg import quisk_hardware as quisk_hardware_sdriq self.receiver = quisk_hardware_sdriq.Hardware(app, conf) self.rf_gain_labels = self.receiver.rf_gain_labels else: self.receiver = HwRxEthVfo() self.rf_gain_labels = ('RF 0 dB', 'RF +16', 'RF -20', 'RF -10') # Select transmitter if conf.use_rx_udp: self.transmitter = self.receiver # this is a transceiver elif Config.tx_ip: self.transmitter = HwTx2007() else: self.transmitter = BaseHardware(app, conf) # Other hardware self.anttuner = AntennaTuner() # Control the antenna tuner self.lpfilter = LowPassFilter() # Control LP filter box self.hpfilter = HighPassFilter() # Control HP filter box
def __init__(self, app, conf): BaseHardware.__init__(self, app, conf) global UseSdriq, UseRxudp, Application, Config Application = app Config = conf UseSdriq = conf.use_sdriq UseRxudp = conf.use_rx_udp self.use_sidetone = 1 self.vfo_frequency = 0 # current vfo frequency # Select receiver if conf.use_rx_udp: from hiqsdr import quisk_hardware as hw self.receiver = hw.Hardware(app, conf) self.rf_gain_labels = ('RF 0 dB', 'RF +16', 'RF -20', 'RF -10') elif UseSdriq: from sdriqpkg import quisk_hardware as quisk_hardware_sdriq self.receiver = quisk_hardware_sdriq.Hardware(app, conf) self.rf_gain_labels = self.receiver.rf_gain_labels else: self.receiver = HwRxEthVfo() self.rf_gain_labels = ('RF 0 dB', 'RF +16', 'RF -20', 'RF -10') # Select transmitter if conf.use_rx_udp: self.transmitter = self.receiver # this is a transceiver elif Config.tx_ip: self.transmitter = HwTx2007() else: self.transmitter = BaseHardware(app, conf) # Other hardware self.anttuner = AntennaTuner() # Control the antenna tuner self.lpfilter = LowPassFilter() # Control LP filter box self.hpfilter = HighPassFilter() # Control HP filter box
def __init__(self, app, conf): BaseHardware.__init__(self, app, conf) self.rf_gain_labels = ('RF +0', 'RF -10', 'RF -20', 'RF -30') self.antenna_labels = ('Wide Band', 'Band Filter') self.vardecim_index = 0 self.fVFO = 0.0 # Careful, this is a float if DEBUG: print ("__init__: %s" % conf) self.rates = [ 48000, \ 95000, \ 96000, \ 125000, \ 192000, \ 250000, \ 500000, \ 1000000, \ 1600000, \ 2000000 \ ] self.current_rate = 192000 self.att = 0; self.wb = 0 def __del__(self): # try to clear hardware if perseus: perseus.close() perseus.deinit()
def __init__(self, app, conf): BaseHardware.__init__(self, app, conf) self.use_sidetone = 0 self.vfo_frequency = 52000000 self.vfo_sample_rate = conf.sample_rate self.vfo_test = 0 # JIM self.tx_frequency = 0 self.firmware_version = None # firmware version is initially unknown self.rx_udp_socket = None self.tx_udp_socket = None self.got_rx_udp_status = '' self.got_tx_udp_status = '' self.band = '' self.rx_phase0 = self.rx_phase1 = 0 self.tx_phase = 0 self.button_PTT = 0 self.mode_is_cw = 0 self.scan_enable = 0 self.scan_blocks = 0 self.scan_samples = 1 self.scan_phase = 0 self.fft_scan_valid = 0.84 self.Rx4351 = Adf4351(True, conf.rx_clock38, 8) self.Tx4351 = Adf4351(False, 10700000, 2) self.Tx4351.aux_rf_out = 0b000 # enable aux RF out 0b111 or turn off 0b000 self.decim3 = 10 self.SetDecim(192000) self.var_rates = ['31X', '19X', '9X', '5X', '3X', '2X', '1728', '1152', '768', '384', '192', '96', '48'] # supported sample rates as strings self.index = 0 self.DcI, self.DcQ = (0.0, 0.0) self.NewAdf4351(self.Rx4351, 146E6) self.NewAdf4351(self.Tx4351, 146E6) self.NewAd9951(52e6) self.NewUdpStatus()
def __init__(self, app, conf): BaseHardware.__init__(self, app, conf) self.device = None self.usb = None self.rf_gain_labels = ('RF +10', 'RF 0', 'RF -10', 'RF -20') self.index = 1 self.enable = 0 self.rate = 0 self.att = 10 self.freq = 7220000 self.old_freq = 0 self.sdrmicron_clock = 76800000 self.sdrmicron_decim = 1600 self.bscope_data = '' self.fw_ver = None self.frame_msg = '' if conf.fft_size_multiplier == 0: conf.fft_size_multiplier = 3 # Set size needed by VarDecim rx_bytes = 3 # rx_bytes is the number of bytes in each I or Q sample: 1, 2, 3, or 4 rx_endian = 1 # rx_endian is the order of bytes in the sample array: 0 == little endian; 1 == big endian self.InitSamples( rx_bytes, rx_endian ) # Initialize: read samples from this hardware file and send them to Quisk bs_bytes = 2 bs_endian = 1 self.InitBscope(bs_bytes, bs_endian, self.sdrmicron_clock, 16384) # Initialize bandscope
def close(self): print "***close called" BaseHardware.close(self) if self.serial: self.serial.write('AL~SDROF\r') time.sleep(1) # wait for output to drain, but don't block self.serial.close() self.serial = None
def __init__(self, app, conf): BaseHardware.__init__(self, app, conf) self.usb_dev = None self.vfo = None self.ptt_button = 0 self.is_cw = False self.key_thread = None self.si570_i2c_address = conf.si570_i2c_address
def __init__(self, app, conf): BaseHardware.__init__(self, app, conf) self.debug = 1 self.si5351 = Si5351Drv() self.xtalFreq = 25000000 print("Init/Using PISDR HAT on RPi, by Yuan Wang (BG3MDO)") self.vfo = 0 self.is_tx = 0
def __init__(self, app, conf): BaseHardware.__init__(self, app, conf) print "Balthus:Init called" self.tty_name = '/dev/ttyUSB0' # serial port name self.serial = None # the open serial port self.timer = 0.02 # time between commands in seconds self.time0 = 0 # time of last command self.serial_out = [] # send commands slowly self.vfo_frequency = 0
def __init__(self, app, conf): BaseHardware.__init__(self, app, conf) self.var_index = 0 self.hermes_mac = bytearray(6) self.hermes_ip = "" self.hermes_code_version = -1 self.hermes_board_id = -1 self.hermes_temperature = 0.0 self.hermes_fwd_power = 0.0 self.hermes_rev_power = 0.0 self.hermes_pa_current = 0.0 self.eeprom_valid = 0 self.mode = None self.band = None self.vfo_frequency = 0 self.tx_frequency = 0 self.vna_count = 0 self.vna_started = False self.repeater_freq = None # original repeater output frequency self.antenna_labels = ('Ant 0', 'Ant 1') # labels for the antenna button self.antenna_index = 0 # index of antenna in use self.delay_config = 30 # Delay sending message to HL2 until after sound starts try: self.repeater_delay = conf.repeater_delay # delay for changing repeater frequency in seconds except: self.repeater_delay = 0.25 self.repeater_time0 = 0 # time of repeater change in frequency # Create the proper broadcast addresses for socket_discover if conf.udp_rx_ip: # Known IP address of hardware self.broadcast_addrs = [conf.udp_rx_ip] else: self.broadcast_addrs = [] for interf in QS.ip_interfaces(): broadc = interf[3] # broadcast address if broadc and broadc[0:4] != '127.': self.broadcast_addrs.append(broadc) self.broadcast_addrs.append('255.255.255.255') if DEBUG: print ('broadcast_addrs', self.broadcast_addrs) # This is the control data to send to the Hermes using the Metis protocol # Duplex must be on or else the first Rx frequency is locked to the Tx frequency # # From the protocol document, the data are: C1==[31:24], C2=[23:16], C3=[15:8], C4=[7:0] where [] are inclusive. # self.pc2hermes[] is used for the first 17 addresses 0x00 through 0x10. These are sent round-robin. self.pc2hermes = bytearray(17 * 4) # Control bytes not including C0. Python initializes this to zero. # Addresses C0 = 0x12 through 0x3E use self.pc2hermeswritequeue, which is capable of requesting an ACK. # C0 is a six-bit address. If the address is OR'd with 0x40, an ACK must be received or the item is re-transmitted. # The item sent to the HL2 is C0<<1 | MoxBit. # Sound must be started before you can use pc2hermeswritequeue. self.pc2hermeslitewritequeue = bytearray(4 * 5) # Four of (C0, C1, C2, C3, C4) # Initialize some data self.pc2hermes[3] = 0x04 # C0 index == 0, C4[5:3]: number of receivers 0b000 -> one receiver; C4[2] duplex on self.pc2hermes[4 * 9] = 63 # C0 index == 0b1001, C1[7:0] Tx level for c0 in range(1, 9): # Set all frequencies to 7012352, 0x006B0000 self.SetControlByte(c0, 2, 0x6B) self.ChangeTxLNA(conf.hermes_TxLNA_dB) self.MakePowerCalibration()
def __init__(self, app, conf): BaseHardware.__init__(self, app, conf) self.var_index = 0 self.hermes_mac = bytearray(6) self.hermes_ip = "" self.hermes_code_version = -1 self.hermes_board_id = -1 self.hermes_temperature = 0.0 self.hermes_fwd_power = 0.0 self.hermes_rev_power = 0.0 self.hermes_pa_current = 0.0 self.eeprom_valid = 0 self.alex_hpf_f1 = 0 self.alex_hpf_f2 = 0 self.alex_lpf_f1 = 0 self.alex_lpf_f2 = 0 self.mode = None self.band = None self.vfo_frequency = 0 self.tx_frequency = 0 self.vna_count = 0 self.vna_started = False self.repeater_freq = None # original repeater output frequency try: self.repeater_delay = conf.repeater_delay # delay for changing repeater frequency in seconds except: self.repeater_delay = 0.25 self.repeater_time0 = 0 # time of repeater change in frequency # Create the proper broadcast addresses for socket_discover if conf.udp_rx_ip: # Known IP address of hardware self.broadcast_addrs = [conf.udp_rx_ip] else: self.broadcast_addrs = [] for interf in QS.ip_interfaces(): broadc = interf[3] # broadcast address if broadc and broadc[0:4] != '127.': self.broadcast_addrs.append(broadc) self.broadcast_addrs.append('255.255.255.255') if DEBUG: print ('broadcast_addrs', self.broadcast_addrs) # This is the control data to send to the Hermes using the Metis protocol # Duplex must be on or else the first Rx frequency is locked to the Tx frequency self.pc2hermes = bytearray(17 * 4) # Control bytes not including C0. Python initializes this to zero. self.pc2hermeslitewritequeue = bytearray(4 * 5) self.pc2hermes[3] = 0x04 # C0 index == 0, C4[5:3]: number of receivers 0b000 -> one receiver; C4[2] duplex on self.pc2hermes[4 * 9] = 63 # C0 index == 0b1001, C1[7:0] Tx level for c0 in range(1, 9): # Set all frequencies to 7012352, 0x006B0000 self.SetControlByte(c0, 2, 0x6B) value = conf.keyupDelay if value > 1023: value = 1023 self.SetControlByte(0x10, 2, value & 0x3) # cw_hang_time self.SetControlByte(0x10, 1, (value >> 2) & 0xFF) # cw_hang_time self.SetLowPwrEnable(conf.hermes_lowpwr_tr_enable) self.EnablePowerAmp(conf.hermes_power_amp) self.ChangeTxLNA(conf.hermes_TxLNA_dB) self.MakePowerCalibration()
def __init__(self, app, conf): BaseHardware.__init__(self, app, conf) self.rf_gain_labels = ('RF +30', 'RF +20', 'RF +10', 'RF 0 dB') if conf.fft_size_multiplier == 0: conf.fft_size_multiplier = 3 # Set size needed by VarDecim self.clock = int(conf.sdriq_clock) self.device = Sdriq(self, conf.sdriq_name, self.clock, conf.sdriq_decimation) # SDR-IQ hardware access self.busy_cursor = False # Is the busy cursor displayed? rx_bytes = 2 # rx_bytes is the number of bytes in each I or Q sample: 1, 2, 3, or 4 rx_endian = 0 # rx_endian is the order of bytes in the sample array: 0 == little endian; 1 == big endian self.InitSamples(rx_bytes, rx_endian) # Initialize: read samples from this hardware file and send them to Quisk
def __init__(self, app, conf): BaseHardware.__init__(self, app, conf) self.var_index = 0 self.hermes_ip = "" self.hermes_code_version = -1 self.hermes_board_id = -1 self.hermes_temperature = 0 self.hermes_fwd_power = 0 self.hermes_rev_power = 0 self.hermes_pa_current = 0 self.mode = None self.band = None self.vfo_frequency = 0 self.tx_frequency = 0 self.vna_count = 0 self.vna_started = False self.repeater_freq = None # original repeater output frequency try: self.repeater_delay = conf.repeater_delay # delay for changing repeater frequency in seconds except: self.repeater_delay = 0.25 self.repeater_time0 = 0 # time of repeater change in frequency # Create the proper broadcast address for rx_udp_ip. if False and self.conf.rx_udp_ip: nm = self.conf.rx_udp_ip_netmask.split('.') ip = self.conf.rx_udp_ip.split('.') nm = map(int, nm) ip = map(int, ip) bc = '' for i in range(4): x = (ip[i] | ~nm[i]) & 0xFF bc = bc + str(x) + '.' self.broadcast_addr = bc[:-1] else: self.broadcast_addr = '255.255.255.255' # This socket is used for the Metis Discover protocol self.discover_request = chr(0xEF) + chr(0xFE) + chr(0x02) + chr(0) * 60 self.socket_discover = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) self.socket_discover.setblocking(0) self.socket_discover.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1) # This is the control data to send to the Hermes using the Metis protocol # Duplex must be on or else the first Rx frequency is locked to the Tx frequency self.pc2hermes = bytearray( 17 * 4 ) # Control bytes not including C0. Python initializes this to zero. self.pc2hermeslitewritequeue = bytearray(4 * 5) self.pc2hermes[ 3] = 0x04 # C0 index == 0, C4[5:3]: number of receivers 0b000 -> one receiver; C4[2] duplex on for c0 in range(1, 9): # Set all frequencies to 7012352, 0x006B0000 self.SetControlByte(c0, 2, 0x6B) self.SetLowPwrEnable(conf.hermes_lowpwr_tr_enable) self.EnablePowerAmp(conf.hermes_power_amp)
def __init__(self, app, conf): BaseHardware.__init__(self, app, conf) self.hamlib_rigctld_port = 4532 # Standard rigctld control port self.hamlib_poll_seconds = 0.2 # Time interval to poll for changes self.hamlib_connected = False self.radio_freq = None self.radio_mode = None self.quisk_freq = None self.quisk_vfo = None self.quisk_mode = 'USB' self.received = '' self.toggle = False self.time0 = 0
def __init__(self, app, conf): BaseHardware.__init__(self, app, conf) self.use_sidetone = 0 self.vfo_frequency = 52000000 self.vfo_sample_rate = conf.sample_rate self.vfo_test = 0 # JIM self.tx_frequency = 0 self.CorrectTxDc = { '23cm': (1270.0, 0.167081, 0.150557), '2': (146.0, 0.018772, 0.038658), '33cm': (915.0, 0.140150, 0.051967), '6': (52.0, 0.020590, 0.024557), '70cm': (435.0, 0.004495, 0.096879), '1.25': (223.5, 0.042958, 0.055212), } self.rx_clock38 = 38880000 - 30 # master clock frequency, 38880 kHz nominal #rx_udp_clock = rx_clock38 * 32 // 2 // 9 # ADC sample rate in Hertz self.rx_udp_clock_nominal = 69120000 # rate to display self.tx_clock80 = 80000000 + 14 self.firmware_version = None # firmware version is initially unknown self.rx_udp_socket = None self.tx_udp_socket = None self.got_rx_udp_status = '' self.got_tx_udp_status = '' self.band = '' self.rx_phase0 = self.rx_phase1 = 0 self.tx_phase = 0 self.button_PTT = 0 self.mode_is_cw = 0 self.scan_enable = 0 self.scan_blocks = 0 self.scan_samples = 1 self.scan_phase = 0 self.fft_scan_valid = 0.84 self.preamp = Preamp() self.Rx4351 = Adf4351(True, self.rx_clock38, 8) self.Tx4351 = Adf4351(False, 10700000, 2) self.Tx4351.aux_rf_out = 0b000 # enable aux RF out 0b111 or turn off 0b000 self.decim3 = 10 self.SetDecim(192000) self.var_rates = [ '31X', '19X', '9X', '5X', '3X', '2X', '1728', '1152', '768', '384', '192', '96', '48' ] # supported sample rates as strings self.index = 0 self.repeater_freq = None self.DcI, self.DcQ = (0.0, 0.0) self.NewAdf4351(self.Rx4351, 146E6) self.NewAdf4351(self.Tx4351, 146E6) self.NewAd9951(52e6) self.NewUdpStatus()
def __init__(self, app, conf): BaseHardware.__init__(self, app, conf) self.usb_dev = None self.vfo = None self.repeater_freq = None # original repeater output frequency try: self.repeater_delay = conf.repeater_delay # delay for changing repeater frequency in seconds except: self.repeater_delay = 0.25 self.repeater_time0 = 0 # time of repeater change in frequency self.ptt_button = 0 self.is_cw = False self.key_thread = None self.si570_i2c_address = conf.si570_i2c_address
def ChangeBand(self, band): # band is a string: "60", "40", "WWV", etc. BaseHardware.ChangeBand(self, band) self.band = band J16 = self.conf.Hermes_BandDict.get(band, 0) self.SetControlByte(0, 2, J16 << 1) # C0 index == 0, C2[7:1]: user output self.SetTxLevel()
def __init__(self, app, conf): BaseHardware.__init__(self, app, conf) self.local_tune = 2 self.index = 0 self.clock = 80000000 self.old_LO_freq = 0 self.rf_gain_labels = ('RF -10', 'RF -7', 'RF -4', 'RF -1', '+2', '+5', '+8', '+11', '+14', '+17', '+20', '+23', '+26', '+29', '+32', '+35') self.conf = conf self.plugin = Control(self.conf.rx_udp_ip, self.conf.rx_udp_port) self.app = app self.decimations = [] # supported decimation rates for dec in (53333, 96000, 133333, 185185, 192000, 370370, 740740, 1333333): self.decimations.append(dec)
def open(self): ret = BaseHardware.open(self) # Called once to open the Hardware #if not (self.receiver.open() == Hamlib.RIG_OK) : # print("Could not open rig 2519: ",self.receiver.caps.model_name) # return 'Error' self.receiver.open() self.vfo = int(self.receiver.get_freq()) return ret
def ChangeBand(self, band): # band is a string: "60", "40", "WWV", etc. BaseHardware.ChangeBand(self, band) self.band = band self.HiQSDR_Connector_X1 &= ~0x0F # Mask in the last four bits self.HiQSDR_Connector_X1 |= self.conf.HiQSDR_BandDict.get(band, 0) & 0x0F self.SetTxLevel()
def open(self): print "***Open called" self.serial = serial.Serial(port=self.tty_name, baudrate=57600, parity=serial.PARITY_NONE, rtscts=1, timeout=0) self.SendDJX11('AL~SDRON\r') #Set the IQ mode #set the step frequecy to 50hz t = BaseHardware.open(self) # save the message self.tune=144000000 self.vfo=144000000-10000 return t
def __init__(self, app, conf): BaseHardware.__init__(self, app, conf) self.vfo_frequency = self.conf.fixed_vfo_freq # current vfo frequency self.tune = self.vfo_frequency + 10000 # Current tuning frequency in Hertz self.is_cw = False ##20180226 JMH added this property to support SSmicro Si5351 TX setup ## self.ptt_button = 0 ##20180226 JMH added this property to support SSmicro Si5351 TX setup self.key_thread = None ##20180226 JMH added this property to support SSmicro Si5351 TX setup self.usb_dev = None ##20180226 JMH added this property to support SSmicro Si5351 TX setup self.CmdStr = '' ##20180226 JMH added this property to support SSmicro Si5351 TX setup self.tty_name = '/dev/ttyACM0' # serial port name for SftRkSDR self.serial = None # the open serial port self.timer = 0.02 # time between SftRkSDR commands in seconds self.time0 = 0 # time of last SftRkSDR command self.serial_out = [] # send commands slowly try: if not (conf.HrdwrTalk == None): self.HrdwrTalk = conf.HrdwrTalk except: self.HrdwrTalk = True
def HeartBeat(self): # Called at about 10 Hz by the main BaseHardware.HeartBeat(self) if self.serial: chars = self.serial.read(1024) if chars: print chars if self.serial_out and time.time() - self.time0 > self.timer: self.serial.write(self.serial_out[0]) self.time0 = time.time() del self.serial_out[0]
def ChangeBand(self, band): # band is a string: "60", "40", "WWV", etc. BaseHardware.ChangeBand(self, band) btn = self.application.BtnRfGain if btn: if band in ('160', '80', '60', '40'): btn.SetLabel('RF -10', True) elif band in ('20', ): btn.SetLabel('RF 0', True) else: btn.SetLabel('RF +10', True)
def __init__(self, app, conf): BaseHardware.__init__(self, app, conf) self.model = 25018 # Funcube Pro+ self.vfo = None self.lna = None self.mixer = None self.ifgain = None self.receiver = Hamlib.Rig(self.model) self.receiver.open() self.vfo = int(self.receiver.get_freq()) if (self.vfo == 0): print('+++ Could not find FuncubePro+ !\nExiting') exit() self.mixer = self.receiver.get_level_i(Hamlib.RIG_LEVEL_ATT, Hamlib.RIG_VFO_CURR) self.lna = self.receiver.get_level_i(Hamlib.RIG_LEVEL_PREAMP, Hamlib.RIG_VFO_CURR) self.ifgain = (int)(self.receiver.get_level_f( Hamlib.RIG_LEVEL_RF, Hamlib.RIG_VFO_CURR) * 100)
def HeartBeat(self): # Called at about 10 Hz by the main ## JMH 20190909 Not used in current version of quisk_KW4KD.py; replaced by KeyThread routine BaseHardware.HeartBeat(self) if self.serial: chars = self.serial.read(1024) if chars: if (self.HrdwrTalk): print chars ##JMH Only print SS micro response if .quisk_conf.py 'HrdwrTalk' has been set to 'True' if self.serial_out and time.time() - self.time0 > self.timer: self.serial.write(self.serial_out[0]) self.time0 = time.time() del self.serial_out[0]
def __init__(self, app, conf): BaseHardware.__init__(self, app, conf) # Default port settings for RS-HFIQ serialport.port = "/dev/ttyUSB0" serialport.baudrate = 57600 serialport.bytesize = serial.EIGHTBITS #number of bits per bytes serialport.parity = serial.PARITY_NONE #set parity check: no parity serialport.stopbits = serial.STOPBITS_ONE #number of stop bits serialport.timeout = 1 #non-block read serialport.rtscts = False try: serialport.open() except Exception as e: print(e) raise Exception self.vfo = None return None
def __init__(self, app, conf): BaseHardware.__init__(self, app, conf) self.var_index = 0 self.hermes_ip = "" self.hermes_board_id = -1 self.mode = None self.band = None self.vfo_frequency = 0 self.tx_frequency = 0 self.repeater_freq = None # original repeater output frequency try: self.repeater_delay = conf.repeater_delay # delay for changing repeater frequency in seconds except: self.repeater_delay = 0.25 self.repeater_time0 = 0 # time of repeater change in frequency # Create the proper broadcast address for rx_udp_ip. if False and self.conf.rx_udp_ip: nm = self.conf.rx_udp_ip_netmask.split('.') ip = self.conf.rx_udp_ip.split('.') nm = map(int, nm) ip = map(int, ip) bc = '' for i in range(4): x = (ip[i] | ~ nm[i]) & 0xFF bc = bc + str(x) + '.' self.broadcast_addr = bc[:-1] else: self.broadcast_addr = '255.255.255.255' # This socket is used for the Metis Discover protocol self.discover_request = chr(0xEF) + chr(0xFE) + chr(0x02) + chr(0) * 60 self.socket_discover = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) self.socket_discover.setblocking(0) self.socket_discover.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1) # This is the control data to send to the Hermes using the Metis protocol self.pc2hermes = bytearray(17 * 4) # Python initializes this to zero self.pc2hermes[3] = 0x04 # C0 index == 0, C4[5:3]: number of receivers 0b000 -> one receiver; C4[2] duplex on QS.pc_to_hermes(self.pc2hermes)
def __init__(self, app, conf): BaseHardware.__init__(self, app, conf) self.use_sidetone = 0 self.vfo_frequency = 52000000 self.vfo_sample_rate = conf.sample_rate self.vfo_test = 0 # JIM self.adf4351_freq = 52E6 self.tx_frequency = 0 self.firmware_version = None # firmware version is initially unknown self.rx_udp_socket = None self.got_udp_status = '' self.got_adf4351_status = '' self.rx_phase0 = self.rx_phase1 = 0 self.tx_phase = 0 self.scan_enable = 0 self.scan_blocks = 0 self.scan_samples = 1 self.scan_phase = 0 self.fft_scan_valid = 0.84 self.adf4351_int_mode = 1 # integer one, fractional zero self.adf4351_aux_rf_out = 0b101 self.adf4351_rf_divider = 4 # Fout = Fvco / 2 ** rf_divider self.adf4351_band_sel_clock_div = 40 self.adf4351_r_counter = 8 # Fpfd = Fref / 2 / r_counter self.adf4351_int_value = 1317 # Fvco = Fpfd * (int_value + frac_value / modulus) self.adf4351_frac_value = 0 self.adf4351_modulus = 23 self.decim3 = 10 self.SetDecim(192000) self.var_rates = [ '31X', '19X', '9X', '5X', '3X', '2X', '1728', '1152', '768', '384', '192', '96', '48' ] # supported sample rates as strings self.index = 0 self.NewUdpStatus() self.NewAdf4351(self.adf4351_freq)
def open(self, application): # find our device text = "XXX" usb_dev = usb.core.find(idVendor=self.conf.usb_vendor_id, idProduct=self.conf.usb_product_id) if usb_dev is None: text = 'USB SSmicro not found VendorID 0x%X ProductID 0x%X' % ( self.conf.usb_vendor_id, self.conf.usb_product_id) print(text) return text if DEBUG and usb_dev: if (self.HrdwrTalk): print('DeBug: Found SSmicro 0x%X; ProductID 0x%X' % (self.conf.usb_vendor_id, self.conf.usb_product_id)) if usb_dev: self.serial = serial.Serial(port=self.tty_name, baudrate=9600, stopbits=serial.STOPBITS_TWO, xonxoff=1, timeout=0) #self.SendSSmicro('MD0\r') # set WFM mode so the IF output is available self.usb_dev = usb_dev # success ver = 'unknown' sound = self.conf.name_of_sound_capt if len(sound) > 50: sound = sound[0:30] + '|||' + sound[-17:] text = 'Capture from SSmicro USB on %s, Firmware %s' % (sound, ver) if DEBUG: print("DeBug: %s" % text) ##if self.conf.name_of_mic_play and self.conf.key_poll_msec: if self.conf.key_poll_msec: #self.key_thread = KeyThread(usb_dev, self.conf.key_poll_msec / 1000.0, self.conf.key_hang_time) self.key_thread = KeyThread(self.serial, self.conf.key_poll_msec / 1000.0, self.conf.key_hang_time, self.HrdwrTalk) self.key_thread.start() if DEBUG: print("DeBug: Key_thread Started") QS.invert_spectrum(1) text = BaseHardware.open(self) # save the message sdriq.freq_sdriq(10700000) return text
def close(self): BaseHardware.close(self) self.fcd.close()
def __init__(self, app, conf): BaseHardware.__init__(self, app, conf) self.usb_dev = None self.vfo = None self.key_thread = None self.name_of_mic_play = conf.name_of_mic_play # True if we can transmit
def __init__(self, app, conf): BaseHardware.__init__(self, app, conf) self.got_udp_status = '' # status from UDP receiver # want_udp_status is a 14-byte string with numbers in little-endian order: # [0:2] 'St' # [2:6] Rx tune phase # [6:10] Tx tune phase # [10] Tx output level 0 to 255 # [11] Tx control bits: # 0x01 Enable CW transmit # 0x02 Enable all other transmit # 0x04 Use the HiQSDR extended IO pins not present in the 2010 QEX ver 1.0 # 0x08 The key is down (software key) # 0x40 odyssey: Spot button is in use # 0x80 odyssey: Mic Boost 20dB # [12] Rx control bits # Second stage decimation less one, 1-39, six bits # [13] zero or firmware version number # The above is used for firmware version 1.0. # Version 1.1 adds eight more bytes for the HiQSDR conntrol ports: # [14] X1 connector: Preselect pins 69, 68, 65, 64; Preamp pin 63, Tx LED pin 57 # [15] Attenuator pins 84, 83, 82, 81, 80 # [16] More bits: AntSwitch pin 41 is 0x01 # [17:22] The remaining five bytes are sent as zero. # Version 1.2 uses the same format as 1.1, but adds the "Qs" command (see below). # Version 1.3 adds features needed by the new quisk_vna.py program: # [17] The sidetone volume 0 to 255 # [18:20] This is vna_count, the number of VNA data points; or zero for normal operation # [20] The CW delay as specified in the config file # [21] Control bits: # 0x01 Switch on tx mirror on rx for adaptive predistortion # [22:24] Noise blanker level # The "Qs" command is a two-byte UDP packet sent to the control port. It returns the hardware status # as the above string, except that the string starts with "Qs" instead of "St". Do not send the "Qs" command # from Quisk, as it interferes with the "St" command. The "Qs" command is meant to be used from an # external program, such as HamLib or a logging program. # When vna_count != 0, we are in VNA mode. The start frequency is rx_phase, and for each point tx_phase is added # to advance the frequency. A zero sample is added to mark the blocks. The samples are I and Q averaged at DC. self.rx_phase = 0 self.tx_phase = 0 self.tx_level = 0 self.tx_control = 0 self.rx_control = 0 self.vna_count = 0 # VNA scan count; MUST be zero for non-VNA operation self.cw_delay = conf.cw_delay self.index = 0 self.mode = None self.usingSpot = False self.band = None self.rf_gain = 0 self.sidetone_volume = 0 # sidetone volume 0 to 255 self.repeater_freq = None # original repeater output frequency self.HiQSDR_Connector_X1 = 0 self.HiQSDR_Attenuator = 0 self.HiQSDR_Bits = 0 try: if conf.radio_sound_mic_boost: self.tx_control = 0x80 except: pass if conf.use_rx_udp == 2: # Set to 2 for the HiQSDR self.rf_gain_labels = ('RF 0 dB', 'RF +10', 'RF -10', 'RF -20', 'RF -30') self.antenna_labels = ('Ant 1', 'Ant 2') self.firmware_version = None # firmware version is initially unknown self.rx_udp_socket = None self.vfo_frequency = 0 # current vfo frequency self.tx_frequency = 0 self.decimations = [] # supported decimation rates for dec in (40, 20, 10, 8, 5, 4, 2): self.decimations.append(dec * 64) if self.conf.fft_size_multiplier == 0: self.conf.fft_size_multiplier = 6 # Set size needed by VarDecim
def __init__(self, app, conf): BaseHardware.__init__(self, app, conf) self.vfo = self.conf.fixed_vfo_freq # Fixed VFO frequency in Hertz self.tune = self.vfo + 10000 # Current tuning frequency in Hertz
def close(self): self.hamlib_socket.close() self.hamlib_connected = False return BaseHardware.close(self)
def open(self): # Called once to open the Hardware BaseHardware.open(self) self.fcd.open() self.fcd.set_freq(97300000) return 'Capture from Funcube Dongle'
def __init__(self, app, conf): BaseHardware.__init__(self, app, conf) self.vfo = None self.ptt_button = 0 self.usbsr_ip_address = conf.usbsr_ip_address self.usbsr_port = conf.usbsr_port
def __init__(self, app, conf): BaseHardware.__init__(self, app, conf) self.use_sidetone = 1
def open(self): ret = BaseHardware.open(self) self.hamlib_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.hamlib_socket.settimeout(0.0) self.ConnectRigctld() return ret
def __init__(self, app, conf): BaseHardware.__init__(self, app, conf) self.fcd = FCD() self.tune = 0
def open(self): ret = BaseHardware.open(self) # Called once to open the Hardware if DEBUG == 1: print('Device opened') return ret
class Hardware(BaseHardware): def __init__(self, app, conf): BaseHardware.__init__(self, app, conf) global UseSdriq, UseRxudp, Application, Config Application = app Config = conf UseSdriq = conf.use_sdriq UseRxudp = conf.use_rx_udp self.use_sidetone = 1 self.vfo_frequency = 0 # current vfo frequency # Select receiver if conf.use_rx_udp: from n2adr import hardware_transceiver self.receiver = hardware_transceiver.Hardware(app, conf) self.rf_gain_labels = ('RF 0 dB', 'RF +16', 'RF -20', 'RF -10') elif UseSdriq: from sdriqpkg import quisk_hardware as quisk_hardware_sdriq self.receiver = quisk_hardware_sdriq.Hardware(app, conf) self.rf_gain_labels = self.receiver.rf_gain_labels else: self.receiver = HwRxEthVfo() self.rf_gain_labels = ('RF 0 dB', 'RF +16', 'RF -20', 'RF -10') # Select transmitter if conf.use_rx_udp: self.transmitter = self.receiver # this is a transceiver elif Config.tx_ip: self.transmitter = HwTx2007() else: self.transmitter = BaseHardware(app, conf) # Other hardware self.anttuner = AntennaTuner() # Control the antenna tuner self.lpfilter = LowPassFilter() # Control LP filter box self.hpfilter = HighPassFilter() # Control HP filter box #self.antenna = AntennaControl(self.AntCtrlAddress) # Control antenna def open(self): if self.transmitter is not self.receiver: self.transmitter.open() self.anttuner.open() return self.receiver.open() def close(self): if self.transmitter is not self.receiver: self.transmitter.close() self.anttuner.close() self.receiver.close() def ReturnFrequency(self): # Return the current tuning and VFO frequency return None, None # frequencies have not changed def ChangeFilterFrequency(self, tx_freq): # Change the filters but not the receiver; used for panadapter if tx_freq and tx_freq > 0: self.anttuner.SetTxFreq(tx_freq) self.lpfilter.SetTxFreq(tx_freq) self.hpfilter.SetTxFreq(tx_freq) #self.antenna.SetTxFreq(tx_freq) def ChangeFrequency(self, tx_freq, vfo_freq, source='', band='', event=None): self.receiver.ChangeFrequency(tx_freq, vfo_freq, source, band, event) if self.transmitter is not self.receiver: self.transmitter.ChangeFrequency(tx_freq, vfo_freq, source, band, event) if tx_freq and tx_freq > 0: self.anttuner.SetTxFreq(tx_freq) self.lpfilter.SetTxFreq(tx_freq) self.hpfilter.SetTxFreq(tx_freq) #self.antenna.SetTxFreq(tx_freq) return tx_freq, vfo_freq def ChangeMode(self, mode): # mode is a string: "USB", "AM", etc. #if mode[0:3] == 'IMD': # QS.set_fdx(1) #else: # QS.set_fdx(0) self.receiver.ChangeMode(mode) self.transmitter.ChangeMode(mode) def ChangeBand(self, band): # band is a string: "60", "40", "WWV", etc. self.receiver.ChangeBand(band) self.transmitter.ChangeBand(band) self.anttuner.ChangeBand(band) self.lpfilter.ChangeBand(band) self.hpfilter.ChangeBand(band) #self.antenna.ChangeBand(band) def HeartBeat(self): # Called at about 10 Hz by the main self.receiver.HeartBeat() if self.transmitter != self.receiver: self.transmitter.HeartBeat() self.anttuner.HeartBeat() self.lpfilter.HeartBeat() self.hpfilter.HeartBeat() #self.antenna.HeartBeat() def OnSpot(self, mode): self.anttuner.OnSpot(mode) self.transmitter.OnSpot(mode) def OnButtonRfGain(self, event): if UseSdriq: self.receiver.OnButtonRfGain(event) else: if self.hpfilter: self.hpfilter.OnButtonRfGain(event) def GetFirmwareVersion(self): if UseRxudp: return self.receiver.firmware_version return 0 def VarDecimGetChoices(self): return self.receiver.VarDecimGetChoices() def VarDecimGetLabel(self): return self.receiver.VarDecimGetLabel() def VarDecimGetIndex(self): return self.receiver.VarDecimGetIndex() def VarDecimSet(self, index=None): return self.receiver.VarDecimSet(index)