Skip to content

Commit

Permalink
probe: cmsis-dap: very basic implementation to get a "connect" LED st…
Browse files Browse the repository at this point in the history
…atus display (#1620)
  • Loading branch information
rgrr authored Aug 30, 2023
1 parent 6d42caa commit d532e45
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions pyocd/probe/pydapaccess/dap_access_cmsis_dap.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ class SWOStatus:
RUNNING = 3
ERROR = 4

class DAP_LED:
DAP_DEBUGGER_CONNECTED = 0
DAP_TARGET_RUNNING = 1

LOG = logging.getLogger(__name__)

TRACE = LOG.getChild("trace")
Expand Down Expand Up @@ -922,6 +926,9 @@ def connect(self, port=DAPAccessIntf.PORT.DEFAULT):
elif self._dap_port == DAPAccessIntf.PORT.JTAG:
self.configure_jtag()

self._protocol.set_led(DAP_LED.DAP_DEBUGGER_CONNECTED, 1)
self._protocol.set_led(DAP_LED.DAP_TARGET_RUNNING, 0)

@locked
def configure_swd(self, turnaround=1, always_send_data_phase=False):
self.flush()
Expand Down Expand Up @@ -950,6 +957,8 @@ def jtag_sequence(self, cycles, tms, read_tdo, tdi):
@locked
def disconnect(self):
self.flush()
self._protocol.set_led(DAP_LED.DAP_DEBUGGER_CONNECTED, 0)
self._protocol.set_led(DAP_LED.DAP_TARGET_RUNNING, 0)
self._protocol.disconnect()

def has_swo(self):
Expand Down

0 comments on commit d532e45

Please sign in to comment.