Skip to content

Commit 1837b47

Browse files
authored
Merge pull request #8 from lesamouraipourpre/vertical-scroll
Remove usage of the set_vertical_scroll Display constructor parameter.
2 parents 980127d + 256a876 commit 1837b47

File tree

2 files changed

+23
-21
lines changed

2 files changed

+23
-21
lines changed

README.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,19 @@ Introduction
1717
:target: https://github.com/psf/black
1818
:alt: Code Style: Black
1919

20-
DisplayIO driver for SH1107 monochrome displays. DisplayIO drivers enable terminal output. This driver depends on a future (TBD) quirk added to DisplayIO.
20+
DisplayIO driver for SH1107 monochrome displays. DisplayIO drivers enable terminal output.
2121

2222

2323
Dependencies
2424
=============
2525
This driver depends on:
2626

2727
* `Adafruit CircuitPython Version 6+ <https://github.com/adafruit/circuitpython>`_ A new quirk in 6.0 for SH1107
28-
* Adafruit SH1107 128 x 64 OLED display, used for testing.
28+
* An SH1107 OLED display, eg. `Adafruit FeatherWing 128 x 64 OLED <https://www.adafruit.com/product/4650>`_
2929

3030
Please ensure all dependencies are available on the CircuitPython filesystem.
31-
This is easily achieved by downloading
32-
`the Adafruit library and driver bundle <https://circuitpython.org/libraries>`_.
31+
This is easily achieved by downloading the
32+
`Adafruit library and driver bundle <https://circuitpython.org/libraries>`_.
3333

3434
Installing from PyPI
3535
=====================

adafruit_displayio_sh1107.py

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
2222
**Software and Dependencies:**
2323
24-
* Adafruit CircuitPython (version 5+) firmware for the supported boards:
24+
* Adafruit CircuitPython (version 6+) firmware for the supported boards:
2525
https://github.com/adafruit/circuitpython/releases
2626
2727
"""
@@ -37,13 +37,14 @@
3737
DISPLAY_OFFSET_ADAFRUIT_FEATHERWING_OLED_4650 = const(0x60)
3838
"""
3939
The hardware display offset to use when configuring the SH1107 for the
40-
`Adafruit Featherwing 128x64 OLED <https://www.adafruit.com/product/4650>`_
40+
`Adafruit Featherwing 128x64 OLED <https://www.adafruit.com/product/4650>`_.
41+
This is the default if not passed in.
4142
4243
.. code-block::
4344
4445
from adafruit_displayio_sh1107 import SH1107, DISPLAY_OFFSET_ADAFRUIT_FEATHERWING_OLED_4650
4546
46-
# Simplest constructor, assumes it is an Adafruit FeatherWing 128x64 OLED
47+
# Constructor for the Adafruit FeatherWing 128x64 OLED
4748
display = SH1107(bus, width=128, height=64,
4849
display_offset=DISPLAY_OFFSET_ADAFRUIT_FEATHERWING_OLED_4650)
4950
# Or as it's the default
@@ -74,7 +75,7 @@
7475
b"\x81\x01\x2f" # contrast setting = 0x2f
7576
b"\x21\x00" # vertical (column) addressing mode (POR=0x20)
7677
b"\xa0\x00" # segment remap = 1 (POR=0, down rotation)
77-
b"\xcf\x00" # common output scan direction = 15 (0 to n-1 (POR=0))
78+
b"\xcf\x00" # common output scan direction = 15 (n-1 to 0) (POR=0)
7879
b"\xa8\x01\x7f" # multiplex ratio = 128 (POR)
7980
b"\xd3\x01\x60" # set display offset mode = 0x60
8081
b"\xd5\x01\x51" # divide ratio/oscillator: divide by 2, fOsc (POR)
@@ -91,11 +92,11 @@
9192
_INIT_SEQUENCE = (
9293
b"\xae\x00" # display off, sleep mode
9394
b"\xdc\x01\x00" # set display start line 0
94-
b"\x81\x01\x4f" # contrast setting = 0x2f
95+
b"\x81\x01\x4f" # contrast setting = 0x4f
9596
b"\x20\x00" # vertical (column) addressing mode (POR=0x20)
9697
b"\xa0\x00" # segment remap = 1 (POR=0, down rotation)
97-
b"\xc0\x00" # common output scan direction = 15 (0 to n-1 (POR=0))
98-
b"\xa8\x01\x3f" # multiplex ratio = 128 (POR)
98+
b"\xc0\x00" # common output scan direction = 0 (0 to n-1 (POR=0))
99+
b"\xa8\x01\x3f" # multiplex ratio = 64 (POR=0x7F)
99100
b"\xd3\x01\x60" # set display offset mode = 0x60
100101
# b"\xd5\x01\x51" # divide ratio/oscillator: divide by 2, fOsc (POR)
101102
b"\xd9\x01\x22" # pre-charge/dis-charge period mode: 2 DCLKs/2 DCLKs (POR)
@@ -111,7 +112,7 @@
111112

112113
class SH1107(displayio.Display):
113114
"""
114-
SSD1107 driver for use with DisplayIO
115+
SH1107 driver for use with DisplayIO
115116
116117
:param bus: The bus that the display is connected to.
117118
:param int width: The width of the display. Maximum of 128
@@ -139,8 +140,7 @@ def __init__(
139140
color_depth=1,
140141
grayscale=True,
141142
pixels_in_byte_share_row=_PIXELS_IN_ROW, # in vertical (column) mode
142-
data_as_commands=True, # every byte will have a command byte preceeding
143-
set_vertical_scroll=0xD3, # TBD -- not sure about this one!
143+
data_as_commands=True, # every byte will have a command byte preceding
144144
brightness_command=0x81,
145145
single_byte_bounds=True,
146146
rotation=(rotation + _ROTATION_OFFSET) % 360,
@@ -157,20 +157,22 @@ def is_awake(self):
157157
"""
158158
The power state of the display. (read-only)
159159
160-
True if the display is active, False if in sleep mode.
160+
`True` if the display is active, `False` if in sleep mode.
161+
162+
:type: bool
161163
"""
162164
return self._is_awake
163165

164166
def sleep(self):
165167
"""
166-
Put display into sleep mode
168+
Put display into sleep mode. The display uses < 5uA in sleep mode
167169
168-
The display uses < 5uA in sleep mode
169170
Sleep mode does the following:
170-
1) Stops the oscillator and DC-DC circuits
171-
2) Stops the OLED drive
172-
3) Remembers display data and operation mode active prior to sleeping
173-
4) The MP can access (update) the built-in display RAM
171+
172+
1) Stops the oscillator and DC-DC circuits
173+
2) Stops the OLED drive
174+
3) Remembers display data and operation mode active prior to sleeping
175+
4) The MP can access (update) the built-in display RAM
174176
"""
175177
if self._is_awake:
176178
self.bus.send(int(0xAE), "") # 0xAE = display off, sleep mode

0 commit comments

Comments
 (0)