summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUwe Hermann <uwe@hermann-uwe.de>2013-09-29 20:05:13 +0200
committerUwe Hermann <uwe@hermann-uwe.de>2013-09-29 20:05:13 +0200
commitedad813467a4a248edaa1c91377d532b2e7f8786 (patch)
tree84dabf659c2ae4feabcfdd18ef709589b8dbfe84
parentd1970f14488ad23f595994779831cd8897c39300 (diff)
downloadlibsigrokdecode-edad813467a4a248edaa1c91377d532b2e7f8786.tar.gz
libsigrokdecode-edad813467a4a248edaa1c91377d532b2e7f8786.zip
usb_signalling: Properly use different annotation types.
-rw-r--r--decoders/usb_signalling/pd.py15
1 files changed, 10 insertions, 5 deletions
diff --git a/decoders/usb_signalling/pd.py b/decoders/usb_signalling/pd.py
index 05ff3d5..44aaaca 100644
--- a/decoders/usb_signalling/pd.py
+++ b/decoders/usb_signalling/pd.py
@@ -65,7 +65,12 @@ class Decoder(srd.Decoder):
'signalling': ['Signalling', 'full-speed'],
}
annotations = [
- ['Text', 'Human-readable text'],
+ ['symbol', 'Symbol'],
+ ['sop', 'Start of packet (SOP)'],
+ ['eop', 'End of packet (EOP)'],
+ ['bit', 'Bit'],
+ ['stuffbit', 'Stuff bit'],
+ ['packet', 'Packet'],
]
def __init__(self):
@@ -118,17 +123,17 @@ class Decoder(srd.Decoder):
self.ss_sop = self.samplenum
self.set_new_target_samplenum()
self.putpx(['SOP', None])
- self.putx([0, ['SOP']])
+ self.putx([1, ['SOP']])
self.state = 'GET BIT'
def handle_bit(self, sym, b):
if self.consecutive_ones == 6 and b == '0':
# Stuff bit. Don't add to the packet, reset self.consecutive_ones.
- self.putb([0, ['SB: %s/%s' % (sym, b)]])
+ self.putb([4, ['SB: %s/%s' % (sym, b)]])
self.consecutive_ones = 0
else:
# Normal bit. Add it to the packet, update self.consecutive_ones.
- self.putb([0, ['%s/%s' % (sym, b)]])
+ self.putb([3, ['%s/%s' % (sym, b)]])
self.packet += b
if b == '1':
self.consecutive_ones += 1
@@ -146,7 +151,7 @@ class Decoder(srd.Decoder):
if self.syms[-2:] == ['SE0', 'J']:
# Got an EOP, i.e. we now have a full packet.
self.putpb(['PACKET', self.packet])
- self.putb([0, ['PACKET: %s' % self.packet]])
+ self.putb([5, ['PACKET: %s' % self.packet]])
self.bitnum, self.packet, self.syms, self.state = 0, '', [], 'IDLE'
self.consecutive_ones = 0