forked from upsidedownlabs/msptool
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodel.py
More file actions
40 lines (28 loc) · 968 Bytes
/
model.py
File metadata and controls
40 lines (28 loc) · 968 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import serial
import serial.tools.list_ports
import os
class Model:
def __init__(self):
self.currentCom =""
self.filePath=""
#self.port_list = list(serial.tools.list_ports.comports())
#self.ports=list()
pass
def serial_ports(self):
return serial.tools.list_ports.comports()
def flash(self):
print("Flashing started")
print("In model the curent com is: ",self.currentCom)
print("In model the file path is:",self.filePath)
com =self.currentCom.split()[0]
print(com)
command = "./mspdebug/mspdebug rom-bsl -d " + com + " \"prog " + self.filePath + "\""
os.system(command)
if __name__ == '__main__':
pass
#def show_port(self):
# #print(self.port_list[1].__dict__)
# print("ShowPort function in Model")
# for port, desc, hwid in sorted(self.port_list):
# self.ports.append(port)
# return self.ports