From: Vesa-Pekka Palmu Date: Mon, 26 Dec 2022 17:00:56 +0000 (+0200) Subject: adf435x: Clean up SPI data input X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=53cbedf5852028f54891066b0a5e698c4dd0c42a;p=libsigrokdecode.git adf435x: Clean up SPI data input Avoid generic variable names. Only unpack parameters which are provided by the lower layer decoder after the stacked decoder checked their type and is aware of their meaning. --- diff --git a/decoders/adf435x/pd.py b/decoders/adf435x/pd.py index c60ed4e..3cc74b6 100644 --- a/decoders/adf435x/pd.py +++ b/decoders/adf435x/pd.py @@ -126,10 +126,11 @@ class Decoder(srd.Decoder): def decode(self, ss, es, data): - ptype, data1, data2 = data + ptype, _, _ = data if ptype == 'CS-CHANGE': - if data1 == 1: + _, cs_before, cs_after = data + if cs_before == 1: if len(self.bits) == 32: reg_value, reg_pos = self.decode_bits(0, 3) self.put(reg_pos[0], reg_pos[1], self.out_ann, [ANN_REG, @@ -141,4 +142,5 @@ class Decoder(srd.Decoder): field = self.decode_field(*field_desc) self.bits = [] if ptype == 'BITS': - self.bits = data1 + self.bits + _, mosi_bits, miso_bits = data + self.bits = mosi_bits + self.bits