-
Notifications
You must be signed in to change notification settings - Fork 5
/
reset.py
executable file
·30 lines (25 loc) · 1001 Bytes
/
reset.py
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
# Usage:
# --device <serdev> --baud <baudrate> --nodex <#>
import ghidorah
import argparse
defaultDevice = '/dev/cu.usbserial-FT079LCR2'
defaultDevice = '/dev/cu.usbserial-USAKMYZM'
defaultDevice = '/dev/cu.usbserial-A2003EyG'
parser = argparse.ArgumentParser(description='Parameters for the command.')
parser.add_argument('--baud', type=int, default=57600,
help='baud rate')
parser.add_argument('--device', type=str, default=defaultDevice,
help='serial port')
parser.add_argument('--nodex', type=str, default='0xFF',
help='nodex (0-254, or 255 (default) for broadcast)')
parser.add_argument('--verbose', action='store_true',
help='verbosity')
args = parser.parse_args()
baud = args.baud
device = args.device
nodex = int(args.nodex, 0)
verbose = args.verbose
l = ghidorah.Ghidorah(device, baud, verbose)
# clr $7F; jmp $A027
l.write(nodex, 0x600, 0x6, [0x7F, 0x00, 0x71, 0x7E, 0xA0, 0x27])
l.execute(nodex, 0x600)