21
21
22
22
**Software and Dependencies:**
23
23
24
- * Adafruit CircuitPython (version 5 +) firmware for the supported boards:
24
+ * Adafruit CircuitPython (version 6 +) firmware for the supported boards:
25
25
https://github.com/adafruit/circuitpython/releases
26
26
27
27
"""
37
37
DISPLAY_OFFSET_ADAFRUIT_FEATHERWING_OLED_4650 = const (0x60 )
38
38
"""
39
39
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.
41
42
42
43
.. code-block::
43
44
44
45
from adafruit_displayio_sh1107 import SH1107, DISPLAY_OFFSET_ADAFRUIT_FEATHERWING_OLED_4650
45
46
46
- # Simplest constructor, assumes it is an Adafruit FeatherWing 128x64 OLED
47
+ # Constructor for the Adafruit FeatherWing 128x64 OLED
47
48
display = SH1107(bus, width=128, height=64,
48
49
display_offset=DISPLAY_OFFSET_ADAFRUIT_FEATHERWING_OLED_4650)
49
50
# Or as it's the default
74
75
b"\x81 \x01 \x2f " # contrast setting = 0x2f
75
76
b"\x21 \x00 " # vertical (column) addressing mode (POR=0x20)
76
77
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)
78
79
b"\xa8 \x01 \x7f " # multiplex ratio = 128 (POR)
79
80
b"\xd3 \x01 \x60 " # set display offset mode = 0x60
80
81
b"\xd5 \x01 \x51 " # divide ratio/oscillator: divide by 2, fOsc (POR)
91
92
_INIT_SEQUENCE = (
92
93
b"\xae \x00 " # display off, sleep mode
93
94
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
95
96
b"\x20 \x00 " # vertical (column) addressing mode (POR=0x20)
96
97
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 )
99
100
b"\xd3 \x01 \x60 " # set display offset mode = 0x60
100
101
# b"\xd5\x01\x51" # divide ratio/oscillator: divide by 2, fOsc (POR)
101
102
b"\xd9 \x01 \x22 " # pre-charge/dis-charge period mode: 2 DCLKs/2 DCLKs (POR)
111
112
112
113
class SH1107 (displayio .Display ):
113
114
"""
114
- SSD1107 driver for use with DisplayIO
115
+ SH1107 driver for use with DisplayIO
115
116
116
117
:param bus: The bus that the display is connected to.
117
118
:param int width: The width of the display. Maximum of 128
@@ -139,8 +140,7 @@ def __init__(
139
140
color_depth = 1 ,
140
141
grayscale = True ,
141
142
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
144
144
brightness_command = 0x81 ,
145
145
single_byte_bounds = True ,
146
146
rotation = (rotation + _ROTATION_OFFSET ) % 360 ,
@@ -157,20 +157,22 @@ def is_awake(self):
157
157
"""
158
158
The power state of the display. (read-only)
159
159
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
161
163
"""
162
164
return self ._is_awake
163
165
164
166
def sleep (self ):
165
167
"""
166
- Put display into sleep mode
168
+ Put display into sleep mode. The display uses < 5uA in sleep mode
167
169
168
- The display uses < 5uA in sleep mode
169
170
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
174
176
"""
175
177
if self ._is_awake :
176
178
self .bus .send (int (0xAE ), "" ) # 0xAE = display off, sleep mode
0 commit comments