X-Git-Url: http://sigrok.org/gitweb/?a=blobdiff_plain;f=decoders%2Fcan%2Fpd.py;h=1a99c307c94861acf9deca895d6ef181ab81fb2a;hb=1d4fe1c19c0948fb67b4a91495b126a763ea7adb;hp=7638c2f72b6898fc0769465508f1609f5e4b8bb8;hpb=d4a28d0fb6e1380590564be2b47ba3642130555b;p=libsigrokdecode.git diff --git a/decoders/can/pd.py b/decoders/can/pd.py index 7638c2f..1a99c30 100644 --- a/decoders/can/pd.py +++ b/decoders/can/pd.py @@ -14,8 +14,7 @@ ## GNU General Public License for more details. ## ## You should have received a copy of the GNU General Public License -## along with this program; if not, write to the Free Software -## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +## along with this program; if not, see . ## import sigrokdecode as srd @@ -57,14 +56,14 @@ class Decoder(srd.Decoder): ('ack-delimiter', 'ACK delimiter'), ('stuff-bit', 'Stuff bit'), ('warnings', 'Human-readable warnings'), - ('bits', 'Bits'), + ('bit', 'Bit'), ) annotation_rows = ( - ('bits', 'Bits', (17,)), - ('fields', 'Fields', tuple(range(17))), + ('bits', 'Bits', (15, 17)), + ('fields', 'Fields', tuple(range(15)) + (16,)), ) - def __init__(self, **kwargs): + def __init__(self): self.samplerate = None self.reset_variables() @@ -120,8 +119,6 @@ class Decoder(srd.Decoder): return False # Stuff bit. Keep it in self.rawbits, but drop it from self.bits. - self.putx([15, ['Stuff bit: %d' % self.rawbits[-1], - 'SB: %d' % self.rawbits[-1], 'SB']]) self.bits.pop() # Drop last bit. return True @@ -310,13 +307,13 @@ class Decoder(srd.Decoder): # Get the index of the current CAN frame bit (without stuff bits). bitnum = len(self.bits) - 1 - # Emit a bit value annotation. - self.putx([17, [str(can_rx)]]) - # If this is a stuff bit, remove it from self.bits and ignore it. if self.is_stuff_bit(): + self.putx([15, [str(can_rx)]]) self.curbit += 1 # Increase self.curbit (bitnum is not affected). return + else: + self.putx([17, [str(can_rx)]]) # Bit 0: Start of frame (SOF) bit if bitnum == 0: