- if self.state == 'start':
- # Start of a transfer, see if we want this one.
- if cmd == 'ADDRESS READ' and self.options['direction'] == 'write':
+ # Add the I2C packet to our local cache.
+ self.packets.append([ss, es, data])
+
+ if cmd in ('ADDRESS READ', 'ADDRESS WRITE'):
+ self.curslave = databyte
+ self.curdirection = cmd[8:].lower()
+ elif cmd in ('STOP', 'START REPEAT'):
+ # If this chunk was not for the correct slave, drop it.
+ if self.options['address'] == 0:
+ pass
+ elif self.curslave != self.options['address']:
+ self.packets = []