+ def i2c_ping(self, addr):
+ # 1. Write
+ # command (1) | number of write bytes (2) | number of read bytes (2) | bytes to write (0..)
+ msg = struct.pack(">BHHB", 0x08, 1, 0, addr)
+ ret = self.command(msg, 1)
+
+ if ord(ret[0]) != 0x1:
+ raise Exception("I2C ping failed")
+