diff options
author | Iztok Jeras <iztok.jeras@gmail.com> | 2012-07-13 22:59:12 +0200 |
---|---|---|
committer | Iztok Jeras <iztok.jeras@gmail.com> | 2012-07-15 15:02:57 +0200 |
commit | e540618c9d8d04ebb2e639ad1e650d689c89a818 (patch) | |
tree | 0a62225b3d5143ff48c772959b9532120f95a9be /decoders | |
parent | 99f5f3b5ac31347795582872a5d92f3d9430c21d (diff) | |
download | libsigrokdecode-e540618c9d8d04ebb2e639ad1e650d689c89a818.tar.gz libsigrokdecode-e540618c9d8d04ebb2e639ad1e650d689c89a818.zip |
onewire: combined reset and presence detect events, avoid unneeded overdrive exit message
Diffstat (limited to 'decoders')
-rw-r--r-- | decoders/onewire_link/onewire_link.py | 14 | ||||
-rw-r--r-- | decoders/onewire_network/onewire_network.py | 2 |
2 files changed, 7 insertions, 9 deletions
diff --git a/decoders/onewire_link/onewire_link.py b/decoders/onewire_link/onewire_link.py index 44bc4f8..d111882 100644 --- a/decoders/onewire_link/onewire_link.py +++ b/decoders/onewire_link/onewire_link.py @@ -189,21 +189,19 @@ class Decoder(srd.Decoder): # Save the sample number for the falling edge. self.rise = self.samplenum self.state = "WAIT FOR PRESENCE DETECT" - self.put(self.fall, self.rise, self.out_ann, [0, ['RESET']]) - self.put(self.fall, self.rise, self.out_proto, ['RESET', 0]) # Reset the timer. self.fall = self.samplenum # Exit overdrive mode - self.put(self.fall, self.cnt_bit[self.overdrive], self.out_ann, [0, ['EXIT OVERDRIVE MODE']]) - self.overdrive = 0 + if (self.overdrive): + self.put(self.fall, self.cnt_bit[self.overdrive], self.out_ann, [0, ['EXIT OVERDRIVE MODE']]) + self.overdrive = 0 + # Clear command bit counter and data register self.bit_cnt = 0 self.command = 0 elif ((self.samplenum - self.fall > self.cnt_overdrive_reset) and (self.overdrive)): # Save the sample number for the falling edge. self.rise = self.samplenum self.state = "WAIT FOR PRESENCE DETECT" - self.put(self.fall, self.rise, self.out_ann, [0, ['RESET']]) - self.put(self.fall, self.rise, self.out_proto, ['RESET', 0]) # Reset the timer. self.fall = self.samplenum # Otherwise this is assumed to be a data bit. @@ -218,7 +216,7 @@ class Decoder(srd.Decoder): # create presence detect event if (self.present) : self.state = 'WAIT FOR FALLING EDGE' else : self.state = 'WAIT FOR RISING EDGE' - self.put(self.samplenum, 0, self.out_ann, [0, ['PRESENCE: ' + "False" if self.present else "True"]]) - self.put(self.samplenum, 0, self.out_proto, ['PRESENCE', self.present]) + self.put(self.samplenum, 0, self.out_ann, [0, ['RESET/PRESENCE: %s' % ('False' if self.present else 'True')]]) + self.put(self.samplenum, 0, self.out_proto, ['RESET/PRESENCE', not self.present]) else: raise Exception('Invalid state: %d' % self.state) diff --git a/decoders/onewire_network/onewire_network.py b/decoders/onewire_network/onewire_network.py index 5587f97..d2b86a0 100644 --- a/decoders/onewire_network/onewire_network.py +++ b/decoders/onewire_network/onewire_network.py @@ -77,7 +77,7 @@ class Decoder(srd.Decoder): [code, val] = data # State machine. - if (code == "RESET"): + if (code == "RESET/PRESENCE"): self.state = "COMMAND" self.search = "P" self.bit_cnt = 0 |