ANN_RAW = 2
# Values are verbose and short annotation, respectively.
-protocol = {
+proto = {
'START': ['START', 'S'],
'START REPEAT': ['START REPEAT', 'Sr'],
'STOP': ['STOP', 'P'],
cmd = 'START REPEAT' if (self.is_repeat_start == 1) else 'START'
self.put(self.out_proto, [cmd, None])
- self.put(self.out_ann, [ANN_SHIFTED, [protocol[cmd][0]]])
- self.put(self.out_ann, [ANN_SHIFTED_SHORT, [protocol[cmd][1]]])
+ self.put(self.out_ann, [ANN_SHIFTED, [proto[cmd][0]]])
+ self.put(self.out_ann, [ANN_SHIFTED_SHORT, [proto[cmd][1]]])
self.state = 'FIND ADDRESS'
self.bitcount = self.databyte = 0
cmd = 'DATA READ'
self.put(self.out_proto, [cmd, d])
- self.put(self.out_ann, [ANN_SHIFTED, [protocol[cmd][0], '0x%02x' % d]])
- self.put(self.out_ann, [ANN_SHIFTED_SHORT, [protocol[cmd][1], '0x%02x' % d]])
+ self.put(self.out_ann, [ANN_SHIFTED, [proto[cmd][0], '0x%02x' % d]])
+ self.put(self.out_ann, [ANN_SHIFTED_SHORT, [proto[cmd][1], '0x%02x' % d]])
# Done with this packet.
self.startsample = -1
self.startsample = self.samplenum
ack_bit = 'NACK' if (sda == 1) else 'ACK'
self.put(self.out_proto, [ack_bit, None])
- self.put(self.out_ann, [ANN_SHIFTED, [protocol[ack_bit][0]]])
- self.put(self.out_ann, [ANN_SHIFTED_SHORT, [protocol[ack_bit][1]]])
+ self.put(self.out_ann, [ANN_SHIFTED, [proto[ack_bit][0]]])
+ self.put(self.out_ann, [ANN_SHIFTED_SHORT, [proto[ack_bit][1]]])
# There could be multiple data bytes in a row, so either find
# another data byte or a STOP condition next.
self.state = 'FIND DATA'
def found_stop(self, scl, sda):
self.startsample = self.samplenum
self.put(self.out_proto, ['STOP', None])
- self.put(self.out_ann, [ANN_SHIFTED, [protocol['STOP'][0]]])
- self.put(self.out_ann, [ANN_SHIFTED_SHORT, [protocol['STOP'][1]]])
+ self.put(self.out_ann, [ANN_SHIFTED, [proto['STOP'][0]]])
+ self.put(self.out_ann, [ANN_SHIFTED_SHORT, [proto['STOP'][1]]])
self.state = 'FIND START'
self.is_repeat_start = 0
[<packet-type>, <rxtx>, <packet-data>]
This is the list of <packet-types>s and their respective <packet-data>:
- - 'STARTBIT': The data is the (integer) value of the start bit (0 or 1).
+ - 'STARTBIT': The data is the (integer) value of the start bit (0/1).
- 'DATA': The data is the (integer) value of the UART data. Valid values
range from 0 to 512 (as the data can be up to 9 bits in size).
- - 'PARITYBIT': The data is the (integer) value of the parity bit (0 or 1).
+ - 'PARITYBIT': The data is the (integer) value of the parity bit (0/1).
- 'STOPBIT': The data is the (integer) value of the stop bit (0 or 1).
- - 'INVALID STARTBIT': The data is the (integer) value of the start bit
- (0 or 1).
- - 'INVALID STOPBIT': The data is the (integer) value of the stop bit
- (0 or 1).
+ - 'INVALID STARTBIT': The data is the (integer) value of the start bit (0/1).
+ - 'INVALID STOPBIT': The data is the (integer) value of the stop bit (0/1).
- 'PARITY ERROR': The data is a tuple with two entries. The first one is
the expected parity value, the second is the actual parity value.
- TODO: Frame error?