Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions adafruit_ssd1305.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ def __init__(
height: int,
*,
external_vcc: bool,
reset: Optional[DigitalInOut]
reset: Optional[DigitalInOut],
col: Optional[int] = None # Shortened argument name
):
super().__init__(buffer, width, height)
self.width = width
Expand All @@ -98,9 +99,10 @@ def __init__(
if self.reset_pin:
self.reset_pin.switch_to_output(value=False)
self.pages = self.height // 8
self._column_offset = 0
if self.height == 32:
self._column_offset = 4 # hardcoded for now...

# Set default column offset, allow override
self._column_offset = col if col is not None else 4

# Note the subclass must initialize self.framebuf to a framebuffer.
# This is necessary because the underlying data buffer is different
# between I2C and SPI implementations (I2C needs an extra byte).
Expand Down Expand Up @@ -220,7 +222,8 @@ def __init__(
*,
addr: int = 0x3C,
external_vcc: bool = False,
reset: Optional[DigitalInOut] = None
reset: Optional[DigitalInOut] = None,
col=None
):
self.i2c_device = i2c_device.I2CDevice(i2c, addr)
self.addr = addr
Expand All @@ -238,6 +241,7 @@ def __init__(
height,
external_vcc=external_vcc,
reset=reset,
col=col, # <-- Forwarded col parameter to base class
)

def write_cmd(self, cmd: int) -> None:
Expand Down Expand Up @@ -281,7 +285,8 @@ def __init__(
external_vcc: bool = False,
baudrate: int = 8000000,
polarity: int = 0,
phase: int = 0
phase: int = 0,
col=None
):
self.rate = 10 * 1024 * 1024
dc.switch_to_output(value=False)
Expand All @@ -296,6 +301,7 @@ def __init__(
height,
external_vcc=external_vcc,
reset=reset,
col=col,
)

def write_cmd(self, cmd: int) -> None:
Expand Down