-
Notifications
You must be signed in to change notification settings - Fork 0
/
HighLevelAnalyzer.py
44 lines (33 loc) · 1.56 KB
/
HighLevelAnalyzer.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# High Level Analyzer
# For more information and documentation, please go to https://support.saleae.com/extensions/high-level-analyzer-extensions
from saleae.analyzers import HighLevelAnalyzer, AnalyzerFrame, StringSetting, NumberSetting, ChoicesSetting
# High level analyzers must subclass the HighLevelAnalyzer class.
class Hla(HighLevelAnalyzer):
# List of settings that a user can set for this High Level Analyzer.
device_address = StringSetting()
my_number_setting = NumberSetting(min_value=0, max_value=100)
my_choices_setting = ChoicesSetting(choices=('A', 'B'))
# internal variables
_device_address_number = 0
# An optional list of types this analyzer produces, providing a way to customize the way frames are displayed in Logic 2.
result_types = {
'mytype': {
'format': 'Output type: {{type}}, Input type: {{data.input_type}}'
}
}
def __init__(self):
"""
Initialize HLA.
Settings can be accessed using the same name used above.
"""
print("Settings:", self.my_string_setting,
self.my_number_setting, self.my_choices_setting)
def decode(self, frame: AnalyzerFrame):
"""
Process a frame from the input analyzer, and optionally return a single `AnalyzerFrame` or a list of `AnalyzerFrame`s.
The type and data values in `frame` will depend on the input analyzer.
"""
# Return the data frame itself
return AnalyzerFrame('mytype', frame.start_time, frame.end_time, {
'input_type': frame.type
})