def get_ranges(self): """Requests the last measurements of all sensors""" cmd = I2C.pack8(Command.MeasureAll, 0) self.send(cmd) data = self.receive(2 * self.n) ranges = list() for i in range(self.n): j = i * 2 ranges.append(I2C.pack16(data[(i * 2) + 1], data[i * 2])) return ranges
def get_range(self, sensor): """Requests the last measurement of a specific sensor""" cmd = I2C.pack8(Command.MeasureOne, sensor) self.send(cmd) r = self.receive(2) return I2C.pack16(r[1], r[0])