Skip to content

Commit

Permalink
Add bias setting
Browse files Browse the repository at this point in the history
  • Loading branch information
mateusznowakdev committed May 28, 2024
1 parent 93ccb03 commit 8bd00c1
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion displayio_st7565.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@


_INIT_SEQUENCE = (
b"\xA3\x00" # LCD bias select
b"\xA3\x00" # LCD bias select (default 1/7)
b"\xA1\x00" # ADC select
b"\xC0\x00" # SHL select
b"\x40\x00" # Initial display line
Expand All @@ -45,6 +45,9 @@
b"\x81\x01\x00" # Set initial contrast
)

BIAS_7 = 0xA3
BIAS_9 = 0xA2


class ST7565(BusDisplay):
"""ST7565 and ST7567 display driver"""
Expand All @@ -63,8 +66,21 @@ def __init__(self, bus: FourWire, **kwargs) -> None:
pixels_in_byte_share_row=False,
)

self._bias = 0
self._contrast = 0

@property
def bias(self) -> int:

Check failure on line 73 in displayio_st7565.py

View workflow job for this annotation

GitHub Actions / test

Missing function or method docstring
return self._bias

@bias.setter
def bias(self, bias: int) -> None:
if bias not in (BIAS_7, BIAS_9):
raise ValueError("bias setting must be either displayio_st7565.BIAS_7 or displayio_st7565.BIAS_9")

self._bias = bias
self.bus.send(self._bias)

@property
def contrast(self) -> int:
return self._contrast
Expand Down

0 comments on commit 8bd00c1

Please sign in to comment.