)
def __init__(self, **kwargs):
- self.state = None
self.curslave = -1
self.curdirection = None
self.packets = [] # Local cache of I²C packets
self.out_python = self.register(srd.OUTPUT_PYTHON, proto_id='i2c')
if self.options['address'] not in range(0, 127 + 1):
raise Exception('Invalid slave (must be 0..127).')
- if self.options['direction'] not in ('both', 'read', 'write'):
- raise Exception('Invalid direction (valid: read/write/both).')
# Grab I²C packets into a local cache, until an I²C STOP condition
# packet comes along. At some point before that STOP condition, there
self.packets = []
else:
pass # Do nothing, only add the I²C packet to our cache.
-