}
VDM_ACK = ['REQ', 'ACK', 'NAK', 'BSY']
+class SamplerateError(Exception):
+ pass
+
class Decoder(srd.Decoder):
api_version = 2
id = 'usb_power_delivery'
def us2samples(self, us):
if not self.samplerate:
- raise Exception('Need the samplerate.')
+ raise SamplerateError('Need the samplerate.')
return int(us * self.samplerate / 1000000)
def decode_packet(self):
def decode(self, ss, es, data):
if not self.samplerate:
- raise Exception('Cannot decode without samplerate.')
+ raise SamplerateError('Cannot decode without samplerate.')
for (self.samplenum, pins) in data:
# find edges ...
if self.oldpins == pins: