def __init__(self, i2c=None, spi=None, ad7608=None, gpio=None, volt_ch1=2, volt_ch2=3, curr_ch1=0, curr_ch2=1, eeprom_dev_addr=None, sensor_dev_addr=None, ipcore=None): self.ipcore = ipcore if (i2c is not None and spi is not None and ad7608 is not None and gpio is not None): spi.set_mode('MODE2') self.cat9555 = CAT9555(ElektraDef.CAT9555_ADDR, i2c) self.eeprom = CAT24C32(eeprom_dev_addr, i2c) self.sensor = NCT75(sensor_dev_addr, i2c) self.ad5663 = AD5663R(spi, ElektraDef.DAC_MV_REF, ElektraDef.DAC_MODE_REF) self.ad7608 = ad7608 self.gpio = gpio elif (ipcore is not None and i2c is not None): self.spi = ipcore.spi self.spi.set_mode('MODE2') self.ad5663 = AD5663R(ipcore.spi, ElektraDef.DAC_MV_REF, ElektraDef.DAC_MODE_REF) self.gpio = None self.cat9555 = CAT9555(ElektraDef.CAT9555_ADDR, i2c) self.eeprom = CAT24C32(ElektraDef.EEPROM_DEV_ADDR, i2c) self.sensor = NCT75(ElektraDef.SENSOR_DEV_ADDR, i2c) self.ad7608 = ad7608 or MIXAD760XSGEmulator( "mix_ad760x_sg_emulator") elif (i2c is None and spi is None and ad7608 is None and gpio is None): self.cat9555 = CAT9555Emulator(ElektraDef.CAT9555_ADDR, None, None) self.eeprom = None self.sensor = None self.ad5663 = AD5663R(spi, ElektraDef.DAC_MV_REF, ElektraDef.DAC_MODE_REF) self.ad7608 = MIXAD760XSGEmulator("mix_ad760x_sg_emulator") self.gpio = GPIOEmulator("gpio_emulator") else: raise ElektraException( '__init__ error! Please check the parameters!') super(ElektraBase, self).__init__(self.eeprom, self.sensor, cal_table=elektra_calibration_info, range_table=elektra_range_table) self.adc_voltage_channel = {'ch1': volt_ch1, 'ch2': volt_ch2} self.adc_current_channel = {'ch1': curr_ch1, 'ch2': curr_ch2}
def __init__(self, i2c, ipcore, range_table=starlordii_range_table): self.eeprom = CAT24C32(Audio005Def.EEPROM_I2C_ADDR, i2c) self.nct75 = NCT75(Audio005Def.TEMP_I2C_ADDR, i2c) self.pca9536 = PCA9536(Audio005Def.PCA9536_DEV_ADDR, i2c) if isinstance(ipcore, basestring): ipcore = MIXAudio005SGR(ipcore) self.ipcore = ipcore self.analyzer = self.ipcore.analyzer self.signal_source = self.ipcore.signal_source self.adc_rst_pin = Pin(self.ipcore.gpio, Audio005Def.ADC_RESET_PIN) self.i2s_rx_en_pin = Pin(self.ipcore.gpio, Audio005Def.I2S_RX_EN_PIN) self.dac_rst_pin = Pin(self.ipcore.gpio, Audio005Def.DAC_RESET_PIN) self.i2s_tx_en_pin = Pin(self.ipcore.gpio, Audio005Def.I2S_TX_EN_PIN) self.i2s_ch_select = [ Pin(self.ipcore.gpio, Audio005Def.I2S_CH_SELECT_2), Pin(self.ipcore.gpio, Audio005Def.I2S_CH_SELECT_3) ] super(Audio005Base, self).__init__(self.eeprom, self.nct75, range_table=range_table) self.is_enable_upload = False
def __init__(self, i2c, ad717x=None, ipcore=None, eeprom_dev_addr=CloakDef.EEPROM_DEV_ADDR, sensor_dev_addr=CloakDef.SENSOR_DEV_ADDR, cal_info=None, range_table=None): if ipcore and ad717x: raise CloakException( 'Not allowed to use both aggregated IP and AD717X') if i2c: self.eeprom = CAT24C32(eeprom_dev_addr, i2c) self.sensor = NCT75(sensor_dev_addr, i2c) else: self.eeprom = EepromEmulator('eeprom_emulator') self.sensor = NCT75Emulator('nct75_emulator') if ipcore: self.ipcore = ipcore self.ad717x = self.ipcore.ad717x elif ad717x: self.ad717x = ad717x else: raise CloakException('Use one of aggregated IP or AD717X') super(CloakBase, self).__init__(self.eeprom, self.sensor, cal_table=cal_info, range_table=range_table)
def __init__(self, dac_i2c=None, eeprom_i2c=None, ocp_main_pin=None, ocp_batt_pin=None, ocp_dbg_pin=None): self.dac1 = AD5667R(ArmorDef.DAC1_DEV_ADDR, dac_i2c, ArmorDef.DAC_VOLTAGE_REF) self.dac2 = AD5667R(ArmorDef.DAC2_DEV_ADDR, dac_i2c, ArmorDef.DAC_VOLTAGE_REF) self.dac3 = MCP4725(ArmorDef.DAC3_DEV_ADDR, dac_i2c, ArmorDef.DAC3_VOLTAGE_REF) self.res1 = AD5272(ArmorDef.RES_1_ADDR, dac_i2c) self.res2 = AD5272(ArmorDef.RES_2_ADDR, dac_i2c) self.eeprom = CAT24C32(ArmorDef.EEPROM_DEV_ADDR, eeprom_i2c) self.sensor = NCT75(ArmorDef.SENSOR_DEV_ADDR, eeprom_i2c) self.pca9536 = PCA9536(ArmorDef.IO_EXP_DEV_ADDR, eeprom_i2c) self.dac_output_volt = dict() self.current_limit = dict() self.ocp_status = dict() self.eload_current = 0 self.ocp_main_pin = ocp_main_pin self.ocp_batt_pin = ocp_batt_pin self.ocp_dbg_pin = ocp_dbg_pin super(ArmorBase, self).__init__(self.eeprom, self.sensor, range_table=armor_range_table)
def __init__(self, i2c=None, spi=None, blade=None, gpio=None, volt_ch1=2, volt_ch2=3, curr_ch1=0, curr_ch2=1, eeprom_dev_addr=None, sensor_dev_addr=None, ipcore=None, cat9555_dev_addr=ElektraDef.CAT9555_ADDR, range_table=elektra_range_table): self.eeprom = CAT24C32(eeprom_dev_addr, i2c) self.sensor = NCT75(sensor_dev_addr, i2c) self.cat9555 = CAT9555(cat9555_dev_addr, i2c) if (i2c is not None and spi is not None and gpio is not None): self.spi = spi self.spi.set_mode('MODE2') self.ad5663 = AD5663R(spi, ElektraDef.DAC_MV_REF, ElektraDef.DAC_MODE_REF) # if not using wrapper IP, blade is ad7608 IP driver self.ad7608 = blade self.gpio = gpio elif (ipcore is not None and i2c is not None): if isinstance(ipcore, basestring): daqt1_axi4_bus = AXI4LiteBus(ipcore, ElektraDef.MIXDAQT1_REG_SIZE) self.ipcore = MIXDAQT1SGR( axi4_bus=daqt1_axi4_bus, ad717x_chip='AD7175', ad717x_mvref=ElektraDef.ADC_VREF_VOLTAGE_5000mV, use_spi=True, use_gpio=False) self.spi = self.ipcore.spi self.ad7175 = self.ipcore.ad717x else: self.ipcore = ipcore self.spi = self.ipcore.spi self.ad7175 = self.ipcore.ad717x self.spi.set_mode('MODE2') self.ad5663 = AD5663R(self.spi, ElektraDef.DAC_MV_REF, ElektraDef.DAC_MODE_REF) self.gpio = None if blade: self.blade = blade self.ad7608 = blade.adc else: raise ElektraException( '__init__ error! Please check the parameters!') super(ElektraBase, self).__init__(self.eeprom, self.sensor, range_table=range_table) self.adc_voltage_channel = {'ch1': volt_ch1, 'ch2': volt_ch2} self.adc_current_channel = {'ch1': curr_ch1, 'ch2': curr_ch2}
def __init__(self, i2c_ext=None, i2c_power=None, ad7175=None, ipcore=None): if ad7175 and not ipcore: if isinstance(ad7175, basestring): axi4 = AXI4LiteBus(ad7175, OdinDef.PLAD7175_REG_SIZE) self.ad7175 = MIXAd7175SG(axi4, mvref=OdinDef.MVREF, code_polar=OdinDef.POLAR, reference=OdinDef.AD7175_REF_MODE, clock=OdinDef.CLOCK) else: self.ad7175 = ad7175 elif not ad7175 and ipcore: if isinstance(ipcore, basestring): axi4_bus = AXI4LiteBus(ipcore, OdinDef.MIX_PSU001_REG_SIZE) self.ipcore = MIXPSU001SGR(axi4_bus, 'AD7175', ad717x_mvref=OdinDef.MVREF, code_polar=OdinDef.POLAR, reference=OdinDef.AD7175_REF_MODE, clock=OdinDef.CLOCK, use_gpio=False) else: self.ipcore = ipcore self.ad7175 = self.ipcore.ad717x if i2c_ext and i2c_power: eeprom = CAT24C32(OdinDef.EEPROM_DEV_ADDR, i2c_ext) nct75 = NCT75(OdinDef.NCT75_DEV_ADDR, i2c_ext) self.tca9538 = TCA9538(OdinDef.TCA9538_ADDR, i2c_ext) self.ad5667_batt = AD5667R(OdinDef.DAC_BATT_ADDR, i2c_power, ref_mode=OdinDef.DAC_REF_MODE, mvref=OdinDef.DAC_VREF) self.ad5667_charge = AD5667R(OdinDef.DAC_CHARGE_ADDR, i2c_power, ref_mode=OdinDef.DAC_REF_MODE, mvref=OdinDef.DAC_VREF) self.ch1_output_config = dict() self.ch2_output_config = dict() self.ch1_input_config = dict() self.ch2_input_config = dict() super(Odin, self).__init__(eeprom, nct75, range_table=odin_range_table) else: raise OdinException("Invalid parameter, please check")
def __init__(self, i2c=None, spi=None, ad7175=None, gpio=None, ipcore=None): super(EL004002A, self).__init__(None, None, None, None, ElektraDef.VLOT_CH1, ElektraDef.VLOT_CH2, ElektraDef.CURR_CH1, ElektraDef.CURR_CH2, ElektraDef.EEPROM_DEV_ADDR, ElektraDef.SENSOR_DEV_ADDR) if ipcore: self.ad7175 = ipcore.ad717x self.spi = ipcore.spi self.ad5663 = AD5663R(ipcore.spi, ElektraDef.DAC_MV_REF, ElektraDef.DAC_MODE_REF) self.gpio = None else: self.spi = spi or MIXQSPISGEmulator("mix_qspi_sg_emulator", ElektraDef.PLSPIBUS_EMULATOR_REG_SIZE) self.ad7175 = ad7175 or MIXAd7175SGEmulator("mix_ad7175_sg_emulator", ElektraDef.AD7175_EMULATOR_REG_SIZE) self.ad5663 = AD5663R(spi, ElektraDef.DAC_MV_REF, ElektraDef.DAC_MODE_REF) self.gpio = gpio or GPIOEmulator("gpio_emulator") if i2c: self.cat9555 = CAT9555(ElektraDef.CAT9555_ADDR, i2c) self.eeprom = CAT24C32(ElektraDef.EEPROM_DEV_ADDR, i2c) self.sensor = NCT75(ElektraDef.SENSOR_DEV_ADDR, i2c) else: self.cat9555 = CAT9555Emulator(ElektraDef.CAT9555_ADDR, None, None) self.eeprom = None self.sensor = None super(ElektraBase, self).__init__(self.eeprom, self.sensor, cal_table=elektra_calibration_info, range_table=elektra_range_table) self.ad7175.config = { "ch0": {"P": "AIN0", "N": "AIN4"}, "ch1": {"P": "AIN1", "N": "AIN4"}, "ch2": {"P": "AIN2", "N": "AIN4"}, "ch3": {"P": "AIN3", "N": "AIN4"} } self.spi.set_mode('MODE2')
def __init__(self, i2c, signal_source, range_ctrl_pin, ipcore, eeprom_dev_addr, sensor_dev_addr): if not i2c and not signal_source and not range_ctrl_pin and not ipcore: self.signal_source = MIXSignalSourceSGEmulator('mix_signalsource_sg_emulator') self.range_ctrl_pin = GPIOEmulator('gpio_emulator') elif i2c and signal_source and range_ctrl_pin and not ipcore: if isinstance(signal_source, basestring): axi4_bus = AXI4LiteBus(signal_source, IcemanDef.REG_SIZE) self.signal_source = MIXSignalSourceSG(axi4_bus) else: self.signal_source = signal_source self.range_ctrl_pin = range_ctrl_pin elif i2c and not signal_source and ipcore: if isinstance(ipcore, basestring): axi4_bus = AXI4LiteBus(ipcore, IcemanDef.MIX_SGT1_REG_SIZE) use_gpio = False if range_ctrl_pin else True self.ipcore = MIXSGT1SGR(axi4_bus, use_gpio) else: self.ipcore = ipcore self.signal_source = self.ipcore.signal_source self.range_ctrl_pin = range_ctrl_pin or Pin(self.ipcore.gpio, IcemanDef.RANGE_CTRL_PIN) else: raise IcemanException("Please check init parameters.") if i2c: eeprom = CAT24C32(eeprom_dev_addr, i2c) nct75 = NCT75(sensor_dev_addr, i2c) else: eeprom = None nct75 = None super(IcemanBase, self).__init__(eeprom, nct75, cal_table=iceman_calibration, range_table=iceman_range_table)
def __init__(self, i2c, ad7175=None, ipcore=None, eeprom_dev_addr=DaggerDef.EEPROM_DEV_ADDR, sensor_dev_addr=DaggerDef.NCT75_DEV_ADDR): if ipcore and ad7175: raise DaggerException( 'ipcore and ad7175 can not be existed at the same time') self.ipcore = ipcore if ipcore is not None: if isinstance(ipcore, basestring): axi4_bus = AXI4LiteBus(ipcore, DaggerDef.MIX_DAQT1_REG_SIZE) self.ipcore = MIXDAQT1SGR( axi4_bus, 'AD7175', ad717x_mvref=DaggerDef.AD7175_MVREF, code_polar=DaggerDef.AD7175_CODE_POLAR, reference=DaggerDef.AD7175_REFERENCE_SOURCE, buffer_flag=DaggerDef.AD7175_BUFFER_FLAG, clock=DaggerDef.AD7175_CLOCK, use_spi=False, use_gpio=False) else: self.ipcore = ipcore self.ad7175 = self.ipcore.ad717x elif ad7175: if isinstance(ad7175, basestring): axi4_bus = AXI4LiteBus(ad7175, DaggerDef.AD7175_REG_SIZE) self.ad7175 = MIXAd7175SG( axi4_bus, mvref=DaggerDef.AD7175_MVREF, code_polar=DaggerDef.AD7175_CODE_POLAR, reference=DaggerDef.AD7175_REFERENCE_SOURCE, buffer_flag=DaggerDef.AD7175_BUFFER_FLAG, clock=DaggerDef.AD7175_CLOCK) else: self.ad7175 = ad7175 else: raise DaggerException("Invalid parameter, please check") self.eeprom = CAT24C32(eeprom_dev_addr, i2c) self.nct75 = NCT75(sensor_dev_addr, i2c) super(DaggerBase, self).__init__(self.eeprom, self.nct75, range_table=dagger_range_table) self.ad7175.config = { "ch0": { "P": "AIN0", "N": "AIN1" }, "ch1": { "P": "AIN2", "N": "AIN3" } }
def __init__(self, i2c=None): self._cat9555 = CAT9555(SG2238SP02PCADef.CAT9555_DEV_ADDR, i2c) self._ad5667 = AD5667(SG2238SP02PCADef.AD5667_DEV_ADDR, i2c, SG2238SP02PCADef.AD5667_VREF_VOLTSGE) eeprom = CAT24C32(SG2238SP02PCADef.EEPROM_DEV_ADDR, i2c) nct75 = NCT75(SG2238SP02PCADef.NCT75_DEV_ADDR, i2c) super(SG2238SP02PCA, self).__init__(eeprom, nct75)
def __init__(self, i2c, ipcore=None, ad7175=None, eeprom_dev_addr=MimicDef.EEPROM_DEV_ADDR, sensor_dev_addr=MimicDef.SENSOR_DEV_ADDR, cat9555_dev_addr=MimicDef.CAT9555_DEV_ADDR, range_table=mimic_range_table): self.eeprom = CAT24C32(eeprom_dev_addr, i2c) self.sensor = NCT75(sensor_dev_addr, i2c) self.cat9555 = CAT9555(cat9555_dev_addr, i2c) if ipcore: if isinstance(ipcore, basestring): daqt1_axi4_bus = AXI4LiteBus(ipcore, MimicDef.MIXDAQT1_REG_SIZE) self.ip = MIXDAQT1SGR( axi4_bus=daqt1_axi4_bus, ad717x_chip='AD7175', ad717x_mvref=MimicDef.ADC_VREF_VOLTAGE_5000mV, use_spi=True, use_gpio=False) self.ad7175 = self.ip.ad717x else: self.ip = ipcore self.ad7175 = self.ip.ad717x elif ad7175: if isinstance(ad7175, basestring): axi4_bus = AXI4LiteBus(ad7175, MimicDef.AD7175_REG_SIZE) self.ad7175 = MIXAd7175SG( axi4_bus, mvref=MimicDef.ADC_VREF_VOLTAGE_5000mV) else: self.ad7175 = ad7175 else: raise MimicException("Invalid parameter, please check") self.ad7175.config = { 'ch0': { 'P': 'AIN0', 'N': 'AIN1' }, 'ch1': { 'P': 'AIN2', 'N': 'AIN3' } } self.measure_path = dict() super(MimicBase, self).__init__(self.eeprom, self.sensor, range_table=range_table) self.function_info = mimic_function_info self.module_calibration_info = range_table
def __init__(self, i2c, ad7175=None, range_ctrl_pin=None, meter_ctrl_pin=None, ipcore=None): if ad7175 and range_ctrl_pin and meter_ctrl_pin and not ipcore: if isinstance(ad7175, basestring): axi4 = AXI4LiteBus(ad7175, WolverineDef.PLAD7175_REG_SIZE) self.ad7175 = MIXAd7175SG(axi4, mvref=WolverineDef.MVREF, code_polar=WolverineDef.POLAR, clock=WolverineDef.CLOCK) else: self.ad7175 = ad7175 self.range_ctrl_pin = range_ctrl_pin self.meter_ctrl_pin = meter_ctrl_pin elif not ad7175 and not range_ctrl_pin and not meter_ctrl_pin and ipcore: if isinstance(ipcore, basestring): axi4_bus = AXI4LiteBus(ipcore, WolverineDef.MIX_DAQT1_REG_SIZE) self.ipcore = MIXDAQT1SGR(axi4_bus, 'AD7175', ad717x_mvref=WolverineDef.MVREF, code_polar=WolverineDef.POLAR, clock=WolverineDef.CLOCK, use_gpio=True) else: self.ipcore = ipcore self.ad7175 = self.ipcore.ad717x gpio = self.ipcore.gpio self.range_ctrl_pin = Pin(gpio, WolverineDef.RANGE_SEL_BIT) self.meter_ctrl_pin = Pin(gpio, WolverineDef.METER_SEL_BIT) self.tag_pins = [ Pin(gpio, WolverineDef.TAG_BASE_PIN + x, WolverineDef.GPIO_OUTPUT_DIR) for x in range(4) ] elif not ad7175 and range_ctrl_pin and meter_ctrl_pin and ipcore: if isinstance(ipcore, basestring): axi4_bus = AXI4LiteBus(ipcore, WolverineDef.MIX_DAQT1_REG_SIZE) self.ipcore = MIXDAQT1SGR(axi4_bus, 'AD7175', ad717x_mvref=WolverineDef.MVREF, code_polar=WolverineDef.POLAR, clock=WolverineDef.CLOCK, use_gpio=True) else: self.ipcore = ipcore self.ad7175 = self.ipcore.ad717x self.range_ctrl_pin = range_ctrl_pin self.meter_ctrl_pin = meter_ctrl_pin gpio = self.ipcore.gpio self.tag_pins = [ Pin(gpio, WolverineDef.TAG_BASE_PIN + x, WolverineDef.GPIO_OUTPUT_DIR) for x in range(4) ] else: raise WolverineException("Invalid parameter, please check") eeprom = CAT24C32(WolverineDef.EEPROM_DEV_ADDR, i2c) nct75 = NCT75(WolverineDef.NCT75_DEV_ADDR, i2c) super(Wolverine, self).__init__(eeprom, nct75, range_table=wolverine_range_table) self.channel_path = {'range_sel_bit': self.range_ctrl_pin, 'meter_sel_bit': self.meter_ctrl_pin} self.measure_path = dict() self.measure_path['range'] = WolverineDef.VOLT_5V
def __init__(self, i2c, ipcore, eeprom_dev_addr=KarmaDef.EEPROM_DEV_ADDR, sensor_dev_addr=KarmaDef.SENSOR_DEV_ADDR, range_table=karma_range_table): if (i2c and ipcore): if isinstance(ipcore, basestring): axi4_bus = AXI4LiteBus(ipcore, KarmaDef.REG_SIZE) self.ipcore = MIXBT001SGR(axi4_bus=axi4_bus, ad717x_chip='AD7175', ad717x_mvref=KarmaDef.ADC_VREF, use_spi=True, use_gpio=True) else: self.ipcore = ipcore self.ad7175 = self.ipcore.ad717x self.ad7175.config = { 'ch0': { 'P': 'AIN0', 'N': 'AIN1' }, 'ch1': { 'P': 'AIN2', 'N': 'AIN3' } } self.vx_ix_select_pin = Pin(self.ipcore.gpio, KarmaDef.VX_IX_SELECT_PIN) self.cur_set1_pin = Pin(self.ipcore.gpio, KarmaDef.CUR_SET1_PIN) self.cur_set2_pin = Pin(self.ipcore.gpio, KarmaDef.CUR_SET2_PIN) self.discharge_pin = Pin(self.ipcore.gpio, KarmaDef.DISCHARGE_PIN) self.lpf_select_pin = Pin(self.ipcore.gpio, KarmaDef.LPF_SELECT_PIN) self.reset_l_pin = Pin(self.ipcore.gpio, KarmaDef.RESET_L_PIN) self.trigger_l_pin = Pin(self.ipcore.gpio, KarmaDef.TRIGGER_L_PIN) self.ad9106 = AD9106(self.ipcore.spi, KarmaDef.AD9106_MCLK, KarmaDef.AD9106_DEFAULT_VREF) self.eeprom = CAT24C32(eeprom_dev_addr, i2c) self.sensor = NCT75(sensor_dev_addr, i2c) self.line_path = "" self.sine_data_length = 0 self.cosine_data_length = 0 self.cycle_count = 2 super(KarmaBase, self).__init__(self.eeprom, self.sensor, range_table=range_table) else: raise KarmaException('Parameter error')
def __init__(self, i2c): if i2c: self.nct75 = NCT75(Psu003001Def.SENSOR_DEV_ADDR, i2c) self.dac = AD5675(Psu003001Def.DAC_DEV_ADDR, i2c, mvref=Psu003001Def.DAC_REF_VOLT_mV) self.eeprom = CAT24C32(Psu003001Def.EEPROM_DEV_ADDR, i2c) self.io_exp = TCA9538(Psu003001Def.IO_EXP_DEV_ADDR, i2c) super(PSU003001, self).__init__(self.eeprom, self.nct75, range_table=psu003001_range_table) self.line_path = dict() else: raise Psu003001Exception("Parameter error")
def __init__(self, i2c=None, ipcore=None, ad7175=None): if i2c: self.eeprom = CAT24C32(DMM003004Def.EEPROM_DEV_ADDR, i2c) self.sensor = NCT75(DMM003004Def.SENSOR_DEV_ADDR, i2c) self.cat9555 = CAT9555(DMM003004Def.CAT9555_DEV_ADDR, i2c) else: self.eeprom = EepromEmulator('eeprom_emulator') self.sensor = NCT75Emulator('nct75_emulator') self.cat9555 = CAT9555Emulator(DMM003004Def.CAT9555_DEV_ADDR, None, None) if ipcore: if isinstance(ipcore, basestring): daqt1_axi4_bus = AXI4LiteBus(ipcore, DMM003004Def.MIXDAQT1_REG_SIZE) self.ip = MIXDAQT1SGR( axi4_bus=daqt1_axi4_bus, ad717x_chip='AD7175', ad717x_mvref=DMM003004Def.ADC_VREF_VOLTAGE_5000mV, use_spi=True, use_gpio=False) self.ad7175 = self.ip.ad717x else: self.ip = ipcore self.ad7175 = self.ip.ad717x elif ad7175: self.ad7175 = ad7175 else: self.ad7175 = MIXAd7175SGEmulator('mix_ad7175_sg_emulator', DMM003004Def.EMULATOR_REG_SIZE) self.ad7175.config = { 'ch0': { 'P': 'AIN0', 'N': 'AIN1' }, 'ch1': { 'P': 'AIN2', 'N': 'AIN3' } } self.mode = 'cal' self.measure_path = dict() super(Mimic, self).__init__(self.eeprom, self.sensor, cal_table=dmm003004_calibration_info, range_table=dmm003004_range_table) self.function_info = dmm003004_function_info self.module_calibration_info = dmm003004_calibration_info
def __init__(self, i2c): if i2c: self.eeprom = CAT24C32(SG2251PW01PCADef.EEPROM_DEV_ADDR, i2c) self.sensor = NCT75(SG2251PW01PCADef.NCT75_DEV_ADDR, i2c) self.dac = AD5667R(SG2251PW01PCADef.DAC_ADDR, i2c, "EXTERN", SG2251PW01PCADef.DAC_REF_VOLT) self.io_expand = TCA9538(SG2251PW01PCADef.IO_EXP_ADDR, i2c) else: self.eeprom = EepromEmulator("cat24cxx_emulator") self.sensor = NCT75Emulator("nct75_emulator") self.dac = AD56X7REmulator(SG2251PW01PCADef.DAC_ADDR) self.io_expand = TCA9538Emulator(SG2251PW01PCADef.IO_EXP_ADDR) super(SG2251PW01PCA, self).__init__(self.eeprom, self.sensor, cal_table=sg2251_calibration_info, range_table=sg2251_range_table)
def __init__(self, i2c, ipcore=None): if i2c: self.eeprom = CAT24C32(WolverineiiDef.EEPROM_DEV_ADDR, i2c) self.sensor = NCT75(WolverineiiDef.SENSOR_DEV_ADDR, i2c) self.pca9536 = PCA9536(WolverineiiDef.IO_EXP_DEV_ADDR, i2c) else: self.eeprom = EepromEmulator('eeprom_emulator') self.sensor = NCT75Emulator('nct75_emulator') self.pca9536 = PCA9536Emulator('pca9536_emulator') if ipcore: if isinstance(ipcore, basestring): axi4_bus = AXI4LiteBus(ipcore, WolverineiiDef.MIXDAQT1_REG_SIZE) ipcore = MIXDAQT1SGR( axi4_bus, 'AD7175', ad717x_mvref=WolverineiiDef.AD7175_MVREF, code_polar=WolverineiiDef.AD7175_CODE_POLAR, reference=WolverineiiDef.AD7175_REFERENCE, clock=WolverineiiDef.AD7175_CLOCK) self.ipcore = ipcore else: self.ipcore = ipcore self.ad7175 = self.ipcore.ad717x self.ad7175.config = { 'ch0': { 'P': 'AIN0', 'N': 'AIN1' }, 'ch1': { 'P': 'AIN2', 'N': 'AIN3' } } else: self.ad7175 = MIXAd7175SGEmulator('mix_ad7175_sg_emulator', WolverineiiDef.EMULATOR_REG_SIZE) self.mode = 'cal' self.measure_path = dict() super(WolverineII, self).__init__(self.eeprom, self.sensor, cal_table=wolverineii_calibration_info, range_table=wolverineii_range_table)
def __init__(self, ps8409_i2c, eeprom_i2c, hpd_io, signal_source_io, signal_ctrol_io, ipcore=None, init_file='hdmi2_0.bin'): self.ps8409_i2c = ps8409_i2c self.eeprom_i2c = eeprom_i2c self.hpd_io = hpd_io self.signal_source_io = signal_source_io self.signal_ctrol_io = signal_ctrol_io self.hpd_io.set_dir('output') self.signal_source_io.set_dir('output') self.signal_ctrol_io.set_dir('output') self.eeprom = CAT24C32(SG2700SU09PCADef.EEPROM_ADDR, self.eeprom_i2c) self.nct75 = NCT75(SG2700SU09PCADef.NTC_ADDR, self.eeprom_i2c) if isinstance(ipcore, basestring): axi4_bus = AXI4LiteBus(ipcore, SG2700SU09PCADef.REG_SIZE) self.ipcore = MIXHDMISinkEmulateSG(axi4_bus) else: self.ipcore = ipcore if ipcore is not None: # init edid and scdc eeprom self.config_eeprom_emulate("EDID_eeprom", SG2700SU09PCADef.EDID_EEPROM_SPEED, SG2700SU09PCADef.EDID_EEPROM_ADDR, SG2700SU09PCADef.EDID_EEPROM_REG_LEN, SG2700SU09PCADef.EDID_EEPROM_DATA_WIDTH) self.config_eeprom_emulate("SCDC_eeprom", SG2700SU09PCADef.SCDC_EEPROM_SPEED, SG2700SU09PCADef.SCDC_EEPROM_ADDR, SG2700SU09PCADef.SCDC_EEPROM_REG_LEN, SG2700SU09PCADef.SCDC_EEPROM_DATA_WIDTH) self.config_SCDC_eeprom() # init hdmi info to hdmi2.0 self.init_eeprom_emulate("EDID_eeprom", SG2700SU09PCADef.FILE_PATH + init_file) self.hpd_level(1) self.signal_source_switch('ICI') self.signal_ctrol('enable') super(SG2700SU09PCA, self).__init__(self.eeprom, self.nct75)
def __init__(self, i2c, ipcore=None, analyzer=None, adc_rst_pin=None, adc_ovfl_l_pin=None, i2s_rx_en_pin=None, i2s_ch_select_pin=None, tone_detect_pin=None, upload_ch_select_pin=None, sample_rate=48000): assert sample_rate > 0 and sample_rate <= WarlockDef.MAX_SAMPLING_RATE if (i2c and analyzer and adc_rst_pin and adc_ovfl_l_pin and i2s_rx_en_pin and i2s_ch_select_pin and tone_detect_pin and upload_ch_select_pin): self.i2c = i2c if isinstance(analyzer, basestring): self.analyzer = MIXFftAnalyzerSG(analyzer) else: self.analyzer = analyzer self.adc_rst_pin = adc_rst_pin self.adc_ovfl_l_pin = adc_ovfl_l_pin self.i2s_rx_en_pin = i2s_rx_en_pin self.i2s_ch_select_pin = i2s_ch_select_pin self.tone_detect_pin = tone_detect_pin self.upload_ch_select_pin = upload_ch_select_pin elif (ipcore and i2c): self.i2c = i2c if isinstance(ipcore, basestring): axi4_bus = AXI4LiteBus(ipcore, WarlockDef.MIX_MIK002_REG_SIZE) self.ipcore = MIXMIK002SGR(axi4_bus) else: self.ipcore = ipcore self.analyzer = self.ipcore.analyzer self.adc_rst_pin = Pin(self.ipcore.gpio, WarlockDef.ADC_RST_PIN) self.adc_ovfl_l_pin = Pin(self.ipcore.gpio, WarlockDef.ADC_OVFL_L_PIN) self.i2s_rx_en_pin = Pin(self.ipcore.gpio, WarlockDef.I2S_RX_EN_PIN) self.i2s_ch_select_pin = Pin(self.ipcore.gpio, WarlockDef.I2S_CH_SELECT_PIN) self.tone_detect_pin = Pin(self.ipcore.gpio, WarlockDef.TONE_DETECT_PIN) self.upload_ch_select_pin = Pin(self.ipcore.gpio, WarlockDef.UPLOAD_CH_SELECT_PIN) else: raise WarlockException("Parameter error") self.eeprom = CAT24C32(WarlockDef.EEPROM_DEV_ADDR, i2c) self.nct75 = NCT75(WarlockDef.SENSOR_DEV_ADDR, i2c) self.cat9555 = CAT9555(WarlockDef.CAT9555_DEV_ADDR, i2c) super(Warlock, self).__init__(self.eeprom, self.nct75, cal_table={}, range_table=warlock_range_table) self.sampling_rate = sample_rate self.scope = "" self.mode = ""
def __init__(self, i2c, ad7175=None, ipcore=None): self.eeprom = CAT24C32(Scope002006Def.EEPROM_DEV_ADDR, i2c) self.sensor = NCT75(Scope002006Def.SENSOR_DEV_ADDR, i2c) if ipcore: if isinstance(ipcore, basestring): axi4_bus = AXI4LiteBus(ipcore, Scope002006Def.MIX_DAQT1_REG_SIZE) ipcore = MIXDAQT1SGR( axi4_bus, 'AD7175', ad717x_mvref=Scope002006Def.AD7175_MVREF, code_polar=Scope002006Def.AD7175_CODE_POLAR, reference=Scope002006Def.AD7175_REFERENCE_SOURCE, buffer_flag=Scope002006Def.AD7175_BUFFER_FLAG, clock=Scope002006Def.AD7175_CLOCK, use_spi=False, use_gpio=True) ipcore.ad717x.config = {"ch0": {"P": "AIN0", "N": "AIN1"}} self.ad7175 = ipcore.ad717x self.gpio = ipcore.gpio self.tag_pins = [ Pin(self.gpio, Scope002006Def.TAG_BASE_PIN + x, Scope002006Def.GPIO_OUTPUT_DIR) for x in xrange(4) ] elif ad7175: if isinstance(ad7175, basestring): axi4_bus = AXI4LiteBus(ad7175, Scope002006Def.AD7175_REG_SIZE) ad7175 = MIXAd7175SG( axi4_bus, mvref=Scope002006Def.AD7175_MVREF, code_polar=Scope002006Def.AD7175_CODE_POLAR, reference=Scope002006Def.AD7175_REFERENCE_SOURCE, buffer_flag=Scope002006Def.AD7175_BUFFER_FLAG, clock=Scope002006Def.AD7175_CLOCK) ad7175.config = {"ch0": {"P": "AIN0", "N": "AIN1"}} self.ad7175 = ad7175 else: raise Scope002006Exception('Use one of aggregated IP or AD717X') super(Scope002006, self).__init__(self.eeprom, self.sensor, range_table=scope002006_range_table)
def __init__(self, ad7175=None, i2c=None, ipcore=None): if ipcore and ad7175: raise Dmm010Exception('Not allowed to use both aggregated IP and AD717X') if i2c: self.tca9538 = TCA9538(DMM010Def.TAC9538_I2C_ADDR, i2c) self.eeprom = CAT24C32(DMM010Def.CAT24C32_I2C_ADDR, i2c) self.sensor = NCT75(DMM010Def.NCT75_I2C_ADDR, i2c) else: self.tca9538 = TCA9538Emulator(DMM010Def.TAC9538_I2C_ADDR) self.eeprom = EepromEmulator("eeprom_emulator") self.sensor = NCT75Emulator("nct75_emulator") if ipcore: if isinstance(ipcore, basestring): axi4_bus = AXI4LiteBus(ipcore, DMM010Def.MIX_DAQT1_REG_SIZE) ipcore = MIXDAQT1SGR(axi4_bus, "AD7175", ad717x_mvref=DMM010Def.ADC_VREF_VOLTAGE_5000mV, code_polar=DMM010Def.AD7175_CODE_POLAR, reference=DMM010Def.AD7175_REFERENCE_SOURCE, buffer_flag=DMM010Def.AD7175_BUFFER_FLAG, clock=DMM010Def.AD7175_CLOCK, use_spi=False, use_gpio=False) self.ad7175 = ipcore.ad717x elif ad7175: if isinstance(ad7175, basestring): axi4_bus = AXI4LiteBus(ad7175, DMM010Def.PLAD7175_REG_SIZE) ad7175 = MIXAd7175SG(axi4_bus, mvref=DMM010Def.ADC_VREF_VOLTAGE_5000mV, code_polar=DMM010Def.AD7175_CODE_POLAR, reference=DMM010Def.AD7175_REFERENCE_SOURCE, buffer_flag=DMM010Def.AD7175_BUFFER_FLAG, clock=DMM010Def.AD7175_CLOCK) self.ad7175 = ad7175 else: self.ad7175 = MIXAd7175SGEmulator('ad7175_emulator', DMM010Def.ADC_VREF_VOLTAGE_5000mV) self.ad7175.config = { "ch0": {"P": "AIN0", "N": "AIN1"}, "ch1": {"P": "AIN2", "N": "AIN3"} } super(DMM010001, self).__init__(self.eeprom, self.sensor, cal_table=dmm010_calibration_info, range_table=dmm010_range_table) self.continuous_sample_channel = None self.measure_path = None
def __init__(self, i2c_ext, i2c_power, ipcore): if i2c_ext and i2c_power and ipcore: eeprom = CAT24C32(PSU001014Def.EEPROM_DEV_ADDR, i2c_ext) nct75 = NCT75(PSU001014Def.NCT75_DEV_ADDR, i2c_ext) self.tca9538 = TCA9538(PSU001014Def.TCA9538_ADDR, i2c_ext) self.ad5667_batt = AD5667R(PSU001014Def.DAC_BATT_ADDR, i2c_power, ref_mode=PSU001014Def.DAC_REF_MODE, mvref=PSU001014Def.DAC_VREF) self.ad5667_charge = AD5667R(PSU001014Def.DAC_CHARGE_ADDR, i2c_power, ref_mode=PSU001014Def.DAC_REF_MODE, mvref=PSU001014Def.DAC_VREF) self.mcp4725 = MCP4725(PSU001014Def.DAC_MCP4725_ADDR, i2c_power, mvref=PSU001014Def.MCP4725_VREF) if isinstance(ipcore, basestring): axi4_bus = AXI4LiteBus(ipcore, PSU001014Def.MIX_PSU001_REG_SIZE) self.ipcore = MIXPSU001SGR( axi4_bus, 'AD7175', ad717x_mvref=PSU001014Def.MVREF, code_polar=PSU001014Def.POLAR, reference=PSU001014Def.AD7175_REF_MODE, clock=PSU001014Def.CLOCK, use_gpio=False) else: self.ipcore = ipcore self.ad7175 = self.ipcore.ad717x super(PSU001014, self).__init__(eeprom, nct75, range_table=psu001_range_table) else: raise PSU001014Exception("Invalid parameter, please check") self.ch1_output_config = dict() self.ch2_output_config = dict() self.ch1_input_config = dict() self.ch2_input_config = dict() self.volt_diff = 3000.0 self.charge_current_vdac = 0 self.battery_current_vdac = 0
def __init__(self, i2c_io_exp=None, i2c=None, eeprom_dev_addr=PSU001003Def.EEPROM_DEV_ADDR, sensor_dev_addr=PSU001003Def.SENSOR_DEV_ADDR): if i2c_io_exp and i2c: self.cat9555 = CAT9555(PSU001003Def.CAT9555_ADDR, i2c_io_exp) self.eeprom = CAT24C32(eeprom_dev_addr, i2c) self.sensor = NCT75(sensor_dev_addr, i2c) elif i2c_io_exp is None and i2c_io_exp is None: self.cat9555 = CAT9555Emulator(0x20, None, None) self.eeprom = EepromEmulator('eeprom_emulator') self.sensor = NCT75Emulator('nct75_emulator') else: raise PSU001003Exception( 'Not Allowed: either of i2c_io_exp,i2c is None') super(PSU001003Base, self).__init__(self.eeprom, self.sensor)
def __init__(self, i2c, ipcore): self.eeprom = CAT24C32(WolverineiiDef.EEPROM_DEV_ADDR, i2c) self.sensor = NCT75(WolverineiiDef.SENSOR_DEV_ADDR, i2c) self.pca9536 = PCA9536(WolverineiiDef.IO_EXP_DEV_ADDR, i2c) if isinstance(ipcore, basestring): axi4_bus = AXI4LiteBus(ipcore, WolverineiiDef.MIXDAQT1_REG_SIZE) ipcore = MIXDAQT1SGR(axi4_bus, 'AD7175', ad717x_mvref=WolverineiiDef.AD7175_MVREF, code_polar=WolverineiiDef.AD7175_CODE_POLAR, reference=WolverineiiDef.AD7175_REFERENCE, clock=WolverineiiDef.AD7175_CLOCK, use_gpio=True) self.ipcore = ipcore self.ad7175 = self.ipcore.ad717x self.ad7175.config = { 'ch0': { 'P': 'AIN0', 'N': 'AIN1' }, 'ch1': { 'P': 'AIN2', 'N': 'AIN3' } } self.measure_path = dict() self.continuous_sample_mode = None self.gpio = ipcore.gpio self.tag_pins = [ Pin(self.gpio, WolverineiiDef.TAG_BASE_PIN + x, WolverineiiDef.GPIO_OUTPUT_DIR) for x in range(4) ] super(WolverineII, self).__init__(self.eeprom, self.sensor, range_table=wolverineii_range_table)
def __init__(self, i2c, ipcore, range_table=starlord_table): self.eeprom = CAT24C32(StarLordDef.EEPROM_I2C_ADDR, i2c) self.nct75 = NCT75(StarLordDef.TEMP_I2C_ADDR, i2c) self.pca9536 = PCA9536(StarLordDef.PCA9536_DEV_ADDR, i2c) if isinstance(ipcore, basestring): ipcore = MIXAUT5SGR(ipcore) self.ipcore = ipcore self.analyzer = self.ipcore.analyzer self.signal_source = self.ipcore.signal_source self.ad7175 = self.ipcore.ad717x self.ad7175.config = { 'ch0': { 'P': 'AIN0', 'N': 'AIN1' }, 'ch1': { 'P': 'AIN2', 'N': 'AIN3' } } self.adc_rst_pin = Pin(self.ipcore.gpio, StarLordDef.ADC_RESET_PIN) self.i2s_rx_en_pin = Pin(self.ipcore.gpio, StarLordDef.I2S_RX_EN_PIN) self.dac_rst_pin = Pin(self.ipcore.gpio, StarLordDef.DAC_RESET_PIN) self.i2s_tx_en_pin = Pin(self.ipcore.gpio, StarLordDef.I2S_TX_EN_PIN) self.i2s_ch_select = [ Pin(self.ipcore.gpio, StarLordDef.I2S_CH_SELECT_2), Pin(self.ipcore.gpio, StarLordDef.I2S_CH_SELECT_3) ] self.fft_source_select = Pin(self.ipcore.gpio, StarLordDef.FFT_SOURCE_SELECT) self.ad7175_upload_select = Pin(self.ipcore.gpio, StarLordDef.AD7175_TO_FFT_OR_NOT) super(StarLordBase, self).__init__(self.eeprom, self.nct75, range_table=range_table) self.is_lna_up = False self.is_analyzer_up = False self.is_enable_upload = False
def __init__(self, i2c, ipcore, range_table=moonstar_range_table, function_info=moonstar_function_info): self.tca9538 = TCA9538(MoonstarDef.CAT9538_DEV_ADDR, i2c) self.eeprom = CAT24C32(MoonstarDef.EEPROM_DEV_ADDR, i2c) self.sensor = NCT75(MoonstarDef.SENSOR_DEV_ADDR, i2c) if isinstance(ipcore, basestring): daqt1_axi4_bus = AXI4LiteBus(ipcore, MoonstarDef.MIXDAQT1_REG_SIZE) ipcore = MIXDMM007SGR(axi4_bus=daqt1_axi4_bus, ad717x_chip='AD7175', ad717x_mvref=MoonstarDef.ADC_VREF_VOLTAGE_5000mV, use_spi=False, use_gpio=False) self.ipcore = ipcore self.ad7175 = self.ipcore.ad717x self.ad7175.config = { 'ch0': {'P': 'AIN0', 'N': 'AIN1'} } super(MoonstarBase, self).__init__(self.eeprom, self.sensor, range_table=range_table) self.config = {} self.function_info = function_info self.protect = False
def __init__(self, i2c, adc_rst_pin=None, i2s_rx_en_pin=None, dac_rst_pin=None, i2s_tx_en_pin=None, sample_rate=192000, ipcore=None): assert sample_rate > 0 and sample_rate <= DazzlerDef.MAX_SAMPLING_RATE self.eeprom = CAT24C32(DazzlerDef.EEPROM_I2C_ADDR, i2c) self.nct75 = NCT75(DazzlerDef.SENSOR_I2C_ADDR, i2c) super(DazzlerBase, self).__init__(self.eeprom, self.nct75, range_table=dazzler_range_table) if ipcore: if isinstance(ipcore, basestring): axi4 = AXI4LiteBus(ipcore, DazzlerDef.MIX_AUT1_REG_SIZE) self.ip = MIXAUT1SGR(axi4) else: self.ip = ipcore self.analyzer = self.ip.analyzer self.signal_source = self.ip.signal_source self.adc_rst_pin = adc_rst_pin or Pin(self.ip.gpio, DazzlerDef.ADC_RESET_PIN) self.i2s_rx_en_pin = i2s_rx_en_pin or Pin(self.ip.gpio, DazzlerDef.I2S_RX_EN_PIN) self.dac_rst_pin = dac_rst_pin or Pin(self.ip.gpio, DazzlerDef.DAC_RESET_PIN) self.i2s_tx_en_pin = i2s_tx_en_pin or Pin(self.ip.gpio, DazzlerDef.I2S_TX_EN_PIN) else: raise DazzlerException("parameter 'ipcore' can not be None") self.sample_rate = sample_rate
def __init__(self, dac_i2c=None, eeprom_i2c=None): if dac_i2c: self.dac1 = AD5667R(ArmorDef.DAC1_DEV_ADDR, dac_i2c, ArmorDef.DAC_VOLTAGE_REF) self.dac2 = AD5667R(ArmorDef.DAC2_DEV_ADDR, dac_i2c, ArmorDef.DAC_VOLTAGE_REF) self.dac3 = MCP4725(ArmorDef.DAC3_DEV_ADDR, dac_i2c, ArmorDef.DAC3_VOLTAGE_REF) self.res1 = AD5272(ArmorDef.RES_1_ADDR, dac_i2c) self.res2 = AD5272(ArmorDef.RES_2_ADDR, dac_i2c) else: self.dac1 = AD5667REmulator("ad5667r_emulator_1") self.dac2 = AD5667REmulator("ad5667r_emulator_2") self.dac3 = MCP4725Emulator('mcp4725_emulator') self.res1 = AD5272Emulator("ad5272_emulator_1") self.res2 = AD5272Emulator("ad5272_emulator_2") if eeprom_i2c: self.eeprom = CAT24C32(ArmorDef.EEPROM_DEV_ADDR, eeprom_i2c) self.sensor = NCT75(ArmorDef.SENSOR_DEV_ADDR, eeprom_i2c) MIXBoard.__init__(self, self.eeprom, self.sensor, cal_table=armor_calibration_info, range_table=armor_range_table) self.pca9536 = PCA9536(ArmorDef.IO_EXP_DEV_ADDR, eeprom_i2c) else: self.eeprom = EepromEmulator('eeprom_emulator') self.sensor = NCT75Emulator('nct75_emulator') MIXBoard.__init__(self, None, None, cal_table=armor_calibration_info, range_table=armor_range_table) self.pca9536 = PCA9536Emulator('pca9536_emulator')
def __init__(self, i2c, spi=None, ad7175=None, ipcore=None, eeprom_dev_addr=OmegaDef.EEPROM_DEV_ADDR, sensor_dev_addr=OmegaDef.SENSOR_DEV_ADDR, cat9555_dev_addr=OmegaDef.CAT9555_DEV_ADDR, cal_info=None, range_table=None): if ipcore and ad7175: raise OmegaException( 'Not allowed to use both aggregated IP and AD7175 at the same time' ) elif ipcore and spi: raise OmegaException( 'Not allowed to use both aggregated IP and MIXQSPI at the same time' ) if i2c: self.eeprom = CAT24C32(eeprom_dev_addr, i2c) self.sensor = NCT75(sensor_dev_addr, i2c) self.cat9555 = CAT9555(cat9555_dev_addr, i2c) else: self.eeprom = EepromEmulator("eeprom_emulator") self.sensor = NCT75Emulator("nct75_emulator") self.cat9555 = CAT9555Emulator(cat9555_dev_addr, None, None) if ipcore is None: if isinstance(ad7175, basestring): ad717x_axi4_bus = AXI4LiteBus(ad7175, OmegaDef.PLAD7175_REG_SIZE) ad7175 = MIXAd7175SG(ad717x_axi4_bus, OmegaDef.ADC_VREF_VOLTAGE_5000mV) elif ad7175: self.ad7175 = ad7175 else: self.ad7175 = MIXAd7175SGEmulator( "mix_ad7175_sg_emulator", OmegaDef.ADC_VREF_VOLTAGE_5000mV) self.spi = spi or PLSPIBusEmulator('spi_emulator', OmegaDef.SPI_REG_SIZE) self.ad9832 = AD9832( self.spi) if self.spi is not None else AD9832Emulator( "ad9832_emulator") else: if isinstance(ipcore, basestring): daqt1_axi4_bus = AXI4LiteBus(ipcore, OmegaDef.MIXDAQT1_REG_SIZE) ipcore = MIXDAQT1SGR( axi4_bus=daqt1_axi4_bus, ad717x_chip='AD7175', ad717x_mvref=OmegaDef.ADC_VREF_VOLTAGE_5000mV, use_spi=True, use_gpio=False) self.ipcore = ipcore self.spi = self.ipcore.spi self.ad7175 = self.ipcore.ad717x self.ad9832 = AD9832( self.spi) if self.spi is not None else AD9832Emulator( "ad9832_emulator") self.line_select = None self.ad7175.config = { "ch0": { "P": "AIN0", "N": "AIN1" }, "ch1": { "P": "AIN2", "N": "AIN3" } } super(OmegaBase, self).__init__(self.eeprom, self.sensor, cal_table=cal_info, range_table=range_table) # RMS Voltage of DDS Output wave during board initialization self.dds_value_dict = { '20Hz': None, '100Hz': None, '200Hz': None, '1kHz': None, '10kHz': None, '30kHz': None, '100kHz': None, } self.omega_line_select = omega_line_select # calibration info self.omega_calibration_info = omega_calibration_info
def __init__(self, ipcore=None, signal_meter_0=None, signal_meter_1=None, spi=None, i2c=None, eeprom_dev_addr=MagikDef.EEPROM_DEV_ADDR, sensor_dev_addr=MagikDef.SENSOR_DEV_ADDR): if ipcore: if isinstance(ipcore, basestring): axi4_bus = AXI4LiteBus(ipcore, MagikDef.MIX_DAQT2_REG_SIZE) self.mix_daqt2 = MIXDAQT2SGR(axi4_bus, use_signal_meter1=True, use_spi=True, use_gpio=False) self.signal_meter0 = self.mix_daqt2.signal_meter0 self.signal_meter1 = self.mix_daqt2.signal_meter1 self.spi = self.mix_daqt2.spi else: self.ipcore = ipcore self.signal_meter0 = ipcore.signal_meter0 self.signal_meter1 = ipcore.signal_meter1 self.spi = ipcore.spi if signal_meter_0 or signal_meter_1 or spi: raise MagikException( 'Not allowed to use both Integrated IP and Separated IP at the same time!' ) else: if signal_meter_0 and signal_meter_1: if isinstance(signal_meter_0, basestring): axi4_bus = AXI4LiteBus(signal_meter_0, MagikDef.SIGNAL_METER_REG_SIZE) self.signal_meter0 = MIXSignalMeterSG(axi4_bus) else: self.signal_meter0 = signal_meter_0 if isinstance(signal_meter_1, basestring): axi4_bus = AXI4LiteBus(signal_meter_1, MagikDef.SIGNAL_METER_REG_SIZE) self.signal_meter1 = MIXSignalMeterSG(axi4_bus) else: self.signal_meter1 = signal_meter_1 elif not signal_meter_0 and not signal_meter_1: self.signal_meter0 = MIXSignalMeterSGEmulator( 'mix_signalmeter_sg_emulator', 256) self.signal_meter1 = MIXSignalMeterSGEmulator( 'mix_signalmeter_sg_emulator', 256) else: raise MagikException( 'signal_meter_0 and signal_meter_1 IP need to exist or be empty at the same time!' ) self.spi = spi if spi else MIXQSPISGEmulator( 'mix_qspi_sg_emulator', 256) if i2c: self.cat9555 = CAT9555(MagikDef.CAT9555_ADDR, i2c) self.nct75 = NCT75(sensor_dev_addr, i2c) self.eeprom = CAT24C32(eeprom_dev_addr, i2c) else: self.cat9555 = CAT9555Emulator(MagikDef.CAT9555_ADDR, None, None) self.eeprom = EepromEmulator('eeprom_emulator') self.nct75 = NCT75Emulator('nct75_emulator') self.spi.open() self.spi.set_speed(MagikDef.SPI_CLOCK_SPEED) self.spi.set_mode(MagikDef.SPI_BUS_MODE) ad9628_pdwn = Pin(self.cat9555, 6) ad9628_oeb = Pin(self.cat9555, 7) ad9628_cs = Pin(self.cat9555, 12) self.ad9628 = AD9628(self.spi, ad9628_pdwn, ad9628_oeb, ad9628_cs) super(MagikBase, self).__init__(self.eeprom, self.nct75, cal_table=magik_calibration_info, range_table=magik_range_table)