Skip to content

Commit a44ee56

Browse files
committed
working ok
1 parent da663a8 commit a44ee56

File tree

2 files changed

+19
-11
lines changed

2 files changed

+19
-11
lines changed

i2c_transactions.py

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -178,25 +178,30 @@ def process_transaction(self):
178178

179179
return new_frame
180180

181-
def _process_data_frame(self, frame):
182-
byte = int.from_bytes(frame.data['data'], 'little')
183-
184-
185-
self.current_transaction.data.append(byte)
181+
def _process_start_frame(self, frame):
182+
if self.current_transaction: # repeated start
183+
print("Repeated start, skipping")
184+
return
185+
print("Start")
186+
self.current_transaction = Transaction(frame.start_time)
186187

187188
def _process_address_frame(self, frame):
188189
address= frame.data['address'] # bytes
189190
read = frame.data['read'] # bool
190191
ack = frame.data['ack'] # bool
192+
print("Address")
191193

192194
self.current_transaction.is_read = read
193195
self.current_transaction.i2c_node_addr = address
194-
def _process_start_frame(self, frame):
195-
if self.current_transaction: # repeated start
196-
return
197-
self.current_transaction = Transaction(frame.start_time)
196+
197+
def _process_data_frame(self, frame):
198+
print("Data")
199+
byte = int.from_bytes(frame.data['data'], 'little')
200+
201+
self.current_transaction.data.append(byte)
198202

199203
def _process_stop_frame(self, frame):
204+
print("Stop")
200205
self.current_transaction.end_time = frame.end_time
201206
new_frame = self.process_transaction()
202207
self.current_transaction = None
@@ -213,7 +218,8 @@ def decode(self, frame):
213218
if frame_type == 'start': # begin new transaction or repeated start
214219
self._process_start_frame(frame)
215220
if self.current_transaction is None:
216-
if self._debug: print("EXITing `decode` due to missing transaction for non-start frame")
221+
print("the first stop will trigger this?")
222+
print("EXITing `decode` due to missing transaction for non-start frame")
217223
return
218224

219225
if frame_type == 'address': # read or write + I2C slave addr
@@ -233,6 +239,8 @@ def decode(self, frame):
233239
print(key, "=>", value)
234240

235241
return new_frame
242+
else:
243+
print("new frame is None")
236244

237245
# return AnalyzerFrame('mytype', frame.start_time, frame.end_time, {
238246
# 'input_type': frame.type

register_decoder.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ def single_byte_decode(self, rw, b0):
178178
current_register = self.register_map[self.current_bank][b0]
179179
#bitfields = self.load_bitfields(current_register)
180180
self.prev_single_byte_write = b0
181-
return "setup read from %s"%current_register
181+
return "setup read from %s"%current_register['name']
182182
else: #READ
183183
# print("current bank", self.current_bank)
184184
# print("prev single byte write:", self.prev_single_byte_write)

0 commit comments

Comments
 (0)