def __init__(self, bus): self.bus = bus self.eeprom = chips.EEPROM(bus) self.temp1 = chips.LM75(bus, 0x48) self.temp2 = chips.LM75(bus, 0x49) self.spi = chips.SPI(bus, 0x2a) self.flash = chips.SPIFlash(self.spi, 0b0001)
def scan_devices(self): devs = [chips.SinaraEEPROM(self, addr=0x57), chips.LM75(self), chips.PCF8574(self, addr=0x3e), chips.Si5324(self), chips.SFF8472(self)] devs = {dev.addr: dev for dev in devs} for port in sorted(self.ports): if port in self.skip: continue self.enable(port) logger.info("%s: ...", port) for addr in self.scan(): if addr in devs: devs[addr].report() else: logger.debug("ignoring addr %#02x", addr)
bus.reset() # bus.clear() try: for action in args.action: if action == "scan_tree": t = list(bus.scan_tree()) logger.warning("%s", t) logger.warning("%s", bus.make_graph(t)) logger.warning("\n" + "\n".join(bus.format_graph(bus.make_graph(t)))) elif action == "scan": bus.scan_devices() elif action == "dump_eeproms": bus.dump_eeproms() elif action == "lm75": bus.enable(args.eem) lm75 = chips.LM75(bus) lm75.report() elif action == "si5324": bus.enable("LOC0") si = chips.Si5324(bus) s = chips.Si5324.FrequencySettings() if True: s.n31 = 4993 # 100 MHz CKIN1 s.n32 = 4565 # 114.285 MHz CKIN2 XTAL s.n1_hs = 10 s.nc1_ls = 4 s.nc2_ls = 4 s.n2_hs = 10 s.n2_ls = 19972 # 125MHz CKOUT s.bwsel = 4 else: