patches for new requirements of the ini write bulk read

doublebuf
Ondřej Hruška 7 years ago
parent 23c712848b
commit 5fb4392555
Signed by: MightyPork
GPG Key ID: 2C5FD5035250423D
  1. 5
      gex/Client.py
  2. 12
      main.py

@ -75,7 +75,10 @@ class Client:
if type(buffer) == str: if type(buffer) == str:
buffer = buffer.encode('utf-8') buffer = buffer.encode('utf-8')
self.bulk_write(cs=None, cmd=gex.MSG_INI_WRITE, bulk=buffer) pb = gex.PayloadBuilder()
pb.u32(len(buffer))
self.bulk_write(cs=None, pld=pb.close(), cmd=gex.MSG_INI_WRITE, bulk=buffer)
def ini_persist(self): def ini_persist(self):
""" Persist INI settings to Flash """ """ Persist INI settings to Flash """

@ -10,11 +10,14 @@ if False:
s = client.ini_read() s = client.ini_read()
client.ini_write(s) client.ini_write(s)
if False: if True:
buf = client.bulk_read(gex.MSG_INI_READ) buf = client.bulk_read(gex.MSG_INI_READ)
print(buf.decode('utf-8')) print(buf.decode('utf-8'))
client.bulk_write(gex.MSG_INI_WRITE, buf) pb = gex.PayloadBuilder()
pb.u32(len(buf))
client.bulk_write(gex.MSG_INI_WRITE, pld=pb.close(), bulk=buf)
if False: if False:
leds = gex.DOut(client, 'strip') leds = gex.DOut(client, 'strip')
@ -52,7 +55,7 @@ if False:
strip.write((b << 2) | ((~b) & 1)) strip.write((b << 2) | ((~b) & 1))
time.sleep(.02) time.sleep(.02)
if False: if True:
neo = gex.Neopixel(client, 'npx') neo = gex.Neopixel(client, 'npx')
print('We have %d neopixels.\n' % neo.get_len()) print('We have %d neopixels.\n' % neo.get_len())
@ -81,4 +84,5 @@ if False:
if True: if True:
spi = gex.SPI(client, 'spi') spi = gex.SPI(client, 'spi')
print(spi.query(0, [0xDE, 0xAD, 0xBE, 0xEF], rlen=4, rskip=1)) spi.multicast(1, [0xDE, 0xAD, 0xBE, 0xEF])
print(spi.query(0, [0xDE, 0xAD, 0xBE, 0xEF], rlen=4, rskip=1))#

Loading…
Cancel
Save