Skip to content

Commit 4f9b90c

Browse files
committed
add const underscores and rotation
1 parent f7c3501 commit 4f9b90c

File tree

2 files changed

+51
-42
lines changed

2 files changed

+51
-42
lines changed

adafruit_epd/epd.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,17 @@ def line(self, x_0, y_0, x_1, y_1, color):
142142
self._red_framebuf.line(x_0, y_0, x_1, y_1, (color == Adafruit_EPD.RED) != self.red_invert)
143143

144144
def text(self, string, x, y, color, *, font_name="font5x8.bin"):
145-
self._bw_framebuf.text(string, x, y, (color == Adafruit_EPD.BLACK) != self.black_invert, font_name)
146-
self._red_framebuf.text(string, x, y, (color == Adafruit_EPD.RED) != self.red_invert, font_name)
145+
self._bw_framebuf.text(string, x, y, (color == Adafruit_EPD.BLACK) != self.black_invert, font_name=font_name)
146+
self._red_framebuf.text(string, x, y, (color == Adafruit_EPD.RED) != self.red_invert, font_name=font_name)
147+
148+
@property
149+
def rotation(self):
150+
return self._bw_framebuf._rotation
151+
152+
@rotation.setter
153+
def rotation(self, val):
154+
self._bw_framebuf.rotation = val
155+
self._red_framebuf.rotation = val
147156

148157
def hline(self, x, y, width, color):
149158
"""draw a horizontal line"""

adafruit_epd/il0373.py

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -32,30 +32,30 @@
3232
from adafruit_epd.epd import Adafruit_EPD
3333
from adafruit_epd.mcp_sram import Adafruit_MCP_SRAM
3434

35-
IL0373_POWER_SETTING = const(0x01)
36-
IL0373_PANEL_SETTING = const(0x00)
37-
IL0373_POWER_OFF = const(0x02)
38-
IL0373_POWER_OFF_SEQUENCE = const(0x03)
39-
IL0373_POWER_ON = const(0x04)
40-
IL0373_POWER_ON_MEASURE = const(0x05)
41-
IL0373_BOOSTER_SOFT_START = const(0x06)
42-
IL0373_DEEP_SLEEP = const(0x07)
43-
IL0373_DTM1 = const(0x10)
44-
IL0373_DATA_STOP = const(0x11)
45-
IL0373_DISPLAY_REFRESH = const(0x12)
46-
IL0373_DTM2 = const(0x13)
47-
IL0373_PDTM1 = const(0x14)
48-
IL0373_PDTM2 = const(0x15)
49-
IL0373_PDRF = const(0x16)
50-
IL0373_LUT1 = const(0x20)
51-
IL0373_LUTWW = const(0x21)
52-
IL0373_LUTBW = const(0x22)
53-
IL0373_LUTWB = const(0x23)
54-
IL0373_LUTBB = const(0x24)
55-
IL0373_PLL = const(0x30)
56-
IL0373_CDI = const(0x50)
57-
IL0373_RESOLUTION = const(0x61)
58-
IL0373_VCM_DC_SETTING = const(0x82)
35+
_IL0373_POWER_SETTING = const(0x01)
36+
_IL0373_PANEL_SETTING = const(0x00)
37+
_IL0373_POWER_OFF = const(0x02)
38+
_IL0373_POWER_OFF_SEQUENCE = const(0x03)
39+
_IL0373_POWER_ON = const(0x04)
40+
_IL0373_POWER_ON_MEASURE = const(0x05)
41+
_IL0373_BOOSTER_SOFT_START = const(0x06)
42+
_IL0373_DEEP_SLEEP = const(0x07)
43+
_IL0373_DTM1 = const(0x10)
44+
_IL0373_DATA_STOP = const(0x11)
45+
_IL0373_DISPLAY_REFRESH = const(0x12)
46+
_IL0373_DTM2 = const(0x13)
47+
_IL0373_PDTM1 = const(0x14)
48+
_IL0373_PDTM2 = const(0x15)
49+
_IL0373_PDRF = const(0x16)
50+
_IL0373_LUT1 = const(0x20)
51+
_IL0373_LUTWW = const(0x21)
52+
_IL0373_LUTBW = const(0x22)
53+
_IL0373_LUTWB = const(0x23)
54+
_IL0373_LUTBB = const(0x24)
55+
_IL0373_PLL = const(0x30)
56+
_IL0373_CDI = const(0x50)
57+
_IL0373_RESOLUTION = const(0x61)
58+
_IL0373_VCM_DC_SETTING = const(0x82)
5959

6060
class Adafruit_IL0373(Adafruit_EPD):
6161
"""driver class for Adafruit IL0373 ePaper display breakouts"""
@@ -77,27 +77,27 @@ def begin(self, reset=True):
7777
while self._busy.value is False:
7878
pass
7979

80-
self.command(IL0373_POWER_SETTING, bytearray([0x03, 0x00, 0x2b, 0x2b, 0x09]))
81-
self.command(IL0373_BOOSTER_SOFT_START, bytearray([0x17, 0x17, 0x17]))
80+
self.command(_IL0373_POWER_SETTING, bytearray([0x03, 0x00, 0x2b, 0x2b, 0x09]))
81+
self.command(_IL0373_BOOSTER_SOFT_START, bytearray([0x17, 0x17, 0x17]))
8282

8383
def update(self):
8484
"""update the display"""
85-
self.command(IL0373_DISPLAY_REFRESH)
85+
self.command(_IL0373_DISPLAY_REFRESH)
8686

8787
if self._busy:
8888
while self._busy.value is False:
8989
pass
9090
else:
9191
time.sleep(15) # wait 15 seconds
9292

93-
self.command(IL0373_CDI, bytearray([0x17]))
94-
self.command(IL0373_VCM_DC_SETTING, bytearray([0x00]))
95-
self.command(IL0373_POWER_OFF)
93+
self.command(_IL0373_CDI, bytearray([0x17]))
94+
self.command(_IL0373_VCM_DC_SETTING, bytearray([0x00]))
95+
self.command(_IL0373_POWER_OFF)
9696
time.sleep(2)
9797

9898
def power_up(self):
9999
"""power up the display"""
100-
self.command(IL0373_POWER_ON)
100+
self.command(_IL0373_POWER_ON)
101101

102102
if self._busy:
103103
while self._busy.value is False:
@@ -106,15 +106,15 @@ def power_up(self):
106106
time.sleep(3) # wait a bit
107107
time.sleep(.2)
108108

109-
self.command(IL0373_PANEL_SETTING, bytearray([0xCF]))
110-
self.command(IL0373_CDI, bytearray([0x37]))
111-
self.command(IL0373_PLL, bytearray([0x29]))
109+
self.command(_IL0373_PANEL_SETTING, bytearray([0xCF]))
110+
self.command(_IL0373_CDI, bytearray([0x37]))
111+
self.command(_IL0373_PLL, bytearray([0x29]))
112112
_b1 = self.height & 0xFF
113113
_b2 = (self.height >> 8) & 0xFF
114114
_b3 = self.width & 0xFF
115115
_b4 = (self.width >> 8) & 0xFF
116-
self.command(IL0373_RESOLUTION, bytearray([_b1, _b2, _b3, _b4]))
117-
self.command(IL0373_VCM_DC_SETTING, bytearray([0x0A]))
116+
self.command(_IL0373_RESOLUTION, bytearray([_b1, _b2, _b3, _b4]))
117+
self.command(_IL0373_VCM_DC_SETTING, bytearray([0x0A]))
118118

119119

120120
def display(self):
@@ -133,7 +133,7 @@ def display(self):
133133

134134
#first data byte from SRAM will be transfered in at the
135135
#same time as the EPD command is transferred out
136-
cmd = self.command(IL0373_DTM1, end=False)
136+
cmd = self.command(_IL0373_DTM1, end=False)
137137

138138
while not self.spi_device.try_lock():
139139
pass
@@ -157,7 +157,7 @@ def display(self):
157157

158158
#first data byte from SRAM will be transfered in at the
159159
#same time as the EPD command is transferred out
160-
cmd = self.command(IL0373_DTM2, end=False)
160+
cmd = self.command(_IL0373_DTM2, end=False)
161161

162162
while not self.spi_device.try_lock():
163163
pass
@@ -171,7 +171,7 @@ def display(self):
171171
self.sram.cs_pin.value = True
172172
self.spi_device.unlock()
173173
else:
174-
cmd = self.command(IL0373_DTM1, end=False)
174+
cmd = self.command(_IL0373_DTM1, end=False)
175175
while not self.spi_device.try_lock():
176176
pass
177177
self._dc.value = True
@@ -181,7 +181,7 @@ def display(self):
181181

182182
time.sleep(.02)
183183

184-
cmd = self.command(IL0373_DTM2, end=False)
184+
cmd = self.command(_IL0373_DTM2, end=False)
185185
while not self.spi_device.try_lock():
186186
pass
187187
self._dc.value = True

0 commit comments

Comments
 (0)