def shutdown_device(cls, ctrl_connection, is_tx: bool): limesdr.stop_stream() limesdr.destroy_stream() limesdr.disable_all_channels() ret = limesdr.close() ctrl_connection.send("CLOSE:" + str(ret)) return True
def initialize_limesdr(freq, sample_rate, bandwidth, gain, channel_index, antenna_index, ctrl_conn, is_tx): ret = limesdr.open() ctrl_conn.send("OPEN:" + str(ret)) limesdr.disable_all_channels() if ret != 0: return False ret = limesdr.init() ctrl_conn.send("INIT:" + str(ret)) if ret != 0: return False LimeSDR.process_command((LimeSDR.Command.SET_CHANNEL_INDEX.name, channel_index), ctrl_conn, is_tx) limesdr.set_tx(is_tx) limesdr.enable_channel(True, is_tx, channel_index) # Set Antenna needs to be called before other stuff!!! LimeSDR.process_command((LimeSDR.Command.SET_ANTENNA_INDEX.name, antenna_index), ctrl_conn, is_tx) LimeSDR.process_command((LimeSDR.Command.SET_FREQUENCY.name, freq), ctrl_conn, is_tx) LimeSDR.process_command((LimeSDR.Command.SET_SAMPLE_RATE.name, sample_rate), ctrl_conn, is_tx) ctrl_conn.send("Setting bandwidth...") LimeSDR.process_command((LimeSDR.Command.SET_BANDWIDTH.name, bandwidth), ctrl_conn, is_tx) LimeSDR.process_command((LimeSDR.Command.SET_RF_GAIN.name, gain * 0.01), ctrl_conn, is_tx) antennas = limesdr.get_antenna_list() ctrl_conn.send("Current normalized gain is {0:.2f}".format(limesdr.get_normalized_gain())) ctrl_conn.send("Current antenna is {0}".format(antennas[limesdr.get_antenna()])) ctrl_conn.send("Current chip temperature is {0:.2f}°C".format(limesdr.get_chip_temperature())) return True
def setup_device(cls, ctrl_connection: Connection, device_identifier): ret = limesdr.open() ctrl_connection.send("OPEN:" + str(ret)) limesdr.disable_all_channels() if ret != 0: return False ret = limesdr.init() ctrl_connection.send("INIT:" + str(ret)) return ret == 0
def shutdown_lime_sdr(ctrl_conn): limesdr.disable_all_channels() ret = limesdr.close() ctrl_conn.send("CLOSE:" + str(ret)) return True