The SAE J1850 Variable Pulse Width decoder used to track and annotate
the width of pulses between edges, which duplicates existing features
of the 'timing' decoder. Remove this part from J1850, users can always
connect the input signal to multiple decoders as needed..
Also sort annotation rows while we are here. Top to bottom represents
raw wire bits to highest interpretation layer, as in other decoders.
def timeuf(t):
return int (t * 1000.0 * 1000.0)
def timeuf(t):
return int (t * 1000.0 * 1000.0)
-def normalize_time(t):
- if t >= 1.0:
- return '%d s' % t
- elif t >= 0.001:
- return '%d ms' % (t * 1000.0)
- elif t >= 0.000001:
- return '%d μs' % (t * 1000.0 * 1000.0)
- elif t >= 0.000000001:
- return '%d ns' % (t * 1000.0 * 1000.0 * 1000.0)
- else:
- return '%f' % t
-
ANN_RAW, ANN_SOF, ANN_IFS, ANN_DATA, \
ANN_RAW, ANN_SOF, ANN_IFS, ANN_DATA, \
class Decoder(srd.Decoder):
api_version = 3
class Decoder(srd.Decoder):
api_version = 3
{'id': 'data', 'name': 'Data', 'desc': 'Data line'},
)
annotations = (
{'id': 'data', 'name': 'Data', 'desc': 'Data line'},
)
annotations = (
('raw', 'Raw'),
('sof', 'SOF'),
('ifs', 'EOF/IFS'),
('raw', 'Raw'),
('sof', 'SOF'),
('ifs', 'EOF/IFS'),
('packet', 'Packet'),
)
annotation_rows = (
('packet', 'Packet'),
)
annotation_rows = (
- ('packets', 'Packets', (Ann.ANN_PACKET,)),
- ('bytes', 'Bytes', (Ann.ANN_DATA,)),
('raws', 'Raws', (Ann.ANN_RAW, Ann.ANN_SOF, Ann.ANN_IFS,)),
('raws', 'Raws', (Ann.ANN_RAW, Ann.ANN_SOF, Ann.ANN_IFS,)),
- ('times', 'Times', (Ann.ANN_TIME,)),
+ ('bytes', 'Bytes', (Ann.ANN_DATA,)),
+ ('packets', 'Packets', (Ann.ANN_PACKET,)),
es = self.samplenum
samples = es - ss
es = self.samplenum
samples = es - ss
- txt = normalize_time(samples / self.samplerate)
- self.put(ss, es, self.out_ann, [Ann.ANN_TIME, [txt]])
t = timeuf(samples / self.samplerate)
if self.state == 'IDLE': # detect and set speed from the size of sof
if pin == self.active and t in range(self.sofl , self.sofh):
t = timeuf(samples / self.samplerate)
if self.state == 'IDLE': # detect and set speed from the size of sof
if pin == self.active and t in range(self.sofl , self.sofh):