From 51dd512ff860dd1db496cb0f96c2ac35d391ef83 Mon Sep 17 00:00:00 2001 From: chenyue Date: Wed, 17 Jun 2026 21:56:35 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=86=E7=A6=BB=E6=95=B0=E6=8D=AE=E5=88=B0?= =?UTF-8?q?=E4=B8=8D=E5=90=8C=E7=9A=84=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 1-BISS/pd.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/1-BISS/pd.py b/1-BISS/pd.py index 9fb1920..53fe030 100644 --- a/1-BISS/pd.py +++ b/1-BISS/pd.py @@ -54,8 +54,8 @@ proto = { 'ASC': [2, 'arc start cds', 'ARC'], 'P': [3, 'P', 'P'], 'S': [4, 'S', 'S'], - 'ERR': [5, 'Address read', 'AR'], - 'CRC': [6, 'Address write', 'AW'], + 'ERR': [5, 'err', 'err'], + 'CRC': [6, 'CRC', 'CRC'], 'STOP': [7, 'Stop', 'P'], } @@ -146,7 +146,7 @@ class Decoder(srd.Decoder): self.state = 'FIND START' self.bits = [] # Gather 8 bits of data plus the ACK/NACK bit. - def handle_data(self, scl, sda,cmd,size,next_state): + def handle_data(self, scl, sda,cmd,size,next_state,num): # 记录数据值 self.databyte <<= 1 @@ -185,7 +185,7 @@ class Decoder(srd.Decoder): self.put(bit[1], bit[2], self.out_ann, [0, ['%d' % bit[0]]]) - self.put(self.ss, self.es, self.out_ann, [8, ['{$}', d]]) + self.put(self.ss, self.es, self.out_ann, [num, ['{$}', d]]) self.putx([proto[cmd][0], proto[cmd][1:]]) # Done with this packet. self.bitcount = self.databyte = 0 @@ -203,19 +203,19 @@ class Decoder(srd.Decoder): self.handle_start() elif self.state == 'FIND DATA': (scl, sda) = self.wait([{0: 'f'}]) - self.handle_data(scl, sda,'ASC',3,'FIND DATA1') + self.handle_data(scl, sda,'ASC',3,'FIND DATA1',1) elif self.state == 'FIND DATA1': (scl, sda) = self.wait([{0: 'f'}]) - self.handle_data(scl, sda,'P',13,'FIND DATA2') + self.handle_data(scl, sda,'P',13,'FIND DATA2',8) elif self.state == 'FIND DATA2': (scl, sda) = self.wait([{0: 'f'}]) - self.handle_data(scl, sda,'S',13,'FIND ERR') + self.handle_data(scl, sda,'S',13,'FIND ERR',9) elif self.state == 'FIND ERR': (scl, sda) = self.wait([{0: 'f'}]) - self.handle_data(scl, sda,'ERR',2,'FIND CRC') + self.handle_data(scl, sda,'ERR',2,'FIND CRC',1) elif self.state == 'FIND CRC': (scl, sda) = self.wait([{0: 'f'}]) - self.handle_data(scl, sda,'CRC',6,'FIND STOP') + self.handle_data(scl, sda,'CRC',6,'FIND STOP',1) elif self.state == 'FIND STOP': (scl, sda) = self.wait([{0: 'h', 1: 'r'}]) self.handle_stop()