X-Git-Url: https://sigrok.org/gitweb/?p=libsigrokdecode.git;a=blobdiff_plain;f=decoders%2Fddc.py;h=395f72ff8bcb16643a205ae81c3de2379a3c1caf;hp=cdeae6dafcee752827a5fd6c2fc4e5fb44e4b948;hb=a2d2aff27099449deb1a791b3adc05ee610861e6;hpb=9a12a6e7af3d7091d8e35dd1c731402cb80a01b0 diff --git a/decoders/ddc.py b/decoders/ddc.py index cdeae6d..395f72f 100644 --- a/decoders/ddc.py +++ b/decoders/ddc.py @@ -52,18 +52,18 @@ class Decoder(srd.Decoder): def start(self, metadata): self.out_ann = self.add(srd.OUTPUT_ANN, 'ddc') - def decode(self, start_sample, end_sample, i2c_data): + def decode(self, ss, es, data): try: - cmd, data, ack_bit = i2c_data + cmd, data, ack_bit = data except Exception as e: raise Exception('malformed I2C input: %s' % str(e)) from e if self.state is None: # Wait for the DDC session to start. - if cmd in ('START', 'START_REPEAT'): + if cmd in ('START', 'START REPEAT'): self.state = 'start' elif self.state == 'start': - if cmd == 'ADDRESS_READ' and data == 80: + if cmd == 'ADDRESS READ' and data == 80: # 80 is the I2C slave address of a connected display, # so this marks the start of the DDC data transfer. self.state = 'transfer' @@ -71,9 +71,8 @@ class Decoder(srd.Decoder): # Got back to the idle state. self.state = None elif self.state == 'transfer': - if cmd == 'DATA_READ': + if cmd == 'DATA READ': # There shouldn't be anything but data reads on this # address, so ignore everything else. - self.put(start_sample, end_sample, self.out_ann, - [0, ['0x%.2x' % data]]) + self.put(ss, es, self.out_ann, [0, ['0x%.2x' % data]])