Compare commits
8 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
fdf5fdd605 | ||
|
a660184520 | ||
|
6e8e73669e | ||
|
b32bbf99c8 | ||
|
cdc365a5f0 | ||
|
521339066c | ||
|
48a36b90c9 | ||
|
1c37582952 |
2
.github/workflows/python.yml
vendored
2
.github/workflows/python.yml
vendored
@ -1,6 +1,6 @@
|
|||||||
name: Python package
|
name: Python package
|
||||||
|
|
||||||
on: [push]
|
on: [push, pull_request]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
test:
|
||||||
|
@ -44,6 +44,7 @@ STC8 series
|
|||||||
* STC8G1K17-20/16PIN (BSL version: 7.3.12U)
|
* STC8G1K17-20/16PIN (BSL version: 7.3.12U)
|
||||||
* STC8G2K64S4 (BSL version: 7.3.11U)
|
* STC8G2K64S4 (BSL version: 7.3.11U)
|
||||||
* STC8H1K08 (BSL version: 7.3.12U)
|
* STC8H1K08 (BSL version: 7.3.12U)
|
||||||
|
* STC8H1K17T (BSL version: 7.4.5U)
|
||||||
* STC8H3K64S2 (BSL version: 7.4.1U)
|
* STC8H3K64S2 (BSL version: 7.4.1U)
|
||||||
* STC8H3K64S4 (BSL version: 7.4.1U)
|
* STC8H3K64S4 (BSL version: 7.4.1U)
|
||||||
* STC8H4K64TL (BSL version: 7.4.3U)
|
* STC8H4K64TL (BSL version: 7.4.3U)
|
||||||
|
@ -22,7 +22,7 @@ options:
|
|||||||
-h, --help show this help message and exit
|
-h, --help show this help message and exit
|
||||||
-e, --erase only erase flash memory
|
-e, --erase only erase flash memory
|
||||||
-a, --autoreset cycle power automatically by asserting DTR
|
-a, --autoreset cycle power automatically by asserting DTR
|
||||||
-A {dtr,rts}, --resetpin {dtr,rts}
|
-A {dtr,rts,dtr_inverted,rts_inverted}, --resetpin {dtr,rts,dtr_inverted,rts_inverted}
|
||||||
pin to hold down when using --autoreset (default: DTR)
|
pin to hold down when using --autoreset (default: DTR)
|
||||||
-r RESETCMD, --resetcmd RESETCMD
|
-r RESETCMD, --resetcmd RESETCMD
|
||||||
shell command for board power-cycling (instead of DTR
|
shell command for board power-cycling (instead of DTR
|
||||||
|
@ -1 +1 @@
|
|||||||
__version__ = "1.8"
|
__version__ = "1.10"
|
||||||
|
@ -263,7 +263,7 @@ def cli():
|
|||||||
exclusives.add_argument("-e", "--erase", help="only erase flash memory", action="store_true")
|
exclusives.add_argument("-e", "--erase", help="only erase flash memory", action="store_true")
|
||||||
parser.add_argument("-a", "--autoreset", help="cycle power automatically by asserting DTR", action="store_true")
|
parser.add_argument("-a", "--autoreset", help="cycle power automatically by asserting DTR", action="store_true")
|
||||||
parser.add_argument("-A", "--resetpin", help="pin to hold down when using --autoreset (default: DTR)",
|
parser.add_argument("-A", "--resetpin", help="pin to hold down when using --autoreset (default: DTR)",
|
||||||
choices=["dtr", "rts"], default="dtr")
|
choices=["dtr", "rts", "dtr_inverted", "rts_inverted"], default="dtr")
|
||||||
parser.add_argument("-r", "--resetcmd", help="shell command for board power-cycling (instead of DTR assertion)", action="store")
|
parser.add_argument("-r", "--resetcmd", help="shell command for board power-cycling (instead of DTR assertion)", action="store")
|
||||||
parser.add_argument("-P", "--protocol", help="protocol version (default: auto)",
|
parser.add_argument("-P", "--protocol", help="protocol version (default: auto)",
|
||||||
choices=["stc89", "stc89a", "stc12a", "stc12b", "stc12", "stc15a", "stc15", "stc8", "stc8d", "stc8g", "usb15", "auto"], default="auto")
|
choices=["stc89", "stc89a", "stc12a", "stc12b", "stc12", "stc15a", "stc15", "stc8", "stc8d", "stc8g", "usb15", "auto"], default="auto")
|
||||||
|
@ -265,22 +265,30 @@ class StcBaseProtocol(ABC):
|
|||||||
def set_option(self, name, value):
|
def set_option(self, name, value):
|
||||||
self.options.set_option(name, value)
|
self.options.set_option(name, value)
|
||||||
|
|
||||||
def reset_device(self, resetcmd=False, resetpin=False):
|
def reset_device(self, resetcmd=False, resetpin=False, invertreset=False):
|
||||||
if not resetcmd:
|
if not resetcmd:
|
||||||
print("Cycling power: ", end="")
|
print("Cycling power: ", end="")
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
|
|
||||||
if resetpin == "rts":
|
if resetpin == "rts":
|
||||||
self.ser.setRTS(True)
|
self.ser.setRTS(True)
|
||||||
else:
|
elif resetpin == "dtr":
|
||||||
self.ser.setDTR(True)
|
self.ser.setDTR(True)
|
||||||
|
elif resetpin == "rts_inverted":
|
||||||
|
self.ser.setRTS(False)
|
||||||
|
else: # dtr_inverted
|
||||||
|
self.ser.setDTR(False)
|
||||||
|
|
||||||
time.sleep(0.25)
|
time.sleep(0.25)
|
||||||
|
|
||||||
if resetpin == "rts":
|
if resetpin == "rts":
|
||||||
self.ser.setRTS(False)
|
self.ser.setRTS(False)
|
||||||
else:
|
elif resetpin == "dtr":
|
||||||
self.ser.setDTR(False)
|
self.ser.setDTR(False)
|
||||||
|
elif resetpin == "rts_inverted":
|
||||||
|
self.ser.setRTS(True)
|
||||||
|
else: # dtr_inverted
|
||||||
|
self.ser.setDTR(True)
|
||||||
|
|
||||||
time.sleep(0.030)
|
time.sleep(0.030)
|
||||||
print("done")
|
print("done")
|
||||||
@ -390,11 +398,11 @@ class StcAutoProtocol(StcBaseProtocol):
|
|||||||
("stc12", r"(STC|IAP)(10|11|12)\D"),
|
("stc12", r"(STC|IAP)(10|11|12)\D"),
|
||||||
("stc15a", r"(STC|IAP)15[FL][012]0\d(E|EA|)$"),
|
("stc15a", r"(STC|IAP)15[FL][012]0\d(E|EA|)$"),
|
||||||
("stc15", r"(STC|IAP|IRC)15\D"),
|
("stc15", r"(STC|IAP|IRC)15\D"),
|
||||||
("stc8d", r"STC8H(3|4|8)K"),
|
("stc8g", r"STC8H1K\d\d$"),
|
||||||
("stc8d", r"STC32"),
|
|
||||||
("stc8d", r"STC8A8K\d\dD4"),
|
|
||||||
("stc8g", r"STC8H"),
|
|
||||||
("stc8g", r"STC8G"),
|
("stc8g", r"STC8G"),
|
||||||
|
("stc8d", r"STC8H"),
|
||||||
|
("stc8d", r"STC32"),
|
||||||
|
("stc8d", r"STC8A8K\d\dD\d"),
|
||||||
("stc8", r"STC8\D")]
|
("stc8", r"STC8\D")]
|
||||||
|
|
||||||
for protocol_name, pattern in protocol_database:
|
for protocol_name, pattern in protocol_database:
|
||||||
|
Loading…
Reference in New Issue
Block a user