# [T_PARITY_ERROR, (0, 1)]
#
-import sigrokdecode
+import sigrokdecode as srd
# States
WAIT_FOR_START_BIT = 0
else:
raise Exception('Invalid parity type: %d' % parity_type)
-class Decoder(sigrokdecode.Decoder):
+class Decoder(srd.Decoder):
id = 'uart'
name = 'UART'
longname = 'Universal Asynchronous Receiver/Transmitter (UART)'
# TODO: Options to invert the signal(s).
# ...
}
- annotation = [
+ annotations = [
# ANN_ASCII
- ["ASCII", "TODO: description"],
+ ['ASCII', 'TODO: description'],
# ANN_DEC
- ["Decimal", "TODO: description"],
+ ['Decimal', 'TODO: description'],
# ANN_HEX
- ["Hex", "TODO: description"],
+ ['Hex', 'TODO: description'],
# ANN_OCT
- ["Octal", "TODO: description"],
+ ['Octal', 'TODO: description'],
# ANN_BITS
- ["Bits", "TODO: description"],
+ ['Bits', 'TODO: description'],
]
def __init__(self, **kwargs):
- self.out_proto = None
- self.out_ann = None
-
# Set defaults, can be overridden in 'start'.
self.baudrate = 115200
self.num_data_bits = 8
def start(self, metadata):
self.samplerate = metadata['samplerate']
- self.out_proto = self.output_new(sigrokdecode.SRD_OUTPUT_PROTOCOL, 'uart')
- self.out_ann = self.output_new(sigrokdecode.SRD_OUTPUT_ANNOTATION, 'uart')
+ self.out_proto = self.add(srd.OUTPUT_PROTO, 'uart')
+ self.out_ann = self.add(srd.OUTPUT_ANN, 'uart')
# TODO
### self.baudrate = metadata['baudrate']
self.put(self.samplenum, self.samplenum, self.out_ann,
[ANN_ASCII, ['Stop bit', 'Stop', 'P']])
- def decode(self, timeoffset, duration, data): # TODO
+ def decode(self, ss, es, data): # TODO
# for (samplenum, (rx, tx)) in data:
for (samplenum, (rx,)) in data: