forked from cyber-murmel/rtltool
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcommands.py
More file actions
32 lines (20 loc) · 755 Bytes
/
commands.py
File metadata and controls
32 lines (20 loc) · 755 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
def read_mac(rtl, args):
mac = rtl.read_mac()
print(f'MAC: {":".join(map(lambda x: "%02x" % x, mac))}')
def chip_id(rtl, args):
pass
def read_flash(rtl, args):
with open(args.filename, "wb") as file:
file.write(rtl.read_flash(args.address, args.size))
def erase_flash(rtl, args):
rtl.erase_flash()
def erase_region(rtl, args):
rtl.erase_region(args.address, args.size)
def write_flash(rtl, args):
for address, filename in args.addr_filename:
with open(filename, "rb") as file:
rtl.write_flash(address, file.read())
def verify_flash(rtl, args):
for address, filename in args.addr_filename:
with open(filename, "rb") as file:
rtl.verify_flash(address, file.read())