init
This commit is contained in:
64
HighLevelAnalyzer.py
Normal file
64
HighLevelAnalyzer.py
Normal file
@@ -0,0 +1,64 @@
|
||||
# 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, NumberSetting, StringSetting, 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.
|
||||
my_string_setting = StringSetting()
|
||||
# my_number_setting = NumberSetting(min_value=0, max_value=100)
|
||||
my_choices_setting = ChoicesSetting(choices=('A', 'B'))
|
||||
|
||||
# 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_choices_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.
|
||||
'''
|
||||
if frame.data['data'] >> 24 == 58:
|
||||
command = "write command"
|
||||
else:
|
||||
command = "unknown"
|
||||
# data = frame.data['data'] >> 24
|
||||
blue = frame.data['data'] >> 16 & 0xFF
|
||||
red = frame.data['data'] >> 8 & 0xFF
|
||||
green = frame.data['data'] & 0xFF
|
||||
|
||||
# = frame.data['ledData']
|
||||
# bytes[1] = frame.data['ledData'] >> 16 & 0xFF
|
||||
# bytes[2] = frame.data['ledData'] >> 8 & 0xFF
|
||||
# bytes[3] = frame.data['ledData'] & 0xFF
|
||||
|
||||
# print(frame)
|
||||
# print("Hallo Welt")
|
||||
# print(frame)
|
||||
# print(frame)
|
||||
# print(frame)
|
||||
# print(frame.data[''])
|
||||
# Return the data frame itself
|
||||
return AnalyzerFrame('LED', frame.start_time, frame.end_time, {
|
||||
'input_type': frame.type,
|
||||
'command': command,
|
||||
"blue": blue,
|
||||
"red": red,
|
||||
"green": green,
|
||||
})
|
||||
13
extension.json
Normal file
13
extension.json
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"name": "TLE59731HLA",
|
||||
"apiVersion": "1.0.0",
|
||||
"author": "Johannes Paehr",
|
||||
"version": "0.0.1",
|
||||
"description": "",
|
||||
"extensions": {
|
||||
"TLE59731HLA": {
|
||||
"type": "HighLevelAnalyzer",
|
||||
"entryPoint": "HighLevelAnalyzer.Hla"
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user