Skip to content

Commit

Permalink
Fix some type warnings and other minor issues.
Browse files Browse the repository at this point in the history
  • Loading branch information
flit committed Nov 27, 2021
1 parent ce76d4c commit 3b15009
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions pyocd_pemicro/pemicro_probe.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,10 @@ def __init__(self, serial_number):
raise exceptions.ProbeError("unable to get PEMicro DLL")

self._serial_number = serial_number
self._supported_protocols = None
self._supported_protocols = []
self._protocol = None
self._default_protocol = None
self._is_open = False
self._reset_delay_ms = -1
self.reset_pin_state = True
try:
self._pemicro.open(self._serial_number)
Expand Down Expand Up @@ -196,6 +195,8 @@ def close(self):
# ------------------------------------------- #
def connect(self, protocol=None):
"""! @brief Connect to the target via JTAG or SWD."""
assert self.session

# Handle default protocol.
if (protocol is None) or (protocol == DebugProbe.Protocol.DEFAULT):
protocol = self._default_protocol
Expand All @@ -209,6 +210,8 @@ def connect(self, protocol=None):
iface = PEMicroInterfaces.SWD
elif protocol == DebugProbe.Protocol.JTAG:
iface = PEMicroInterfaces.JTAG
else:
raise RuntimeError(f"unexpected protocol value {protocol}")

try:
if self.session.options.get('pemicro.power'):
Expand Down Expand Up @@ -239,6 +242,7 @@ def set_clock(self, frequency):
raise self._convert_exception(exc) from exc

def reset(self):
assert self.session
try:
# Just do read operation to flush last operation before reset
# Obviously the Flush doesn't work as excepted :-(
Expand Down

0 comments on commit 3b15009

Please sign in to comment.