def iglooReg(bus, rm, slot, address, nbytes): t.openRM(rm) bus.write(0x00, [0x06]) bus.write(t.bridgeAddress(slot), [0x11, 0x03, 0, 0, 0]) bus.write(0x09, [address]) bus.read(0x09, nbytes) return bus.sendBatch()
def readIgloo(slot, address, num_bytes): b.write(0x00,[0x06]) b.write(t.bridgeAddress(slot),[0x11,0x03,0,0,0]) b.write(0x09,[address]) b.read(0x09, num_bytes) message = b.sendBatch()[-1] return t.reverseBytes(message)
def writeIgloo(rm,slot,address,messageList): t.openRM(b,rm) b.write(0x00,[0x06]) b.write(t.bridgeAddress(slot),[0x11,0x03,0,0,0]) b.write(0x09,[address] + messageList) message = b.sendBatch()[-1] return t.reverseBytes(message)
def iglooReg(bus,rm,slot,address,nbytes): t.openRM(rm) bus.write(0x00,[0x06]) bus.write(t.bridgeAddress(slot),[0x11,0x03,0,0,0]) bus.write(0x09,[address]) bus.read(0x09,nbytes) return bus.sendBatch()
def getID(self): # Reset entire board by writing 0x6 to 0x0. self.bus.write(0x00,[0x06]) # Note that the i2c_select has register address 0x11 # Value : 4 = 0x04 selects 0x50 # Note that the SSN expects 32 bits (4 bytes) for writing (send 0x4, 0, 0, 0) self.bus.write(t.bridgeAddress(self.slot),[0x11,0x04,0,0,0]) # Send 0x0 to 0x50 in order to set pointer for reading ID # This removes the permutation problem! self.bus.write(0x50,[0x00]) self.bus.read(0x50,8) raw = self.bus.sendBatch()[-1] return raw
def getID(self): # Reset entire board by writing 0x6 to 0x0. self.bus.write(0x00, [0x06]) # Note that the i2c_select has register address 0x11 # Value : 4 = 0x04 selects 0x50 # Note that the SSN expects 32 bits (4 bytes) for writing (send 0x4, 0, 0, 0) self.bus.write(t.bridgeAddress(self.slot), [0x11, 0x04, 0, 0, 0]) # Send 0x0 to 0x50 in order to set pointer for reading ID # This removes the permutation problem! self.bus.write(0x50, [0x00]) self.bus.read(0x50, 8) raw = self.bus.sendBatch()[-1] return raw
def readTempHumi(slot, num_bytes, key, hold, verbosity=0): bus.write(0x00,[0x06]) bus.write(t.bridgeAddress(slot),[0x11,0x05,0,0,0]) bus.write(0x40,[triggerDict[key][hold]]) bus.read(0x40, num_bytes + 1) # also read checksum byte message = bus.sendBatch()[-1] check = Checksum(message,1) crc = check.result value = getValue(message) if verbosity > 1: print 'message: ', message print 'checksum: ', crc print 'value: ', value return [crc,function[key](value)]
def openIgloo(rm,slot): t.openRM(b,rm) #the igloo is value "3" in I2C_SELECT table b.write(t.bridgeAddress(slot),[0x11,0x03,0,0,0]) b.sendBatch()
def writeBridge(rm, slot, address, messageList): t.openRM(b, rm) b.write(t.bridgeAddress(slot), [address] + messageList) return b.sendBatch()
def readBridge(slot, address, num_bytes): b.write(t.bridgeAddress(slot), [address]) b.read(t.bridgeAddress(slot), num_bytes) message = b.sendBatch()[-1] return t.reverseBytes(message)
def writeBridge(rm,slot,address,messageList): t.openRM(b,rm) b.write(t.bridgeAddress(slot),[address] + messageList) return b.sendBatch()
def readBridge(slot, address, num_bytes): b.write(t.bridgeAddress(slot),[address]) b.read(t.bridgeAddress(slot), num_bytes) message = b.sendBatch()[-1] return t.reverseBytes(message)