kopia lustrzana https://github.com/micropython/micropython
drivers/display/lcd160cr: Fix bugs with lcd.get_pixel().
Fixes issues #2880 and #2881.pull/2399/merge
rodzic
8c5988bf61
commit
b0a6dda115
|
@ -243,13 +243,13 @@ class LCD160CR:
|
||||||
self._fcmd2b('<BBBBH', 0x41, x, y, c)
|
self._fcmd2b('<BBBBH', 0x41, x, y, c)
|
||||||
|
|
||||||
def get_pixel(self, x, y):
|
def get_pixel(self, x, y):
|
||||||
self._fcmd2b('<BBBB', 0x61, x, y)
|
self._fcmd2('<BBBB', 0x61, x, y)
|
||||||
t = 1000
|
t = 1000
|
||||||
while t:
|
while t:
|
||||||
self.i2c.readfrom_into(self.i2c_addr, self.buf1)
|
self.i2c.readfrom_into(self.i2c_addr, self.buf1)
|
||||||
if self.buf1[0] >= 2:
|
if self.buf1[0] >= 2:
|
||||||
self.i2c.readfrom_into(self.i2c_addr, self.buf[3])
|
self.i2c.readfrom_into(self.i2c_addr, self.buf[3])
|
||||||
return self.buf[3][1] + self.buf[3][2] << 8
|
return self.buf[3][1] | self.buf[3][2] << 8
|
||||||
t -= 1
|
t -= 1
|
||||||
sleep_ms(1)
|
sleep_ms(1)
|
||||||
raise OSError(uerrno.ETIMEDOUT)
|
raise OSError(uerrno.ETIMEDOUT)
|
||||||
|
|
Ładowanie…
Reference in New Issue