16 lines
616 B
Python
16 lines
616 B
Python
import serial
|
|
class Display:
|
|
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)
|
|
self.send_stop_bit()
|
|
def send_stop_bit(self):
|
|
self.serial_adapter.write(0xFF)
|
|
self.serial_adapter.write(0xFF)
|
|
self.serial_adapter.write(0xFF) |