def __init__(self): """Serial Setup""" self.ser = None self.s_t = Serial_Tools(self.ser) self.s_t.show_messages = False self.state = self.s_find_device self.trace_size = 1024 self.extra_trace = 4 self.whole_trace = self.trace_size + self.extra_trace self.dump_size = self.trace_size self.extra_dump = self.extra_trace self.whole_dump = self.dump_size + self.extra_dump """Data exposed through API""" self.data = { "device": { "connected": False, "model": None }, "accepted_models": ["BS0005", "BS0010"], "trace": [] } self.a_d, self.b_d = [], []
def __init__(self, ser): self.ser = ser self.st = Serial_Tools(self.ser) """ Dict of all the BS's state. This way, if it disconnects, we know exactly how to set it up. This is assuming the BS was setup entirely through this... """ self.registers = {}
def __init__(self): """Serial Setup""" self.ready = False self.trace_state=0 self.ser = None self.s_t = Serial_Tools(self.ser) self.s_t.show_messages = False self.state = self.s_find_device self.trace_size = 1024 # Samples self.extra_trace = 4 self.whole_trace = self.trace_size + self.extra_trace self.dump_size = self.trace_size self.extra_dump = self.extra_trace self.whole_dump = self.dump_size + self.extra_dump self.write_buffer = "" self.buffer_size = 3 * 4096 """Data exposed through API""" self.data = { "device":{"connected":False, "model":None}, "accepted_models":["BS0005", "BS0010"], "ch":{"active":{}}, "trigger_level":32000, "trigger_display":0, "range_data":{"top":32000, "bot":0}, "range":{"min":-5.8, "max":5.8, "high":4.0, "low":-1.0, "offset":1.5, "span":5.0}, "timebase":{"min":15, "max":535, "value":40, "display":""}, "current_channel":"a", "waveform":0, "symetry":32768, "symetry_percentage":50, "frequency":1, "on_time":0, "off_time":0 } self.data['ch']['active'] = { "trace":[], "display_trace":[] } self.data['spock_option'] = [0,0,0,0,0,0,0,0] # This is BEian (7 -> 0) self.active = self.data['ch']['active'] self.device = self.data['device'] self.compute_times() self.ticks_to_timebase()
def __init__(self): """Serial Setup""" self.ser = None self.s_t = Serial_Tools(self.ser) self.s_t.show_messages = False self.state = self.s_find_device """Data exposed through API""" self.data = { "device": { "connected": False, "model": None }, "accepted_models": ["BS0005", "BS0010"] }
def __init__(self): """ Serial """ self.ser = None self.s_t = Serial_Tools(self.ser) self.s_t.show_messages = False """ Trace and dump settings """ self.trace_size = 512 # Size in samples (2 bytes) self.extra_trace = 16 self.whole_trace = self.trace_size + self.extra_trace self.dump_compression = 16 # The BitScope will compress 16 samples to 1 self.dump_size = (self.trace_size / self.dump_compression) * 2 # Size in bytes self.extra_dump = (self.extra_trace / self.dump_compression) * 2 self.whole_dump = (self.whole_trace / self.dump_compression) * 2 """ API Data """ self.data = { "device": { "connected": False, "model": None }, "accepted_models": ["BS0005", "BS0010"], "dump": [], "voltage": 0.0, "voltage_text": "", "dump_ready": False, "channel": "a", "ch_a_zero": 0.0, "ch_b_zero": 0.0, } self.data['ranges'] = { "BS0005": (-5.28, 8.11), # <1% error "BS0010": (-4.84, 10.8) # Not sure on this one! } self.command = "" self.state = self.s_find_device self.range_in_use = None
def __init__(self, name, cfg): self.name = name self.cfg = cfg self.mode_cfg = cfg['modes'][name] """Serial Setup""" self.ser = None self.s_t = Serial_Tools(self.ser) self.s_t.show_messages = False self.command = "" self.state = self.s_find_device self.position = 0 self.max = 10000000 """Data exposed through API""" self.data = { "device":{"connected":False, "model":None}, "accepted_models":["BS0005", "BS0010"], "status":"stopped", "streaming":False, "stream_mode":0, # Analogue A, or logic "trace":[], "ba":bytearray(1024*1024*10), "ba":bytearray(100000), "ba_pos":0, "ba_range":1000, "data_ready":False, "deep_scan":False, "range_high":200000, "range_low":100, "ba_zoom":(0,0), "frequency":100, # khz "interval":0, # us "file_mode":0 } self.data['ba_zoom'] = (0, len(self.data['ba'])) self.data['interval'] = int(freq_to_ns(self.data['frequency']) / 1000)
def __init__(self): """Serial Setup""" self.ser = None self.s_t = Serial_Tools(self.ser) self.s_t.show_messages = False self.state = self.s_find_device self.buffer_size = 12288 self.trace_size = 12000 self.trace_received = 0 self.trace_intro = 16 self.trace_outro = self.trace_size self.command = "" """Data exposed through API""" self.data = { "device":{"connected":False, "model":None}, "accepted_models":["BS0005", "BS0010"], "status":"stopped", "ba":bytearray(), "ba_pos":0, "ba_range":1000, "ba_zoom":(0,1000), "range_high":20000, "range_low":100, "deep_scan":False, "data_ready":False, "trigger_byte":0, "mask_byte":255, # Any bit marked as ? will be a "don't care" bit "trigger":[2,2,2,2,2,2,2,2], "rate":5000, # kHz (up to 5mHz on tmLogic) "running":False }
def __init__(self): """Serial and other""" self.model = "" self.device_connected = False self.ser = None self.s_t = Serial_Tools(self.ser) # Tool to help issuing without waiting. self.s_t.show_messages = False scom = Scope_Commander(self.ser) """TRACE AND DUMP SETTINGS""" self.trace_size = 512 # Captured trace size in samples. self.extra_trace = 16 # ADC warmup junk self.whole_trace = self.trace_size + self.extra_trace self.d_dec = 16 self.d_size = (self.trace_size / self.d_dec) * 2 # Dump size in bytes self.ex_size = (self.extra_trace / self.d_dec) * 2 # Extra samples for ADC warmup in bytes self.whole_dump = ((self.trace_size + self.extra_trace) / self.d_dec) * 2 self.div = float(self.d_size) """ STATE. IT'S HERE """ self.state = self.s_find_device self.data = {} self.data['ranges'] = { "BS0005":(-5.28, 8.11), # <1% error "BS0010":(-4.84, 10.8) # Not sure on this one! } """ Measurement data """ self.data['ch'] = {} self.data['ch']['a'] = { 'raw_avg': 0, 'clip': {'top':False, 'bot':False}, 'ana': 0.0, 'display': 0.0, 'ready': {'data':False, 'display':False}, 'ena': False, 'was_ena': False, 'text_out': "" } """ Mult """ self.data['mult'] = {'values':[1,2,5,10]} self.data['ch']['a']['mult_index'] = 0 """ Logic """ self.data['logic'] = { 'step': 0.100, 'rounding': 3, 'min': -6.000, 'max': 6.000 } self.data['ch']['a']['logic'] = {'top':1.5,'bot':0.0,'ena':False,'val':0} """ OTHER """ self.data['ch']['a']['zero'] = 0.00 self.data['diff'] = { 'ena': False, 'zero':0.00, 'display':0.00, 'text_out':"" } self.data['frame_toggle'] = 0 """ Interpolation for Enhanced """ self.data['enhanced'] = { 'ena': False, 'frame': {'count': 0, 'max': 24} } self.data['ch']['a']['interp'] = { 'queue': [0,0,0,0,0,0,0,0,0], 'value': 0.0 } self.data['device'] = { 'model':None, 'connected':False } self.data['mode'] = { 'single':True, 'dual':False, 'diff':False, 'logic':False } self.data['ch']['b'] = {} copy_dict(self.data['ch']['a'], self.data['ch']['b']) self.ch = self.data['ch'] self.a = self.data['ch']['a'] self.b = self.data['ch']['b'] self.diff = self.data['diff'] # Start the engine.... In the key of a. self.force_ch('a', True) self.range_in_use = self.data['ranges']['BS0005']
def __init__(self): self.ser = None self.s_t = Serial_Tools(self.ser) self.s_t.show_messages = False self.state = self.s_find_device self.trace_size = 1024 #captured trace size in samples. self.extra_trace = 16 #ADC warmup junk self.whole_trace = self.trace_size + self.extra_trace self.d_size = self.trace_size * 2 #dump size in bytes self.ex_size = self.extra_trace * 2 #extra samples for ADC warmup in bytes self.whole_dump = (self.trace_size + self.extra_trace) * 2 self.data = { "device":{"model":None, "connected":False, "tested":False, "pass":False, "connected_not_tested":False}, "test":{"status":"connect", "op_count":1}, "ch":{"a":{}, "b":{}}, "mask_height":5000, "masks":{ #Lists of tuples containing mask ranges. "comp":[(123,190)] }, "cal_points":{ "comp":{ "shape":[50,205,250], "top":range(191,212) } }, "mode":"pre_test", "sample_offset":{ "comp":35, "adc":125, "logic":70 }, } self.data['ranges'] = {} self.data['ranges']['BS0005'] = { 1.1 : "[64]@[56]sn[7e]sn[77]sn[82]s", 3.5 : "[64]@[c3]sn[6a]sn[a3]sn[95]s", 5.2 : "[64]@[68]sn[44]sn[ff]sn[8a]s", 11 : "[64]@[6a]sn[12]sn[8c]sn[ba]s", "better_11" : "[64]@[6f]sn[14]sn[8c]sn[ba]s", "max" : "[64]@[00]sn[00]sn[ff]sn[ff]s" } self.data['ranges']['BS0010'] = { 0.520: "[64]@[40]sn[65]sn[82]sn[6c]s", 1.1 : "[64]@[14]sn[61]sn[6f]sn[70]s", 3.5 : "[64]@[5c]sn[50]sn[3a]sn[81]s", 5.2 : "[64]@[9d]sn[44]sn[38]sn[8d]s", 11 : "[64]@[28]sn[1c]sn[c1]sn[b5]s", "max" : "[64]@[00]sn[00]sn[ff]sn[ff]s" } self.data['range'] = 11 self.data['templates'] = { "comp":([19792] * 119) + ([480] * 152) + ([19762] * 151) } self.data['results'] = { "comp" : False, "adc" : False, "logic": False, "test" : False } self.data['ch']['a'] = { "trace":[], "display_trace":[], "ena":False, "zero": {16:10131, 8:162}, "sos": 0, "sos_string":"", "errors":{"shape":0, "top":0}, "pass":{"comp":False, "adc":False}, "limits":{"comp":30, "adc":100}, "queue":[0]*5, "result":0, "ready":False, "frame_count":0, "ready_on_frame":5 } # Clone ch a to ch b self.data['ch']['b'] = {} copy_dict(self.data['ch']['a'], self.data['ch']['b']) # Aliases self.ch = self.data['ch'] self.a = self.ch['a'] self.b = self.ch['b'] self.dev = self.data['device'] self.test = self.data['test']