26
26
27
27
"""
28
28
29
- import sys
30
29
import displayio
31
30
from micropython import const
31
+ import sys
32
32
33
33
__version__ = "0.0.0-auto.0"
34
34
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_DisplayIO_SH1107.git"
86
86
b"\xaf \x00 " # DISPLAY_ON
87
87
)
88
88
_PIXELS_IN_ROW = True
89
+ _ROTATION_OFFSET = 0
89
90
else :
90
91
_INIT_SEQUENCE = (
91
92
b"\xae \x00 " # display off, sleep mode
96
97
b"\xc0 \x00 " # common output scan direction = 15 (0 to n-1 (POR=0))
97
98
b"\xa8 \x01 \x3f " # multiplex ratio = 128 (POR)
98
99
b"\xd3 \x01 \x60 " # set display offset mode = 0x60
99
- # b"\xd5\x01\x51" # divide ratio/oscillator: divide by 2, fOsc (POR)
100
+ #b"\xd5\x01\x51" # divide ratio/oscillator: divide by 2, fOsc (POR)
100
101
b"\xd9 \x01 \x22 " # pre-charge/dis-charge period mode: 2 DCLKs/2 DCLKs (POR)
101
102
b"\xdb \x01 \x35 " # VCOM deselect level = 0.770 (POR)
102
- # b"\xb0\x00" # set page address = 0 (POR)
103
+ #b"\xb0\x00" # set page address = 0 (POR)
103
104
b"\xa4 \x00 " # entire display off, retain RAM, normal status (POR)
104
105
b"\xa6 \x00 " # normal (not reversed) display
105
106
b"\xaf \x00 " # DISPLAY_ON
106
107
)
107
108
_PIXELS_IN_ROW = False
108
-
109
+ _ROTATION_OFFSET = 90
109
110
110
111
class SH1107 (displayio .Display ):
111
112
"""
@@ -125,6 +126,7 @@ def __init__(
125
126
self ,
126
127
bus ,
127
128
display_offset = DISPLAY_OFFSET_ADAFRUIT_FEATHERWING_OLED_4650 ,
129
+ rotation = 0 ,
128
130
** kwargs
129
131
):
130
132
init_sequence = bytearray (_INIT_SEQUENCE )
@@ -140,6 +142,7 @@ def __init__(
140
142
set_vertical_scroll = 0xD3 , # TBD -- not sure about this one!
141
143
brightness_command = 0x81 ,
142
144
single_byte_bounds = True ,
145
+ rotation = (rotation + _ROTATION_OFFSET ) % 360 ,
143
146
# for sh1107 use column and page addressing.
144
147
# lower column command = 0x00 - 0x0F
145
148
# upper column command = 0x10 - 0x17
0 commit comments