stuff
This commit is contained in:
parent
b0b4012973
commit
6e3bb75aeb
4 changed files with 47 additions and 8 deletions
21
display.py
21
display.py
|
|
@ -1,18 +1,23 @@
|
|||
import asyncio
|
||||
from LCD import LCD
|
||||
|
||||
class display:
|
||||
def __init__(self, width=16, height=4, i2c_addr=0x27):
|
||||
async def __init__(self, width=20, height=4, i2c_addr=0x27):
|
||||
self.width = width
|
||||
self.height = height
|
||||
self.device = LCD(2, i2c_addr, True)
|
||||
self.contents = [""] * self.height
|
||||
|
||||
def redraw(self):
|
||||
for row, line in enumerate(self.contents):
|
||||
self.device.message(row + 1, line)
|
||||
async def redraw(self, row = None):
|
||||
if row == None:
|
||||
for row, line in enumerate(self.contents):
|
||||
await self.device.async_message(row + 1, line)
|
||||
else:
|
||||
await self.device.async_message(row + 1, line)
|
||||
|
||||
def read(self):
|
||||
pass
|
||||
async def read(self, row):
|
||||
return self.contents[row]
|
||||
|
||||
def write(self):
|
||||
pass
|
||||
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)
|
||||
Loading…
Add table
Add a link
Reference in a new issue