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:
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):
""" Persist INI settings to Flash """

@ -10,11 +10,14 @@ if False:
s = client.ini_read()
client.ini_write(s)
if False:
if True:
buf = client.bulk_read(gex.MSG_INI_READ)
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:
leds = gex.DOut(client, 'strip')
@ -52,7 +55,7 @@ if False:
strip.write((b << 2) | ((~b) & 1))
time.sleep(.02)
if False:
if True:
neo = gex.Neopixel(client, 'npx')
print('We have %d neopixels.\n' % neo.get_len())
@ -81,4 +84,5 @@ if False:
if True:
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