能显示数值
This commit is contained in:
+18
-14
@@ -50,10 +50,10 @@ For 'START', 'START REPEAT', 'STOP', 'ACK', and 'NACK' <pdata> is None.
|
||||
# CMD: [annotation-type-index, long annotation, short annotation]
|
||||
proto = {
|
||||
'BIT': [0, 'Bit', 'B'],
|
||||
'START': [1, 'Start', 'Ss'],
|
||||
'DATA READ': [2, 'Start repeat', 'Sr'],
|
||||
'DATA READ1': [3, 'ACK', 'A'],
|
||||
'DATA READ2': [4, 'NACK', 'N'],
|
||||
'START': [1, 'Start', 'S'],
|
||||
'ASC': [2, 'arc start cds', 'ARC'],
|
||||
'P': [3, 'P', 'P'],
|
||||
'S': [4, 'S', 'S'],
|
||||
'ERR': [5, 'Address read', 'AR'],
|
||||
'CRC': [6, 'Address write', 'AW'],
|
||||
'STOP': [7, 'Stop', 'P'],
|
||||
@@ -76,17 +76,21 @@ class Decoder(srd.Decoder):
|
||||
annotations = (
|
||||
('208', 'bit', 'Data/address bit'),
|
||||
('207', 'start', 'Start condition'),
|
||||
('6', 'data', 'Repeat start condition'),
|
||||
('5', 'data1', 'ACK'),
|
||||
('0', 'data2', 'NACK'),
|
||||
('6', 'asc', 'arc start cds'),
|
||||
('5', 'data1', 'p'),
|
||||
('0', 'data2', 's'),
|
||||
('112', 'error', 'Address read'),
|
||||
('111', 'crc', 'Address write'),
|
||||
('201', 'stop', 'Stop condition'),
|
||||
('202', 'value', 'value'),
|
||||
('203', 'value1', 'value2'),
|
||||
|
||||
)
|
||||
annotation_rows = (
|
||||
('bits', 'Bits', (0,)),
|
||||
('addr-data', 'Address/Data', ( 2, 3, 4,)),
|
||||
('flag', 'Flag', ( 1, 5, 6, 7)),
|
||||
('p', 'p', ( 8,)),
|
||||
('s', 's', ( 9,)),
|
||||
('flag', 'Flag', ( 1, 2,3,4,5, 6, 7)),
|
||||
)
|
||||
binary = (
|
||||
('address-read', 'Address read'),
|
||||
@@ -181,8 +185,8 @@ class Decoder(srd.Decoder):
|
||||
self.put(bit[1], bit[2], self.out_ann, [0, ['%d' % bit[0]]])
|
||||
|
||||
|
||||
self.putx([proto[cmd][0], ['%s: {$}' % proto[cmd][1], '%s: {$}' % proto[cmd][2], '{$}', d]])
|
||||
|
||||
self.put(self.ss, self.es, self.out_ann, [8, ['%d' % d]])
|
||||
self.putx([proto[cmd][0], proto[cmd][1:]])
|
||||
# Done with this packet.
|
||||
self.bitcount = self.databyte = 0
|
||||
self.bits = []
|
||||
@@ -199,13 +203,13 @@ class Decoder(srd.Decoder):
|
||||
self.handle_start()
|
||||
elif self.state == 'FIND DATA':
|
||||
(scl, sda) = self.wait([{0: 'f'}])
|
||||
self.handle_data(scl, sda,'DATA READ',2,'FIND DATA1')
|
||||
self.handle_data(scl, sda,'ASC',3,'FIND DATA1')
|
||||
elif self.state == 'FIND DATA1':
|
||||
(scl, sda) = self.wait([{0: 'f'}])
|
||||
self.handle_data(scl, sda,'DATA READ1',12,'FIND DATA2')
|
||||
self.handle_data(scl, sda,'P',13,'FIND DATA2')
|
||||
elif self.state == 'FIND DATA2':
|
||||
(scl, sda) = self.wait([{0: 'f'}])
|
||||
self.handle_data(scl, sda,'DATA READ2',13,'FIND ERR')
|
||||
self.handle_data(scl, sda,'S',13,'FIND ERR')
|
||||
elif self.state == 'FIND ERR':
|
||||
(scl, sda) = self.wait([{0: 'f'}])
|
||||
self.handle_data(scl, sda,'ERR',2,'FIND CRC')
|
||||
|
||||
Reference in New Issue
Block a user