updated i2c frame structure

doublebuf
Ondřej Hruška 6 years ago
parent 0d2d1fc926
commit 261aa66311
Signed by: MightyPork
GPG Key ID: 2C5FD5035250423D
  1. 2
      gex/units/I2C.py
  2. 18
      main.py

@ -42,7 +42,7 @@ class I2C(gex.Unit):
"""
pb = self._begin_i2c_pld(address, a10bit)
pb.u8(reg)
pb.u8(width*count) # we assume the device will auto-increment (most do)
pb.u16(width*count) # we assume the device will auto-increment (most do)
resp = self.query(0x03, pb.close())
fields = []

@ -61,18 +61,18 @@ if False:
for i in range(0,512):
j = i if i < 256 else 255-(i-256)
neo.load([0x660000+j, 0x3300FF-j, 0xFFFF00-(j<<8), 0x0000FF+(j<<8)-j])
time.sleep(.001)
time.sleep(.002)
neo.load([0,0,0,0])
if False:
i2c = gex.I2C(client, 'i2c')
i2c = gex.I2C(client, 'i2c')
# i2c.write(0x76, payload=[0xD0])
# print(i2c.read(0x76, count=1))
# i2c.write(0x76, payload=[0xD0])
# print(i2c.read(0x76, count=1))
print(i2c.read_reg(0x76, 0xD0))
print("%x" % i2c.read_reg(0x76, 0xF9, width=3, endian='big'))
print(i2c.read_reg(0x76, 0xD0))
print("%x" % i2c.read_reg(0x76, 0xF9, width=3, endian='big'))
i2c.write_reg(0x76, 0xF4, 0xFA)
print(i2c.read_reg(0x76, 0xF4))
i2c.write_reg(0x76, 0xF4, 0xFA)
print(i2c.read_reg(0x76, 0xF4))

Loading…
Cancel
Save