Mercurial > hg > ede
comparison dbg/dbg.py @ 40:6b947f6d69d9
more docs and last minute bug fixes
author | james <jb302@eecs.qmul.ac.uk> |
---|---|
date | Tue, 22 Apr 2014 00:21:59 +0100 |
parents | db6b8c9552bb |
children |
comparison
equal
deleted
inserted
replaced
39:0f3bd942a7d4 | 40:6b947f6d69d9 |
---|---|
8 # see controller() in emu/main.c for the inverse | 8 # see controller() in emu/main.c for the inverse |
9 class controller: | 9 class controller: |
10 | 10 |
11 def __init__(self): | 11 def __init__(self): |
12 self.Emu = None | 12 self.Emu = None |
13 self.snd = self.snd_file | |
14 self.rcv = self.rcv_file | |
13 open('out', 'w').close() | 15 open('out', 'w').close() |
14 | 16 |
15 # Alternetive snd and rcv functions need to be | 17 # Alternetive snd and rcv functions need to be |
16 # written read/write using serial buffer to make | 18 # written read/write using serial buffer to make |
17 # this class talk to an emulator running on | 19 # this class talk to an emulator running on |
18 # an MCU | 20 # an MCU |
19 def snd(self, m): | 21 def snd_file(self, m): |
20 self.Emu.stdin.write(struct.pack('>B', m)) | 22 self.Emu.stdin.write(struct.pack('>B', m)) |
21 | 23 |
22 def rcv(self, l): | 24 def rcv_file(self, l): |
23 lc = 0 | 25 lc = 0 |
24 while lc != l: | 26 while lc != l: |
25 lc = os.path.getsize('out') | 27 lc = os.path.getsize('out') |
26 #sleep(0.5) | 28 #sleep(0.5) |
27 with open('out', 'r') as f: | 29 with open('out', 'r') as f: |