X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=decoders%2Fonewire_network%2Fpd.py;h=f07110b5c1199d3c4144b88b7b4cf281294148fc;hb=bb6f9c500e4119aa9558dfc66ba82bf7ef3772c5;hp=fca16dae272de10d9830d90bd6fc8d44fe3403fc;hpb=4539e9ca58966ce3c9cad4801b16c315e86ace01;p=libsigrokdecode.git diff --git a/decoders/onewire_network/pd.py b/decoders/onewire_network/pd.py index fca16da..f07110b 100644 --- a/decoders/onewire_network/pd.py +++ b/decoders/onewire_network/pd.py @@ -21,18 +21,20 @@ import sigrokdecode as srd # Dictionary of ROM commands and their names, next state. command = { - 0x33: ['Read ROM' , 'GET ROM' ], - 0x0f: ['Conditional read ROM' , 'GET ROM' ], - 0xcc: ['Skip ROM' , 'TRANSPORT' ], - 0x55: ['Match ROM' , 'GET ROM' ], - 0xf0: ['Search ROM' , 'SEARCH ROM'], - 0xec: ['Conditional search ROM', 'SEARCH ROM'], - 0x3c: ['Overdrive skip ROM' , 'TRANSPORT' ], - 0x69: ['Overdrive match ROM' , 'GET ROM' ], + 0x33: ['Read ROM' , 'GET ROM' ], + 0x0f: ['Conditional read ROM' , 'GET ROM' ], + 0xcc: ['Skip ROM' , 'TRANSPORT' ], + 0x55: ['Match ROM' , 'GET ROM' ], + 0xf0: ['Search ROM' , 'SEARCH ROM'], + 0xec: ['Conditional search ROM' , 'SEARCH ROM'], + 0x3c: ['Overdrive skip ROM' , 'TRANSPORT' ], + 0x69: ['Overdrive match ROM' , 'GET ROM' ], + 0xa5: ['Resume' , 'TRANSPORT' ], + 0x96: ['DS2408: Disable Test Mode' , 'GET ROM' ], } class Decoder(srd.Decoder): - api_version = 2 + api_version = 3 id = 'onewire_network' name = '1-Wire network layer' longname = '1-Wire serial communication bus (network layer)' @@ -40,11 +42,15 @@ class Decoder(srd.Decoder): license = 'gplv2+' inputs = ['onewire_link'] outputs = ['onewire_network'] + tags = ['Embedded/industrial'] annotations = ( - ('text', 'Human-readable text'), + ('text', 'Text'), ) def __init__(self): + self.reset() + + def reset(self): self.ss_block = 0 self.es_block = 0 self.state = 'COMMAND' @@ -129,7 +135,7 @@ class Decoder(srd.Decoder): # Data collector. def onewire_collect(self, length, val, ss, es): # Storing the sample this sequence begins with. - if self.bit_cnt == 1: + if self.bit_cnt == 0: self.ss_block = ss self.data = self.data & ~(1 << self.bit_cnt) | (val << self.bit_cnt) self.bit_cnt += 1