Mercurial > lcfOS
comparison python/stlink.py @ 132:205578c96a79
Moved hexview to seperate class
author | Windel Bouwman |
---|---|
date | Sun, 20 Jan 2013 17:45:45 +0100 |
parents | 654093a9a1e3 |
children | 14e739ed03ab |
comparison
equal
deleted
inserted
replaced
131:04e45faafd1d | 132:205578c96a79 |
---|---|
78 # First initialization: | 78 # First initialization: |
79 if self.CurrentMode == DFU_MODE: | 79 if self.CurrentMode == DFU_MODE: |
80 self.exitDfuMode() | 80 self.exitDfuMode() |
81 if self.CurrentMode != DEBUG_MODE: | 81 if self.CurrentMode != DEBUG_MODE: |
82 self.enterSwdMode() | 82 self.enterSwdMode() |
83 self.reset() | 83 #self.reset() |
84 def close(self): | 84 def close(self): |
85 if self.IsOpen: | 85 if self.IsOpen: |
86 self.devHandle.close() | 86 self.devHandle.close() |
87 self.devHandle = None | 87 self.devHandle = None |
88 @property | 88 @property |
149 def StatusString(self): | 149 def StatusString(self): |
150 s = self.Status | 150 s = self.Status |
151 statii = {CORE_RUNNING: 'CORE RUNNING', CORE_HALTED: 'CORE HALTED'} | 151 statii = {CORE_RUNNING: 'CORE RUNNING', CORE_HALTED: 'CORE HALTED'} |
152 if s in statii: | 152 if s in statii: |
153 return statii[s] | 153 return statii[s] |
154 return 'Unknown status' | |
154 | 155 |
155 def reset(self): | 156 def reset(self): |
156 cmd = bytearray(16) | 157 cmd = bytearray(16) |
157 cmd[0:2] = DEBUG_COMMAND, DEBUG_RESETSYS | 158 cmd[0:2] = DEBUG_COMMAND, DEBUG_RESETSYS |
158 self.send_recv(cmd, 2) | 159 self.send_recv(cmd, 2) |
222 | 223 |
223 if __name__ == '__main__': | 224 if __name__ == '__main__': |
224 # Test program | 225 # Test program |
225 sl = STLink2() | 226 sl = STLink2() |
226 sl.open() | 227 sl.open() |
228 sl.reset() | |
227 print('version:', sl.Version) | 229 print('version:', sl.Version) |
228 print('mode before doing anything:', sl.CurrentModeString) | 230 print('mode before doing anything:', sl.CurrentModeString) |
229 if sl.CurrentMode == DFU_MODE: | 231 if sl.CurrentMode == DFU_MODE: |
230 sl.exitDfuMode() | 232 sl.exitDfuMode() |
231 sl.enterSwdMode() | 233 sl.enterSwdMode() |