-# FIXME: This is just some example input for testing purposes...
-example_packets = [
- # START condition.
- {'type': 'S', 'range': (10, 11), 'data': None, 'ann': ''},
-
- # Nunchuk init: Write 0x40,0x00 to slave address 0x54.
- {'type': 'AW', 'range': (12, 13), 'data': 0x54, 'ann': ''},
- {'type': 'DW', 'range': (14, 15), 'data': 0x40, 'ann': ''},
- {'type': 'AW', 'range': (16, 17), 'data': 0x54, 'ann': ''},
- {'type': 'DW', 'range': (18, 19), 'data': 0x00, 'ann': ''},
-
- # Get data: Read 6 bytes of data.
- {'type': 'DR', 'range': (20, 21), 'data': 0x11, 'ann': ''},
- {'type': 'DR', 'range': (22, 23), 'data': 0x22, 'ann': ''},
- {'type': 'DR', 'range': (24, 25), 'data': 0x33, 'ann': ''},
- {'type': 'DR', 'range': (26, 27), 'data': 0x44, 'ann': ''},
- {'type': 'DR', 'range': (28, 29), 'data': 0x55, 'ann': ''},
- {'type': 'DR', 'range': (30, 31), 'data': 0x66, 'ann': ''},
-
- # STOP condition.
- {'type': 'P', 'range': (32, 33), 'data': None, 'ann': ''},
-]
-
-class Sample():
- def __init__(self, data):
- self.data = data
- def probe(self, probe):
- s = self.data[int(probe / 8)] & (1 << (probe % 8))
- return True if s else False
-
-def sampleiter(data, unitsize):
- for i in range(0, len(data), unitsize):
- yield(Sample(data[i:i+unitsize]))
-
-class Decoder(sigrok.Decoder):