X-Git-Url: https://sigrok.org/gitweb/?p=libsigrokdecode.git;a=blobdiff_plain;f=decoders%2Fltc26x7%2Fpd.py;h=e0c6a7da4c858d4df52fad4b15dc487cb07daa9d;hp=69913c5ddd670dc67130f0803c29b93535a7df10;hb=c7c4c06c0f04a8e080eeaab41f1c76421844cf8c;hpb=5c9ab2c1d4baa2b2350b9ffe6e90f4d40d6f1c62 diff --git a/decoders/ltc26x7/pd.py b/decoders/ltc26x7/pd.py index 69913c5..e0c6a7d 100644 --- a/decoders/ltc26x7/pd.py +++ b/decoders/ltc26x7/pd.py @@ -50,11 +50,11 @@ class Decoder(srd.Decoder): license = 'gplv2+' inputs = ['i2c'] outputs = [] - tags = ['Display'] + tags = ['IC', 'Analog/digital'] options = ( - {'id': 'part', 'desc': 'Part', 'default': 'ltc26x7', + {'id': 'chip', 'desc': 'Chip', 'default': 'ltc26x7', 'values': ('ltc2607', 'ltc2617', 'ltc2627')}, - {'id': 'ref', 'desc': 'Reference voltage', 'default': 1.5}, + {'id': 'vref', 'desc': 'Reference voltage (V)', 'default': 1.5}, ) annotations = ( ('slave_addr', 'Slave address'), @@ -122,14 +122,14 @@ class Decoder(srd.Decoder): def handle_data(self, data): self.data = (self.data << 8) & 0xFF00 self.data += data - if self.options['part'] == 'ltc2617': + if self.options['chip'] == 'ltc2617': self.data = (self.data >> 2) - self.data = (self.options['ref'] * self.data) / 0x3FFF - elif self.options['part'] == 'ltc2627': + self.data = (self.options['vref'] * self.data) / 0x3FFF + elif self.options['chip'] == 'ltc2627': self.data = (self.data >> 4) - self.data = (self.options['ref'] * self.data) / 0x0FFF + self.data = (self.options['vref'] * self.data) / 0x0FFF else: - self.data = (self.options['ref'] * self.data) / 0xFFFF + self.data = (self.options['vref'] * self.data) / 0xFFFF ann = [] for format in input_voltage_format: ann.append(format % self.data)