['Data write', 'Data write'],
['Warnings', 'Human-readable warnings'],
]
+ binary = (
+ 'Address read',
+ 'Address write',
+ 'Data read',
+ 'Data write',
+ )
def __init__(self, **kwargs):
self.samplerate = None
def start(self):
self.out_proto = self.register(srd.OUTPUT_PYTHON)
self.out_ann = self.register(srd.OUTPUT_ANN)
+ self.out_binary = self.add(srd.OUTPUT_BINARY)
self.out_bitrate = self.register(srd.OUTPUT_META,
meta=(int, 'Bitrate', 'Bitrate from Start bit to Stop bit'))
def putp(self, data):
self.put(self.startsample, self.samplenum, self.out_proto, data)
+ def putb(self, data):
+ self.put(self.startsample, self.samplenum, self.out_binary, data)
+
def is_start_condition(self, scl, sda):
# START condition (S): SDA = falling, SCL = high
if (self.oldsda == 1 and sda == 0) and scl == 1:
if self.options['address_format'] == 'shifted':
d = d >> 1
+ bin_class = -1
if self.state == 'FIND ADDRESS' and self.wr == 1:
cmd = 'ADDRESS WRITE'
+ bin_class = 1
elif self.state == 'FIND ADDRESS' and self.wr == 0:
cmd = 'ADDRESS READ'
+ bin_class = 0
elif self.state == 'FIND DATA' and self.wr == 1:
cmd = 'DATA WRITE'
+ bin_class = 3
elif self.state == 'FIND DATA' and self.wr == 0:
cmd = 'DATA READ'
+ bin_class = 2
self.putp([cmd, d])
self.putx([proto[cmd][0], ['%s: %02X' % (proto[cmd][1], d),
'%s: %02X' % (proto[cmd][2], d), '%02X' % d]])
+ self.putb((bin_class, bytes([d])))
# Done with this packet.
self.startsample = -1