Esempio n. 1
0
    def gexLoad(self):
        self.editor.setPlainText("")
        self.editor.repaint()

        client = gex.Client(self.xferLambda(), load_units=False)
        read_ini = client.ini_read(self.filenum)
        client.close()

        self.editor.setPlainText(read_ini)
        self.highlight.rehighlight()
        self.setWindowTitle('GEX config file editor')
Esempio n. 2
0
    def gexSync(self):
        new_txt = self.editor.toPlainText()
        self.editor.setPlainText("")
        self.editor.repaint()

        client = gex.Client(self.xferLambda(), load_units=False)
        client.ini_write(new_txt)
        read_ini = client.ini_read(self.filenum)
        client.close()

        self.editor.setPlainText(read_ini)
        self.highlight.rehighlight()
        self.setWindowTitle('*GEX config file editor')
Esempio n. 3
0
    def __init__(self):
        self.phase = PH_BREAK_OVER
        self.work_s = 0
        self.break_s = 0
        self.color = 0x000000
        self.colors = [0x000000 for _ in range(0, LIGHT_CNT)]

        self.client = gex.Client(gex.TrxRawUSB())
        self.btn = gex.DIn(self.client, 'btn')
        self.neo = gex.Neopixel(self.client, 'neo')
        self.btn.on_trigger([0], self.on_btn)

        self.switch(PH_BREAK_OVER)
        self.display()
Esempio n. 4
0
import time

import gex

# sipo example

with gex.Client(gex.TrxRawUSB()) as client:
    sipo = gex.SIPO(client, 'sipo')
    d4 = gex.DOut(client, 'd4')

    # Jort the lights
    sipo.load([
        [0x0a, 0x0f],
        [0xF8, 0xFC],
        [0x00, 0x00],
        [0x02, 0x00],
    ],
              end=0x04)

    d4.write(1)
    # sipo.set_data(0x04)
    # sipo.store()
Esempio n. 5
0
#!/bin/env python3
import time

import gex

# with gex.Client(gex.TrxRawUSB()) as client:
with gex.DongleAdapter(gex.TrxRawUSB(remote=True), 0x10) as transport:
    client = gex.Client(transport)
    print(client.ini_read(0))
Esempio n. 6
0
 def gexPersist(self):
     client = gex.Client(self.xferLambda(), load_units=False)
     client.ini_persist()
     client.close()
     self.setWindowTitle('GEX config file editor')
Esempio n. 7
0
        self.write_word(0x4000 | (word & 0x0003FFF))
        self.write_word(0x4000 | (word & 0xFFFC000) >> 14)

    def wfm_dc(self):
        self.write_word(0x2100)
        self.write_word(0x2000)
        self.set_frequency(0)

    def wfm_sine(self, freq=None):
        self.write_word(0x2000)
        if freq is not None:
            self.set_frequency(freq)


#with gex.Client(gex.TrxRawUSB()) as client:
with gex.Client(gex.TrxSerialThread('/dev/ttyACM0')) as client:
    # ===============================================

    # Delay between adjusting input and starting the measurement.
    # Should be several multiples of the time constant
    settling_time_s = (4700 * 100e-9) * 10

    # max change in DB between samples to detect faulty measurements that need to be repeated
    max_allowed_shift_db = 5
    # db shift compensation (spread through the frequency sweep to adjust for different slopes)
    allowed_shift_compensation = -4.5

    # Frequency sweep parameters
    f_0 = 5
    f_1 = 6000
Esempio n. 8
0
#!/bin/env python3
import time

import numpy as np
from matplotlib import pyplot as plt

import gex

transport = gex.TrxRawUSB(sn='0029002F-42365711-32353530')
#transport = gex.TrxSerialSync(port='/dev/ttyACM0')

with gex.Client(transport) as client:
    #
    # if True:
    #     s = client.ini_read()
    #     print(s)
    #     client.ini_write(s)

    if True:
        sipo = gex.SIPO(client, 'sipo')
        sipo.load([[0xA5], [0xFF]])

    if False:
        adc = gex.ADC(client, 'adc')
        print("Enabled channels:", adc.get_channels())

        adc.set_smoothing_factor(0.9)

        while True:
            raw = adc.read_raw()
            smooth = adc.read_smooth()