Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def setScope(self, driver):
self._scope = driver
util.active_scope = self._scope
self.signals.scopeChanged.emit()
def updateTable(self):
self.dock.show()
tm = CWCoreAPI.getInstance().project().traceManager()
tend = tm.numTraces()
self.tablewid.setRowCount(tend)
for tnum in range(0,tend):
tin = tm.getTextin(tnum)
tout = tm.getTextout(tnum)
k = tm.getKnownKey(tnum)
self.tablewid.setItem(tnum, 0, QTableWidgetItem(util.list2hexstr(tin)))
self.tablewid.setItem(tnum, 1, QTableWidgetItem(util.list2hexstr(tout)))
self.tablewid.setItem(tnum, 2, QTableWidgetItem(util.list2hexstr(k)))
'help':"Draw Type Help"},
{'name':'CW Firmware Preferences','tip':'Configure ChipWhisperer FW Paths', 'type':"menu",
"action":lambda _:self.getFwLoaderConfigGUI.show()},
# "default" means set() is NOT called during init, otherwise set WILL be called to set the default value (read from get()). Can be useful when don't want to read hardware at start-up
{'name':'SAD Threshold', 'type':'int', 'limits':(0, 100000), 'default':0, 'set':self.setThreshold, 'get':self.getThreshold}
{'name':'Acquisition Settings', 'type':'group', 'children':[
{'name':'Number of Traces', 'type':'int', 'limits':(1, 1E9), 'get':self.getNumTraces, 'set':self.setNumTraces, 'linked':['Traces per Set']},
{'name':'Number of Sets', 'type':'int', 'limits':(1, 1E6), 'get':self.getNumTraceSets, 'set':self.setNumTraceSets, 'linked':['Traces per Set'], 'tip': 'Break acquisition into N sets, '
'which may cause data to be saved more frequently. The default capture driver requires that NTraces/NSets is small enough to avoid running out of system memory '
'as each segment is buffered into RAM before being written to disk.'},
{'name':'Traces per Set', 'type':'int', 'readonly':True, 'get':self.tracesPerSet},
]}
])
"""
sigParametersChanged = util.Signal()
registeredParameters = {}
scriptingOutput = sys.stdout
supportedTypes = ["group", "list", "label", "str", 'text', "bool", "action", "int", "float", "rangegraph", "file",
'filelist', "range", "color", "menu"]
suppertedAttributes = {"name", "key", "type", "values", "value", "set", "get", "limits", "step", "linked",
"default", "tip", "action", "visible", "children", "readonly", "graphwidget"}
usePyQtGraph = False
def __init__(self, parent=None, ignoreChildren=False, **opts):
self.sigValueChanged = util.Signal()
self.sigLimitsChanged = util.Signal()
self.sigOptionsChanged = util.Signal()
self.sigChildAdded = util.Signal()
self.sigChildRemoved = util.Signal()
self.previousValue = None
def __init__(self):
self.connectStatus = util.Observable(False)
self.dataUpdated = util.Signal()
self.datapoints = []
self.getParams().register()
def configObjChanged(self, key):
self.dirty.setValue(True)
def isUntitled(self):
return self.filename == Project.untitledFileName
def trace_manager(self):
""" Gets the trace manager for the project
Returns:
The trace manager for the project
"""
return self._traceManager
traceManager = util.camel_case_deprecated(trace_manager)
def setProgramName(self, name):
self.settingsDict['Program Name']=name
def setProgramVersion(self, ver):
self.settingsDict['Program Version']=ver
def setAuthor(self, author):
self.settingsDict['Project Author']=author
def setProjectName(self, name):
self.settingsDict['Project Name']=name
def setFileVersion(self, ver):
self.settingsDict['Project File Version']=ver
data = self.oa.sendMessage(CODE_READ, sadcfgaddr, maxResp=4)
data[0] = 0x02
self.oa.sendMessage(CODE_WRITE, sadcfgaddr, data, Validate=False)
data[0] = 0x00
self.oa.sendMessage(CODE_WRITE, sadcfgaddr, data, Validate=False)
def check_status(self):
""" Check if the SAD module is running & outputting valid data """
data = self.oa.sendMessage(CODE_READ, sadcfgaddr, maxResp=4)
if not (data[0] & self.STATUS_RUNNING_MASK):
return False
else:
return True
checkStatus = util.camel_case_deprecated(check_status)
def getThreshold(self):
""" Get the threshold. When the SAD output falls below this threshold the system triggers """
data = self.oa.sendMessage(CODE_READ, sadcfgaddr, maxResp=4)
threshold = data[1]
threshold |= data[2] << 8
threshold |= data[3] << 16
return threshold
def setThreshold(self, threshold):
""" Set the threshold. When the SAD output falls below this threshold the system triggers """
if (threshold > 100000) or (threshold < 0):
raise ValueError("Invalid threshold {}. Must be in range (0, 100000)".format(threshold))
data = self.oa.sendMessage(CODE_READ, sadcfgaddr, maxResp=4)
def _dis(self):
if self.scopetype is not None:
self.scopetype.dis()
if self.advancedSettings is not None:
self.advancedSettings.getParams().remove()
self.advancedSettings = None
util.chipwhisperer_extra = None
if self.advancedSAD is not None:
self.advancedSAD.getParams().remove()
self.advancedSAD = None
if self.digitalPattern is not None:
self.digitalPattern.getParams().remove()
self.digitalPattern = None
# TODO Fix this hack
if hasattr(self.scopetype, "ser") and hasattr(self.scopetype.ser, "_usbdev"):
self.qtadc.sc.usbcon = None
return True