2023-11-06 08:42:06 +00:00
|
|
|
import serial
|
2023-11-06 06:53:10 +00:00
|
|
|
class Display:
|
2023-11-06 08:42:06 +00:00
|
|
|
def __init__(self, serial_port: str) -> None:
|
|
|
|
self.serial_adapter = serial.Serial(serial_port,baudrate=115200)
|
|
|
|
def set_page(self, page):
|
|
|
|
command = f'page {page}'.encode("ascii")
|
|
|
|
self.serial_adapter.write(command)
|
|
|
|
self.send_stop_bit()
|
|
|
|
def set_string(self, field, text):
|
|
|
|
command = f'{field}="{text}"'.encode("ascii")
|
|
|
|
self.serial_adapter.write(command)
|
2023-11-13 12:12:30 +00:00
|
|
|
self.send_stop_bit()
|
2023-11-06 08:42:06 +00:00
|
|
|
def send_stop_bit(self):
|
|
|
|
self.serial_adapter.write(0xFF)
|
|
|
|
self.serial_adapter.write(0xFF)
|
|
|
|
self.serial_adapter.write(0xFF)
|