218
edits
As of August 2020 the site you are on (wiki.newae.com) is deprecated, and content is now at rtfm.newae.com. |
Changes
no edit summary
The CW tools scan these directories looking for classes that inherits from the ''Plugin'' class in each public file (that don't beggins with "_").
These folders usually have a file called ''base.py '' or ''_base.py '' that contains the base class to all modules in these directories. Ex.:
<pre>
</pre>
=Adding parametersParameters=
<pre>
from chipwhisperer.common.utils.parameter import Parameter
</pre>
The easiest way to add parameters to your class, is to make it ''Parameterized '' (extending this class). It is an abstract class that declares a public interface and implements two manipulation methods to create/get the Parameters parameters and find it. As a general rule, you just need to: * import the ''Parameterized '' class: from chipwhisperer.common.utils.parameter import Parameterized* make your class extend it(no construtor call is needed here since the idea is to use it as an interface to avoid the problems with multiple inheritance - i.e.: the diamont one)
* define a _name and a _description
* register it if it is not readily accessible through a higher parameter hierarchy: self.getParams().register()
* and call self.getParams().addChildren([...])
The method getParams() whild do four method does three things: create a new Parameter if it doesn't exist; create a group called _name; create a child description parameter with the specified _descriptionlabel; and return a reference to the parent group parameter. Search in the parameters can be is performed using the findParam([fullpath]) method.
Each parameter stores the data internally or externally using a set/get (usefull to retrieve dynamic data). In this case, the @setupSetParam(nameOrPath) decorator should be used in the set method in order to syncronize the GUI when the parameter value changes.
{'name':'Symbol', 'type':'list', 'values':['o', 's', 't', 'd', '+'], 'value':'o'}, # With value saved internally
])
self.findParam("Symbol").setValue('t')
s = self.findParam("Symbol").getValue() # s = 't'
def getEnabled(self):