sipo fixes and demo

doublebuf
Ondřej Hruška 7 years ago
parent 7069a3ff81
commit 1a6d45cc1c
Signed by: MightyPork
GPG Key ID: 2C5FD5035250423D
  1. 4
      gex/Client.py
  2. 4
      gex/units/SIPO.py
  3. 19
      omicron_mb_test.py

@ -96,6 +96,7 @@ class Client:
self.unit_lu = {} self.unit_lu = {}
callsigns = []
for n in range(0,count): for n in range(0,count):
cs = pp.u8() cs = pp.u8()
name = pp.str() name = pp.str()
@ -106,6 +107,9 @@ class Client:
'callsign': cs, 'callsign': cs,
'type': type, 'type': type,
} }
if cs in callsigns:
raise Exception("Duplicate callsign! Wrong GEX config!")
callsigns.append(cs)
def ini_read(self) -> str: def ini_read(self) -> str:
""" Read the settings INI file """ """ Read the settings INI file """

@ -16,12 +16,14 @@ class SIPO(gex.Unit):
def _type(self): def _type(self):
return 'SIPO' return 'SIPO'
def load(self, buffers, confirm=True): def load(self, buffers, end=0x0000, confirm=True):
""" Load data - buffers is a list of lists or byte arrays """ """ Load data - buffers is a list of lists or byte arrays """
if type(buffers[0]) == int: if type(buffers[0]) == int:
buffers = [buffers] buffers = [buffers]
pb = gex.PayloadBuilder() pb = gex.PayloadBuilder()
pb.u16(end)
for b in buffers: for b in buffers:
pb.blob(b) pb.blob(b)

@ -0,0 +1,19 @@
import time
import gex
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()
Loading…
Cancel
Save