mirror of
https://github.com/DreamSourceLab/DSView.git
synced 2025-01-23 13:42:55 +08:00
Merge branch 'dev-1.3.2' of https://github.com/dreamsourcelab/DSView into dev-1.3.2
This commit is contained in:
commit
441e514922
@ -3,7 +3,7 @@
|
||||
##
|
||||
## Copyright (C) 2011 Gareth McMullin <gareth@blacksphere.co.nz>
|
||||
## Copyright (C) 2012-2014 Uwe Hermann <uwe@hermann-uwe.de>
|
||||
## Copyright (C) 2019 DreamSourceLab <support@dreamsourcelab.com>
|
||||
## Copyright (C) 2024 DreamSourceLab <support@dreamsourcelab.com>
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published by
|
||||
@ -19,6 +19,10 @@
|
||||
## along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
##
|
||||
|
||||
#
|
||||
# 2024/3/18 DreamSourceLab : format output based on wordsize in hex
|
||||
#
|
||||
|
||||
import sigrokdecode as srd
|
||||
from collections import namedtuple
|
||||
|
||||
@ -151,9 +155,9 @@ class Decoder(srd.Decoder):
|
||||
|
||||
# Dataword annotations.
|
||||
if self.have_miso:
|
||||
self.put(ss, es, self.out_ann, [0, ['@%02X' % self.misodata]])
|
||||
self.put(ss, es, self.out_ann, [0, ['@{1:0>{0}X}'.format(int((self.options['wordsize']+3)/4),self.misodata)]])
|
||||
if self.have_mosi:
|
||||
self.put(ss, es, self.out_ann, [1, ['@%02X' % self.mosidata]])
|
||||
self.put(ss, es, self.out_ann, [1, ['@{1:0>{0}X}'.format(int((self.options['wordsize']+3)/4),self.mosidata)]])
|
||||
|
||||
def reset_decoder_state(self):
|
||||
self.misodata = 0 if self.have_miso else None
|
||||
|
@ -3,7 +3,7 @@
|
||||
##
|
||||
## Copyright (C) 2011 Gareth McMullin <gareth@blacksphere.co.nz>
|
||||
## Copyright (C) 2012-2014 Uwe Hermann <uwe@hermann-uwe.de>
|
||||
## Copyright (C) 2019 DreamSourceLab <support@dreamsourcelab.com>
|
||||
## Copyright (C) 2024 DreamSourceLab <support@dreamsourcelab.com>
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published by
|
||||
@ -19,6 +19,10 @@
|
||||
## along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
##
|
||||
|
||||
#
|
||||
# 2024/3/18 DreamSourceLab : format output based on wordsize in hex
|
||||
#
|
||||
|
||||
import sigrokdecode as srd
|
||||
from collections import namedtuple
|
||||
|
||||
@ -199,11 +203,13 @@ class Decoder(srd.Decoder):
|
||||
bit = self.mosibits[blen-i-1]
|
||||
self.put(bit[1], bit[2], self.out_ann, [3, ['%d' % bit[0]]])
|
||||
|
||||
|
||||
|
||||
# Dataword annotations.
|
||||
if self.have_miso:
|
||||
self.put(ss, es, self.out_ann, [0, ['@%02X' % self.misodata]])
|
||||
self.put(ss, es, self.out_ann, [0, ['@{1:0>{0}X}'.format(int((self.options['wordsize']+3)/4),self.misodata)]])
|
||||
if self.have_mosi:
|
||||
self.put(ss, es, self.out_ann, [1, ['@%02X' % self.mosidata]])
|
||||
self.put(ss, es, self.out_ann, [1, ['@{1:0>{0}X}'.format(int((self.options['wordsize']+3)/4),self.mosidata)]])
|
||||
|
||||
def reset_decoder_state(self):
|
||||
self.misodata = 0 if self.have_miso else None
|
||||
|
@ -2,6 +2,7 @@
|
||||
## This file is part of the libsigrokdecode project.
|
||||
##
|
||||
## Copyright (C) 2019 Ben Dooks <ben.dooks@codethink.co.uk>
|
||||
## Copyright (C) 2024 DreamSourceLab <support@dreamsourcelab.com>
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published by
|
||||
@ -17,6 +18,10 @@
|
||||
## along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
##
|
||||
|
||||
#
|
||||
# 2024/3/18 DreamSourceLab : fix channel display error
|
||||
#
|
||||
|
||||
import sigrokdecode as srd
|
||||
|
||||
MAX_CHANNELS = 8
|
||||
@ -79,11 +84,10 @@ class Decoder(srd.Decoder):
|
||||
if self.ss_block is not None:
|
||||
if self.bitcount >= self.bitdepth:
|
||||
self.bitcount = 0
|
||||
self.channel += 1
|
||||
|
||||
c1 = 'Channel %d' % self.channel
|
||||
c2 = 'C%d' % self.channel
|
||||
c3 = '%d' % self.channel
|
||||
c1 = 'Channel %d' % (self.channel % self.channels)
|
||||
c2 = 'C%d' % (self.channel % self.channels)
|
||||
c3 = '%d' % (self.channel % self.channels)
|
||||
if self.bitdepth <= 8:
|
||||
v = '%02x' % self.data
|
||||
elif self.bitdepth <= 16:
|
||||
@ -91,21 +95,21 @@ class Decoder(srd.Decoder):
|
||||
else:
|
||||
v = '%08x' % self.data
|
||||
|
||||
if self.channel < self.channels:
|
||||
ch = self.channel
|
||||
else:
|
||||
ch = 0
|
||||
ch = self.channel % self.channels
|
||||
|
||||
self.put(self.ss_block, self.samplenum, self.out_ann,
|
||||
[ch, ['%s: %s' % (c1, v), '%s: %s' % (c2, v),
|
||||
'%s: %s' % (c3, v)]])
|
||||
|
||||
self.data = 0
|
||||
self.ss_block = self.samplenum
|
||||
self.samplecount += 1
|
||||
self.channel += 1
|
||||
|
||||
# Check for new frame.
|
||||
# Note, frame may be a single clock, or active for the first
|
||||
# sample in the frame.
|
||||
|
||||
if frame != self.lastframe and frame == 1:
|
||||
self.channel = 0
|
||||
self.bitcount = 0
|
||||
|
Loading…
x
Reference in New Issue
Block a user