stuff
This commit is contained in:
parent
5a7cc1422d
commit
259f59c0e5
2 changed files with 7 additions and 7 deletions
10
display.py
10
display.py
|
|
@ -8,16 +8,16 @@ class display:
|
|||
self.device = LCD(2, i2c_addr, True)
|
||||
self.contents = [""] * self.height
|
||||
|
||||
def redraw(self, row = None):
|
||||
async def redraw(self, row = None):
|
||||
if row == None:
|
||||
for row, line in enumerate(self.contents):
|
||||
self.device.async_message(row + 1, line)
|
||||
await self.device.async_message(row + 1, line)
|
||||
else:
|
||||
self.device.async_message(row + 1, self.contents[row])
|
||||
await self.device.async_message(row + 1, self.contents[row])
|
||||
|
||||
def read(self, row):
|
||||
async def read(self, row):
|
||||
return self.contents[row]
|
||||
|
||||
def write(self, row, data, offset = 0):
|
||||
async def write(self, row, data, offset = 0):
|
||||
self.contents[row] = f'{self.contents[row][:offset]}{data}{self.contents[row][offset+len(data):]}'
|
||||
self.redraw(row)
|
||||
|
|
@ -6,8 +6,8 @@ from display import display
|
|||
|
||||
def wheel_handler(dir):
|
||||
print(f"wheel: {dir}")
|
||||
disp.write(1, f"wheel: {dir}")
|
||||
disp.redraw()
|
||||
loop = asyncio.get_event_loop()
|
||||
loop.create_task(disp.write(1, f"wheel: {dir}"))
|
||||
|
||||
def button_test(*args):
|
||||
print(args)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue