Ran black, updated to pylint 2.x
This commit is contained in:
parent
faeb1a75d8
commit
c13f9f53c1
19 changed files with 553 additions and 362 deletions
2
.github/workflows/build.yml
vendored
2
.github/workflows/build.yml
vendored
|
|
@ -40,7 +40,7 @@ jobs:
|
|||
source actions-ci/install.sh
|
||||
- name: Pip install pylint, black, & Sphinx
|
||||
run: |
|
||||
pip install --force-reinstall pylint==1.9.2 black==19.10b0 Sphinx sphinx-rtd-theme
|
||||
pip install --force-reinstall pylint black==19.10b0 Sphinx sphinx-rtd-theme
|
||||
- name: Library version
|
||||
run: git describe --dirty --always --tags
|
||||
- name: PyLint
|
||||
|
|
|
|||
|
|
@ -34,9 +34,11 @@ from adafruit_epd import mcp_sram
|
|||
__version__ = "0.0.0-auto.0"
|
||||
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_EPD.git"
|
||||
|
||||
|
||||
class Adafruit_EPD: # pylint: disable=too-many-instance-attributes, too-many-public-methods
|
||||
"""Base class for EPD displays
|
||||
"""
|
||||
|
||||
BLACK = const(0)
|
||||
WHITE = const(1)
|
||||
INVERSE = const(2)
|
||||
|
|
@ -44,8 +46,9 @@ class Adafruit_EPD: # pylint: disable=too-many-instance-attributes, too-many-pub
|
|||
DARK = const(4)
|
||||
LIGHT = const(5)
|
||||
|
||||
|
||||
def __init__(self, width, height, spi, cs_pin, dc_pin, sramcs_pin, rst_pin, busy_pin): # pylint: disable=too-many-arguments
|
||||
def __init__(
|
||||
self, width, height, spi, cs_pin, dc_pin, sramcs_pin, rst_pin, busy_pin
|
||||
): # pylint: disable=too-many-arguments
|
||||
self._width = width
|
||||
self._height = height
|
||||
|
||||
|
|
@ -101,16 +104,16 @@ class Adafruit_EPD: # pylint: disable=too-many-instance-attributes, too-many-pub
|
|||
while not self.spi_device.try_lock():
|
||||
time.sleep(0.01)
|
||||
self.sram.cs_pin.value = False
|
||||
#send read command
|
||||
# send read command
|
||||
self._buf[0] = mcp_sram.Adafruit_MCP_SRAM.SRAM_READ
|
||||
#send start address
|
||||
# send start address
|
||||
self._buf[1] = 0
|
||||
self._buf[2] = 0
|
||||
self.spi_device.write(self._buf, end=3)
|
||||
self.spi_device.unlock()
|
||||
|
||||
#first data byte from SRAM will be transfered in at the
|
||||
#same time as the EPD command is transferred out
|
||||
# first data byte from SRAM will be transfered in at the
|
||||
# same time as the EPD command is transferred out
|
||||
databyte = self.write_ram(0)
|
||||
|
||||
while not self.spi_device.try_lock():
|
||||
|
|
@ -127,23 +130,23 @@ class Adafruit_EPD: # pylint: disable=too-many-instance-attributes, too-many-pub
|
|||
|
||||
self._cs.value = True
|
||||
self.spi_device.unlock()
|
||||
time.sleep(.002)
|
||||
time.sleep(0.002)
|
||||
|
||||
if self.sram:
|
||||
while not self.spi_device.try_lock():
|
||||
time.sleep(0.01)
|
||||
self.sram.cs_pin.value = False
|
||||
#send read command
|
||||
# send read command
|
||||
self._buf[0] = mcp_sram.Adafruit_MCP_SRAM.SRAM_READ
|
||||
#send start address
|
||||
# send start address
|
||||
self._buf[1] = (self._buffer1_size >> 8) & 0xFF
|
||||
self._buf[2] = self._buffer1_size & 0xFF
|
||||
self.spi_device.write(self._buf, end=3)
|
||||
self.spi_device.unlock()
|
||||
|
||||
if self._buffer2_size != 0:
|
||||
#first data byte from SRAM will be transfered in at the
|
||||
#same time as the EPD command is transferred out
|
||||
# first data byte from SRAM will be transfered in at the
|
||||
# same time as the EPD command is transferred out
|
||||
databyte = self.write_ram(1)
|
||||
|
||||
while not self.spi_device.try_lock():
|
||||
|
|
@ -166,7 +169,6 @@ class Adafruit_EPD: # pylint: disable=too-many-instance-attributes, too-many-pub
|
|||
|
||||
self.update()
|
||||
|
||||
|
||||
def hardware_reset(self):
|
||||
"""If we have a reset pin, do a hardware reset by toggling it"""
|
||||
if self._rst:
|
||||
|
|
@ -259,7 +261,7 @@ class Adafruit_EPD: # pylint: disable=too-many-instance-attributes, too-many-pub
|
|||
|
||||
def pixel(self, x, y, color):
|
||||
"""draw a single pixel in the display buffer"""
|
||||
self._color_dup('pixel', (x, y), color)
|
||||
self._color_dup("pixel", (x, y), color)
|
||||
|
||||
def fill(self, color):
|
||||
"""fill the screen with the passed color"""
|
||||
|
|
@ -275,26 +277,43 @@ class Adafruit_EPD: # pylint: disable=too-many-instance-attributes, too-many-pub
|
|||
|
||||
def rect(self, x, y, width, height, color): # pylint: disable=too-many-arguments
|
||||
"""draw a rectangle"""
|
||||
self._color_dup('rect', (x, y, width, height), color)
|
||||
self._color_dup("rect", (x, y, width, height), color)
|
||||
|
||||
def fill_rect(self, x, y, width, height, color): # pylint: disable=too-many-arguments
|
||||
def fill_rect(
|
||||
self, x, y, width, height, color
|
||||
): # pylint: disable=too-many-arguments
|
||||
"""fill a rectangle with the passed color"""
|
||||
self._color_dup('fill_rect', (x, y, width, height), color)
|
||||
self._color_dup("fill_rect", (x, y, width, height), color)
|
||||
|
||||
def line(self, x_0, y_0, x_1, y_1, color): # pylint: disable=too-many-arguments
|
||||
"""Draw a line from (x_0, y_0) to (x_1, y_1) in passed color"""
|
||||
self._color_dup('line', (x_0, y_0, x_1, y_1), color)
|
||||
self._color_dup("line", (x_0, y_0, x_1, y_1), color)
|
||||
|
||||
def text(self, string, x, y, color, *, font_name="font5x8.bin"):
|
||||
"""Write text string at location (x, y) in given color, using font file"""
|
||||
if self._blackframebuf is self._colorframebuf: # monochrome
|
||||
self._blackframebuf.text(string, x, y, font_name=font_name,
|
||||
color=(color != Adafruit_EPD.WHITE) != self._black_inverted)
|
||||
self._blackframebuf.text(
|
||||
string,
|
||||
x,
|
||||
y,
|
||||
font_name=font_name,
|
||||
color=(color != Adafruit_EPD.WHITE) != self._black_inverted,
|
||||
)
|
||||
else:
|
||||
self._blackframebuf.text(string, x, y, font_name=font_name,
|
||||
color=(color == Adafruit_EPD.BLACK) != self._black_inverted)
|
||||
self._colorframebuf.text(string, x, y, font_name=font_name,
|
||||
color=(color == Adafruit_EPD.RED) != self._color_inverted)
|
||||
self._blackframebuf.text(
|
||||
string,
|
||||
x,
|
||||
y,
|
||||
font_name=font_name,
|
||||
color=(color == Adafruit_EPD.BLACK) != self._black_inverted,
|
||||
)
|
||||
self._colorframebuf.text(
|
||||
string,
|
||||
x,
|
||||
y,
|
||||
font_name=font_name,
|
||||
color=(color == Adafruit_EPD.RED) != self._color_inverted,
|
||||
)
|
||||
|
||||
@property
|
||||
def width(self):
|
||||
|
|
@ -329,17 +348,19 @@ class Adafruit_EPD: # pylint: disable=too-many-instance-attributes, too-many-pub
|
|||
"""draw a vertical line"""
|
||||
self.fill_rect(x, y, 1, height, color)
|
||||
|
||||
|
||||
def image(self, image):
|
||||
"""Set buffer to value of Python Imaging Library image. The image should
|
||||
be in RGB mode and a size equal to the display size.
|
||||
"""
|
||||
if image.mode != 'RGB':
|
||||
raise ValueError('Image must be in mode RGB.')
|
||||
if image.mode != "RGB":
|
||||
raise ValueError("Image must be in mode RGB.")
|
||||
imwidth, imheight = image.size
|
||||
if imwidth != self.width or imheight != self.height:
|
||||
raise ValueError('Image must be same dimensions as display ({0}x{1}).' \
|
||||
.format(self.width, self.height))
|
||||
raise ValueError(
|
||||
"Image must be same dimensions as display ({0}x{1}).".format(
|
||||
self.width, self.height
|
||||
)
|
||||
)
|
||||
if self.sram:
|
||||
raise RuntimeError("PIL image is not for use with SRAM assist")
|
||||
# Grab all the pixels from the image, faster than getpixel.
|
||||
|
|
@ -350,7 +371,7 @@ class Adafruit_EPD: # pylint: disable=too-many-instance-attributes, too-many-pub
|
|||
for y in range(image.size[1]):
|
||||
for x in range(image.size[0]):
|
||||
pixel = pix[x, y]
|
||||
if (pixel[0] >= 0x80) and (pixel[1] < 0x80) and (pixel[2] < 0x80):
|
||||
if (pixel[1] < 0x80 <= pixel[0]) and (pixel[2] < 0x80):
|
||||
# reddish
|
||||
self.pixel(x, y, Adafruit_EPD.RED)
|
||||
elif (pixel[0] < 0x80) and (pixel[1] < 0x80) and (pixel[2] < 0x80):
|
||||
|
|
|
|||
|
|
@ -59,12 +59,17 @@ _IL0373_CDI = const(0x50)
|
|||
_IL0373_RESOLUTION = const(0x61)
|
||||
_IL0373_VCM_DC_SETTING = const(0x82)
|
||||
|
||||
|
||||
class Adafruit_IL0373(Adafruit_EPD):
|
||||
"""driver class for Adafruit IL0373 ePaper display breakouts"""
|
||||
|
||||
# pylint: disable=too-many-arguments
|
||||
def __init__(self, width, height, spi, *, cs_pin, dc_pin, sramcs_pin, rst_pin, busy_pin):
|
||||
super(Adafruit_IL0373, self).__init__(width, height, spi, cs_pin, dc_pin,
|
||||
sramcs_pin, rst_pin, busy_pin)
|
||||
def __init__(
|
||||
self, width, height, spi, *, cs_pin, dc_pin, sramcs_pin, rst_pin, busy_pin
|
||||
):
|
||||
super(Adafruit_IL0373, self).__init__(
|
||||
width, height, spi, cs_pin, dc_pin, sramcs_pin, rst_pin, busy_pin
|
||||
)
|
||||
|
||||
self._buffer1_size = int(width * height / 8)
|
||||
self._buffer2_size = int(width * height / 8)
|
||||
|
|
@ -77,10 +82,12 @@ class Adafruit_IL0373(Adafruit_EPD):
|
|||
self._buffer2 = bytearray((width * height) // 8)
|
||||
# since we have *two* framebuffers - one for red and one for black
|
||||
# we dont subclass but manage manually
|
||||
self._framebuf1 = adafruit_framebuf.FrameBuffer(self._buffer1, width, height,
|
||||
buf_format=adafruit_framebuf.MHMSB)
|
||||
self._framebuf2 = adafruit_framebuf.FrameBuffer(self._buffer2, width, height,
|
||||
buf_format=adafruit_framebuf.MHMSB)
|
||||
self._framebuf1 = adafruit_framebuf.FrameBuffer(
|
||||
self._buffer1, width, height, buf_format=adafruit_framebuf.MHMSB
|
||||
)
|
||||
self._framebuf2 = adafruit_framebuf.FrameBuffer(
|
||||
self._buffer2, width, height, buf_format=adafruit_framebuf.MHMSB
|
||||
)
|
||||
self.set_black_buffer(0, True)
|
||||
self.set_color_buffer(1, True)
|
||||
# pylint: enable=too-many-arguments
|
||||
|
|
@ -105,7 +112,7 @@ class Adafruit_IL0373(Adafruit_EPD):
|
|||
self.hardware_reset()
|
||||
self.busy_wait()
|
||||
|
||||
self.command(_IL0373_POWER_SETTING, bytearray([0x03, 0x00, 0x2b, 0x2b, 0x09]))
|
||||
self.command(_IL0373_POWER_SETTING, bytearray([0x03, 0x00, 0x2B, 0x2B, 0x09]))
|
||||
self.command(_IL0373_BOOSTER_SOFT_START, bytearray([0x17, 0x17, 0x17]))
|
||||
self.command(_IL0373_POWER_ON)
|
||||
|
||||
|
|
|
|||
|
|
@ -60,12 +60,17 @@ _IL0398_RESOLUTION = const(0x61)
|
|||
_IL0398_GETSTATUS = const(0x71)
|
||||
_IL0398_VCM_DC_SETTING = const(0x82)
|
||||
|
||||
|
||||
class Adafruit_IL0398(Adafruit_EPD):
|
||||
"""driver class for Adafruit IL0373 ePaper display breakouts"""
|
||||
|
||||
# pylint: disable=too-many-arguments
|
||||
def __init__(self, width, height, spi, *, cs_pin, dc_pin, sramcs_pin, rst_pin, busy_pin):
|
||||
super(Adafruit_IL0398, self).__init__(width, height, spi, cs_pin, dc_pin,
|
||||
sramcs_pin, rst_pin, busy_pin)
|
||||
def __init__(
|
||||
self, width, height, spi, *, cs_pin, dc_pin, sramcs_pin, rst_pin, busy_pin
|
||||
):
|
||||
super(Adafruit_IL0398, self).__init__(
|
||||
width, height, spi, cs_pin, dc_pin, sramcs_pin, rst_pin, busy_pin
|
||||
)
|
||||
|
||||
self._buffer1_size = int(width * height / 8)
|
||||
self._buffer2_size = int(width * height / 8)
|
||||
|
|
@ -78,10 +83,12 @@ class Adafruit_IL0398(Adafruit_EPD):
|
|||
self._buffer2 = bytearray((width * height) // 8)
|
||||
# since we have *two* framebuffers - one for red and one for black
|
||||
# we dont subclass but manage manually
|
||||
self._framebuf1 = adafruit_framebuf.FrameBuffer(self._buffer1, width, height,
|
||||
buf_format=adafruit_framebuf.MHMSB)
|
||||
self._framebuf2 = adafruit_framebuf.FrameBuffer(self._buffer2, width, height,
|
||||
buf_format=adafruit_framebuf.MHMSB)
|
||||
self._framebuf1 = adafruit_framebuf.FrameBuffer(
|
||||
self._buffer1, width, height, buf_format=adafruit_framebuf.MHMSB
|
||||
)
|
||||
self._framebuf2 = adafruit_framebuf.FrameBuffer(
|
||||
self._buffer2, width, height, buf_format=adafruit_framebuf.MHMSB
|
||||
)
|
||||
self.set_black_buffer(0, True)
|
||||
self.set_color_buffer(1, True)
|
||||
# pylint: enable=too-many-arguments
|
||||
|
|
@ -97,7 +104,7 @@ class Adafruit_IL0398(Adafruit_EPD):
|
|||
busy pin, or pausing"""
|
||||
if self._busy:
|
||||
while not self._busy.value:
|
||||
#self.command(_IL0398_GETSTATUS)
|
||||
# self.command(_IL0398_GETSTATUS)
|
||||
time.sleep(0.01)
|
||||
else:
|
||||
time.sleep(0.5)
|
||||
|
|
|
|||
|
|
@ -60,19 +60,24 @@ _IL91874_RESOLUTION = const(0x61)
|
|||
_IL91874_VCM_DC_SETTING = const(0x82)
|
||||
|
||||
# pylint: disable=line-too-long
|
||||
_LUT_VCOMDC = b'\x00\x00\x00\x1a\x1a\x00\x00\x01\x00\n\n\x00\x00\x08\x00\x0e\x01\x0e\x01\x10\x00\n\n\x00\x00\x08\x00\x04\x10\x00\x00\x05\x00\x03\x0e\x00\x00\n\x00#\x00\x00\x00\x01'
|
||||
_LUT_WW = b'\x90\x1a\x1a\x00\x00\x01@\n\n\x00\x00\x08\x84\x0e\x01\x0e\x01\x10\x80\n\n\x00\x00\x08\x00\x04\x10\x00\x00\x05\x00\x03\x0e\x00\x00\n\x00#\x00\x00\x00\x01'
|
||||
_LUT_BW = b'\xa0\x1a\x1a\x00\x00\x01\x00\n\n\x00\x00\x08\x84\x0e\x01\x0e\x01\x10\x90\n\n\x00\x00\x08\xb0\x04\x10\x00\x00\x05\xb0\x03\x0e\x00\x00\n\xc0#\x00\x00\x00\x01'
|
||||
_LUT_BB = b'\x90\x1a\x1a\x00\x00\x01@\n\n\x00\x00\x08\x84\x0e\x01\x0e\x01\x10\x80\n\n\x00\x00\x08\x00\x04\x10\x00\x00\x05\x00\x03\x0e\x00\x00\n\x00#\x00\x00\x00\x01'
|
||||
_LUT_WB = b'\x90\x1a\x1a\x00\x00\x01 \n\n\x00\x00\x08\x84\x0e\x01\x0e\x01\x10\x10\n\n\x00\x00\x08\x00\x04\x10\x00\x00\x05\x00\x03\x0e\x00\x00\n\x00#\x00\x00\x00\x01'
|
||||
_LUT_VCOMDC = b"\x00\x00\x00\x1a\x1a\x00\x00\x01\x00\n\n\x00\x00\x08\x00\x0e\x01\x0e\x01\x10\x00\n\n\x00\x00\x08\x00\x04\x10\x00\x00\x05\x00\x03\x0e\x00\x00\n\x00#\x00\x00\x00\x01"
|
||||
_LUT_WW = b"\x90\x1a\x1a\x00\x00\x01@\n\n\x00\x00\x08\x84\x0e\x01\x0e\x01\x10\x80\n\n\x00\x00\x08\x00\x04\x10\x00\x00\x05\x00\x03\x0e\x00\x00\n\x00#\x00\x00\x00\x01"
|
||||
_LUT_BW = b"\xa0\x1a\x1a\x00\x00\x01\x00\n\n\x00\x00\x08\x84\x0e\x01\x0e\x01\x10\x90\n\n\x00\x00\x08\xb0\x04\x10\x00\x00\x05\xb0\x03\x0e\x00\x00\n\xc0#\x00\x00\x00\x01"
|
||||
_LUT_BB = b"\x90\x1a\x1a\x00\x00\x01@\n\n\x00\x00\x08\x84\x0e\x01\x0e\x01\x10\x80\n\n\x00\x00\x08\x00\x04\x10\x00\x00\x05\x00\x03\x0e\x00\x00\n\x00#\x00\x00\x00\x01"
|
||||
_LUT_WB = b"\x90\x1a\x1a\x00\x00\x01 \n\n\x00\x00\x08\x84\x0e\x01\x0e\x01\x10\x10\n\n\x00\x00\x08\x00\x04\x10\x00\x00\x05\x00\x03\x0e\x00\x00\n\x00#\x00\x00\x00\x01"
|
||||
# pylint: enable=line-too-long
|
||||
|
||||
|
||||
class Adafruit_IL91874(Adafruit_EPD):
|
||||
"""driver class for Adafruit IL91874 ePaper display breakouts"""
|
||||
|
||||
# pylint: disable=too-many-arguments
|
||||
def __init__(self, width, height, spi, *, cs_pin, dc_pin, sramcs_pin, rst_pin, busy_pin):
|
||||
super(Adafruit_IL91874, self).__init__(width, height, spi, cs_pin, dc_pin,
|
||||
sramcs_pin, rst_pin, busy_pin)
|
||||
def __init__(
|
||||
self, width, height, spi, *, cs_pin, dc_pin, sramcs_pin, rst_pin, busy_pin
|
||||
):
|
||||
super(Adafruit_IL91874, self).__init__(
|
||||
width, height, spi, cs_pin, dc_pin, sramcs_pin, rst_pin, busy_pin
|
||||
)
|
||||
|
||||
self._buffer1_size = int(width * height / 8)
|
||||
self._buffer2_size = int(width * height / 8)
|
||||
|
|
@ -85,10 +90,12 @@ class Adafruit_IL91874(Adafruit_EPD):
|
|||
self._buffer2 = bytearray((width * height) // 8)
|
||||
# since we have *two* framebuffers - one for red and one for black
|
||||
# we dont subclass but manage manually
|
||||
self._framebuf1 = adafruit_framebuf.FrameBuffer(self._buffer1, width, height,
|
||||
buf_format=adafruit_framebuf.MHMSB)
|
||||
self._framebuf2 = adafruit_framebuf.FrameBuffer(self._buffer2, width, height,
|
||||
buf_format=adafruit_framebuf.MHMSB)
|
||||
self._framebuf1 = adafruit_framebuf.FrameBuffer(
|
||||
self._buffer1, width, height, buf_format=adafruit_framebuf.MHMSB
|
||||
)
|
||||
self._framebuf2 = adafruit_framebuf.FrameBuffer(
|
||||
self._buffer2, width, height, buf_format=adafruit_framebuf.MHMSB
|
||||
)
|
||||
self.set_black_buffer(0, True)
|
||||
self.set_color_buffer(1, False)
|
||||
self._single_byte_tx = True
|
||||
|
|
@ -118,7 +125,7 @@ class Adafruit_IL91874(Adafruit_EPD):
|
|||
|
||||
self.command(_IL91874_PANEL_SETTING, bytearray([0xAF]))
|
||||
self.command(_IL91874_PLL, bytearray([0x3A]))
|
||||
self.command(_IL91874_POWER_SETTING, bytearray([0x03, 0x00, 0x2b, 0x2b, 0x09]))
|
||||
self.command(_IL91874_POWER_SETTING, bytearray([0x03, 0x00, 0x2B, 0x2B, 0x09]))
|
||||
self.command(_IL91874_BOOSTER_SOFT_START, bytearray([0x07, 0x07, 0x17]))
|
||||
|
||||
self.command(0xF8, bytearray([0x60, 0xA5])) # mystery command in example code
|
||||
|
|
|
|||
|
|
@ -34,23 +34,27 @@ __repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_EPD.git"
|
|||
|
||||
SRAM_SEQUENTIAL_MODE = const(1 << 6)
|
||||
|
||||
|
||||
class Adafruit_MCP_SRAM_View:
|
||||
"""A interface class that turns an SRAM chip into something like a memoryview"""
|
||||
|
||||
def __init__(self, sram, offset):
|
||||
self._sram = sram
|
||||
self._offset = offset
|
||||
self._buf = [0]
|
||||
|
||||
def __getitem__(self, i):
|
||||
return self._sram.read(self._offset+i, 1)[0]
|
||||
return self._sram.read(self._offset + i, 1)[0]
|
||||
|
||||
def __setitem__(self, i, val):
|
||||
self._buf[0] = val
|
||||
self._sram.write(self._offset+i, self._buf)
|
||||
self._sram.write(self._offset + i, self._buf)
|
||||
|
||||
|
||||
class Adafruit_MCP_SRAM:
|
||||
"""supporting class for communicating with
|
||||
Microchip SRAM chips"""
|
||||
|
||||
SRAM_READ = 0x03
|
||||
SRAM_WRITE = 0x02
|
||||
SRAM_RDSR = 0x05
|
||||
|
|
|
|||
|
|
@ -68,15 +68,20 @@ _SSD1608_SET_RAMYCOUNT = const(0x4F)
|
|||
_SSD1608_NOP = const(0xFF)
|
||||
_LUT_DATA = b'\x02\x02\x01\x11\x12\x12""fiiYX\x99\x99\x88\x00\x00\x00\x00\xf8\xb4\x13Q5QQ\x19\x01\x00' # pylint: disable=line-too-long
|
||||
|
||||
|
||||
class Adafruit_SSD1608(Adafruit_EPD):
|
||||
"""driver class for Adafruit SSD1608 ePaper display breakouts"""
|
||||
|
||||
# pylint: disable=too-many-arguments
|
||||
def __init__(self, width, height, spi, *, cs_pin, dc_pin, sramcs_pin, rst_pin, busy_pin):
|
||||
super(Adafruit_SSD1608, self).__init__(width, height, spi, cs_pin, dc_pin,
|
||||
sramcs_pin, rst_pin, busy_pin)
|
||||
def __init__(
|
||||
self, width, height, spi, *, cs_pin, dc_pin, sramcs_pin, rst_pin, busy_pin
|
||||
):
|
||||
super(Adafruit_SSD1608, self).__init__(
|
||||
width, height, spi, cs_pin, dc_pin, sramcs_pin, rst_pin, busy_pin
|
||||
)
|
||||
|
||||
if height % 8 != 0:
|
||||
height += (8 - height % 8)
|
||||
height += 8 - height % 8
|
||||
self._height = height
|
||||
|
||||
self._buffer1_size = int(width * height / 8)
|
||||
|
|
@ -85,8 +90,9 @@ class Adafruit_SSD1608(Adafruit_EPD):
|
|||
self._buffer1 = self.sram.get_view(0)
|
||||
else:
|
||||
self._buffer1 = bytearray((width * height) // 8)
|
||||
self._framebuf1 = adafruit_framebuf.FrameBuffer(self._buffer1, width, height,
|
||||
buf_format=adafruit_framebuf.MHMSB)
|
||||
self._framebuf1 = adafruit_framebuf.FrameBuffer(
|
||||
self._buffer1, width, height, buf_format=adafruit_framebuf.MHMSB
|
||||
)
|
||||
self.set_black_buffer(0, True)
|
||||
self.set_color_buffer(0, True)
|
||||
# pylint: enable=too-many-arguments
|
||||
|
|
@ -113,8 +119,10 @@ class Adafruit_SSD1608(Adafruit_EPD):
|
|||
self.command(_SSD1608_SW_RESET)
|
||||
self.busy_wait()
|
||||
# driver output control
|
||||
self.command(_SSD1608_DRIVER_CONTROL,
|
||||
bytearray([self._width-1, (self._width-1) >> 8, 0x00]))
|
||||
self.command(
|
||||
_SSD1608_DRIVER_CONTROL,
|
||||
bytearray([self._width - 1, (self._width - 1) >> 8, 0x00]),
|
||||
)
|
||||
# Set dummy line period
|
||||
self.command(_SSD1608_WRITE_DUMMY, bytearray([0x1B]))
|
||||
# Set gate line width
|
||||
|
|
@ -122,10 +130,12 @@ class Adafruit_SSD1608(Adafruit_EPD):
|
|||
# Data entry sequence
|
||||
self.command(_SSD1608_DATA_MODE, bytearray([0x03]))
|
||||
# Set ram X start/end postion
|
||||
self.command(_SSD1608_SET_RAMXPOS, bytearray([0x00, self._height//8 - 1]))
|
||||
self.command(_SSD1608_SET_RAMXPOS, bytearray([0x00, self._height // 8 - 1]))
|
||||
# Set ram Y start/end postion
|
||||
self.command(_SSD1608_SET_RAMYPOS,
|
||||
bytearray([0, 0, self._height - 1, (self._height - 1) >> 8]))
|
||||
self.command(
|
||||
_SSD1608_SET_RAMYPOS,
|
||||
bytearray([0, 0, self._height - 1, (self._height - 1) >> 8]),
|
||||
)
|
||||
# Vcom Voltage
|
||||
self.command(_SSD1608_WRITE_VCOM, bytearray([0x70]))
|
||||
# LUT
|
||||
|
|
@ -159,4 +169,4 @@ class Adafruit_SSD1608(Adafruit_EPD):
|
|||
# Set RAM X address counter
|
||||
self.command(_SSD1608_SET_RAMXCOUNT, bytearray([x]))
|
||||
# Set RAM Y address counter
|
||||
self.command(_SSD1608_SET_RAMYCOUNT, bytearray([y>>8, y]))
|
||||
self.command(_SSD1608_SET_RAMYCOUNT, bytearray([y >> 8, y]))
|
||||
|
|
|
|||
|
|
@ -60,17 +60,22 @@ _SSD1675_SET_RAMXCOUNT = const(0x4E)
|
|||
_SSD1675_SET_RAMYCOUNT = const(0x4F)
|
||||
_SSD1675_SET_ANALOGBLOCK = const(0x74)
|
||||
_SSD1675_SET_DIGITALBLOCK = const(0x7E)
|
||||
_LUT_DATA = b'\x80`@\x00\x00\x00\x00\x10` \x00\x00\x00\x00\x80`@\x00\x00\x00\x00\x10` \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03\x03\x00\x00\x02\t\t\x00\x00\x02\x03\x03\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x15A\xa820\n' # pylint: disable=line-too-long
|
||||
_LUT_DATA = b"\x80`@\x00\x00\x00\x00\x10` \x00\x00\x00\x00\x80`@\x00\x00\x00\x00\x10` \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03\x03\x00\x00\x02\t\t\x00\x00\x02\x03\x03\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x15A\xa820\n" # pylint: disable=line-too-long
|
||||
|
||||
|
||||
class Adafruit_SSD1675(Adafruit_EPD):
|
||||
"""driver class for Adafruit SSD1675 ePaper display breakouts"""
|
||||
|
||||
# pylint: disable=too-many-arguments
|
||||
def __init__(self, width, height, spi, *, cs_pin, dc_pin, sramcs_pin, rst_pin, busy_pin):
|
||||
super(Adafruit_SSD1675, self).__init__(width, height, spi, cs_pin, dc_pin,
|
||||
sramcs_pin, rst_pin, busy_pin)
|
||||
def __init__(
|
||||
self, width, height, spi, *, cs_pin, dc_pin, sramcs_pin, rst_pin, busy_pin
|
||||
):
|
||||
super(Adafruit_SSD1675, self).__init__(
|
||||
width, height, spi, cs_pin, dc_pin, sramcs_pin, rst_pin, busy_pin
|
||||
)
|
||||
stride = width
|
||||
if stride % 8 != 0:
|
||||
stride += (8 - stride % 8)
|
||||
stride += 8 - stride % 8
|
||||
|
||||
self._buffer1_size = int(stride * height / 8)
|
||||
self._buffer2_size = self._buffer1_size
|
||||
|
|
@ -83,10 +88,20 @@ class Adafruit_SSD1675(Adafruit_EPD):
|
|||
self._buffer2 = bytearray(self._buffer2_size)
|
||||
# since we have *two* framebuffers - one for red and one for black
|
||||
# we dont subclass but manage manually
|
||||
self._framebuf1 = adafruit_framebuf.FrameBuffer(self._buffer1, width, height, stride=stride,
|
||||
buf_format=adafruit_framebuf.MHMSB)
|
||||
self._framebuf2 = adafruit_framebuf.FrameBuffer(self._buffer2, width, height, stride=stride,
|
||||
buf_format=adafruit_framebuf.MHMSB)
|
||||
self._framebuf1 = adafruit_framebuf.FrameBuffer(
|
||||
self._buffer1,
|
||||
width,
|
||||
height,
|
||||
stride=stride,
|
||||
buf_format=adafruit_framebuf.MHMSB,
|
||||
)
|
||||
self._framebuf2 = adafruit_framebuf.FrameBuffer(
|
||||
self._buffer2,
|
||||
width,
|
||||
height,
|
||||
stride=stride,
|
||||
buf_format=adafruit_framebuf.MHMSB,
|
||||
)
|
||||
self.set_black_buffer(0, True)
|
||||
self.set_color_buffer(0, True)
|
||||
# pylint: enable=too-many-arguments
|
||||
|
|
@ -121,8 +136,7 @@ class Adafruit_SSD1675(Adafruit_EPD):
|
|||
self.command(_SSD1675_SET_DIGITALBLOCK, bytearray([0x3B]))
|
||||
|
||||
# driver output control
|
||||
self.command(_SSD1675_DRIVER_CONTROL,
|
||||
bytearray([0xFA, 0x01, 0x00]))
|
||||
self.command(_SSD1675_DRIVER_CONTROL, bytearray([0xFA, 0x01, 0x00]))
|
||||
# Data entry sequence
|
||||
self.command(_SSD1675_DATA_MODE, bytearray([0x03]))
|
||||
# Set ram X start/end postion
|
||||
|
|
@ -177,4 +191,4 @@ class Adafruit_SSD1675(Adafruit_EPD):
|
|||
"""Set the RAM address location, not used on this chipset but required by
|
||||
the superclass"""
|
||||
self.command(_SSD1675_SET_RAMXCOUNT, bytearray([x]))
|
||||
self.command(_SSD1675_SET_RAMYCOUNT, bytearray([y, y>>8]))
|
||||
self.command(_SSD1675_SET_RAMYCOUNT, bytearray([y, y >> 8]))
|
||||
|
|
|
|||
|
|
@ -86,17 +86,22 @@ _SSD1675B_SET_RAMYCOUNT = const(0x4F)
|
|||
_SSD1675B_SET_ANALOGBLOCK = const(0x74)
|
||||
_SSD1675B_SET_DIGITALBLOCK = const(0x7E)
|
||||
_SSD1675B_NOP = const(0xFF)
|
||||
_LUT_DATA = b'\xa0\x90P\x00\x00\x00\x00\x00\x00\x00P\x90\xa0\x00\x00\x00\x00\x00\x00\x00\xa0\x90P\x00\x00\x00\x00\x00\x00\x00P\x90\xa0\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0f\x0f\x00\x00\x00\x0f\x0f\x00\x00\x03\x0f\x0f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x15A\xa82P,\x0b' # pylint: disable=line-too-long
|
||||
_LUT_DATA = b"\xa0\x90P\x00\x00\x00\x00\x00\x00\x00P\x90\xa0\x00\x00\x00\x00\x00\x00\x00\xa0\x90P\x00\x00\x00\x00\x00\x00\x00P\x90\xa0\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0f\x0f\x00\x00\x00\x0f\x0f\x00\x00\x03\x0f\x0f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x15A\xa82P,\x0b" # pylint: disable=line-too-long
|
||||
|
||||
|
||||
class Adafruit_SSD1675B(Adafruit_EPD):
|
||||
"""driver class for Adafruit SSD1675B ePaper display breakouts"""
|
||||
|
||||
# pylint: disable=too-many-arguments
|
||||
def __init__(self, width, height, spi, *, cs_pin, dc_pin, sramcs_pin, rst_pin, busy_pin):
|
||||
super(Adafruit_SSD1675B, self).__init__(width, height, spi, cs_pin, dc_pin,
|
||||
sramcs_pin, rst_pin, busy_pin)
|
||||
def __init__(
|
||||
self, width, height, spi, *, cs_pin, dc_pin, sramcs_pin, rst_pin, busy_pin
|
||||
):
|
||||
super(Adafruit_SSD1675B, self).__init__(
|
||||
width, height, spi, cs_pin, dc_pin, sramcs_pin, rst_pin, busy_pin
|
||||
)
|
||||
stride = width
|
||||
if stride % 8 != 0:
|
||||
stride += (8 - stride % 8)
|
||||
stride += 8 - stride % 8
|
||||
|
||||
self._buffer1_size = int(stride * height / 8)
|
||||
self._buffer2_size = self._buffer1_size
|
||||
|
|
@ -109,10 +114,20 @@ class Adafruit_SSD1675B(Adafruit_EPD):
|
|||
self._buffer2 = bytearray(self._buffer2_size)
|
||||
# since we have *two* framebuffers - one for red and one for black
|
||||
# we dont subclass but manage manually
|
||||
self._framebuf1 = adafruit_framebuf.FrameBuffer(self._buffer1, width, height, stride=stride,
|
||||
buf_format=adafruit_framebuf.MHMSB)
|
||||
self._framebuf2 = adafruit_framebuf.FrameBuffer(self._buffer2, width, height, stride=stride,
|
||||
buf_format=adafruit_framebuf.MHMSB)
|
||||
self._framebuf1 = adafruit_framebuf.FrameBuffer(
|
||||
self._buffer1,
|
||||
width,
|
||||
height,
|
||||
stride=stride,
|
||||
buf_format=adafruit_framebuf.MHMSB,
|
||||
)
|
||||
self._framebuf2 = adafruit_framebuf.FrameBuffer(
|
||||
self._buffer2,
|
||||
width,
|
||||
height,
|
||||
stride=stride,
|
||||
buf_format=adafruit_framebuf.MHMSB,
|
||||
)
|
||||
self.set_black_buffer(0, True)
|
||||
self.set_color_buffer(0, True)
|
||||
# pylint: enable=too-many-arguments
|
||||
|
|
@ -146,8 +161,10 @@ class Adafruit_SSD1675B(Adafruit_EPD):
|
|||
# set digital block control
|
||||
self.command(_SSD1675B_SET_DIGITALBLOCK, bytearray([0x3B]))
|
||||
|
||||
self.command(_SSD1675B_DRIVER_CONTROL,
|
||||
bytearray([self._height-1, (self._height-1) >> 8, 0x00]))
|
||||
self.command(
|
||||
_SSD1675B_DRIVER_CONTROL,
|
||||
bytearray([self._height - 1, (self._height - 1) >> 8, 0x00]),
|
||||
)
|
||||
|
||||
# Data entry sequence
|
||||
self.command(_SSD1675B_DATA_MODE, bytearray([0x03]))
|
||||
|
|
@ -155,8 +172,10 @@ class Adafruit_SSD1675B(Adafruit_EPD):
|
|||
# Set ram X start/end postion
|
||||
self.command(_SSD1675B_SET_RAMXPOS, bytearray([0x00, self._width // 8]))
|
||||
# Set ram Y start/end postion
|
||||
self.command(_SSD1675B_SET_RAMYPOS,
|
||||
bytearray([0x0, 0x0, self._height-1, (self._height-1) >> 8]))
|
||||
self.command(
|
||||
_SSD1675B_SET_RAMYPOS,
|
||||
bytearray([0x0, 0x0, self._height - 1, (self._height - 1) >> 8]),
|
||||
)
|
||||
|
||||
# Border color
|
||||
self.command(_SSD1675B_WRITE_BORDER, bytearray([0x03]))
|
||||
|
|
@ -175,12 +194,15 @@ class Adafruit_SSD1675B(Adafruit_EPD):
|
|||
self.command(_SSD1675B_WRITE_LUT, _LUT_DATA[0:100])
|
||||
|
||||
# Set temperature control
|
||||
#self.command(_SSD1675B_TEMP_CONTROL, bytearray([0x80]))
|
||||
# self.command(_SSD1675B_TEMP_CONTROL, bytearray([0x80]))
|
||||
|
||||
# Set RAM X address counter
|
||||
self.command(_SSD1675B_SET_RAMXCOUNT, bytearray([0]))
|
||||
# Set RAM Y address counter
|
||||
self.command(_SSD1675B_SET_RAMYCOUNT, bytearray([self._height-1, (self._height-1) >> 8]))
|
||||
self.command(
|
||||
_SSD1675B_SET_RAMYCOUNT,
|
||||
bytearray([self._height - 1, (self._height - 1) >> 8]),
|
||||
)
|
||||
|
||||
self.busy_wait()
|
||||
|
||||
|
|
@ -211,4 +233,4 @@ class Adafruit_SSD1675B(Adafruit_EPD):
|
|||
"""Set the RAM address location, not used on this chipset but required by
|
||||
the superclass"""
|
||||
self.command(_SSD1675B_SET_RAMXCOUNT, bytearray([x]))
|
||||
self.command(_SSD1675B_SET_RAMYCOUNT, bytearray([y, y>>8]))
|
||||
self.command(_SSD1675B_SET_RAMYCOUNT, bytearray([y, y >> 8]))
|
||||
|
|
|
|||
|
|
@ -85,15 +85,20 @@ _SSD1681_NOP = const(0xFF)
|
|||
|
||||
_LUT_DATA = b'\x02\x02\x01\x11\x12\x12""fiiYX\x99\x99\x88\x00\x00\x00\x00\xf8\xb4\x13Q5QQ\x19\x01\x00' # pylint: disable=line-too-long
|
||||
|
||||
|
||||
class Adafruit_SSD1681(Adafruit_EPD):
|
||||
"""driver class for Adafruit SSD1681 ePaper display breakouts"""
|
||||
|
||||
# pylint: disable=too-many-arguments
|
||||
def __init__(self, width, height, spi, *, cs_pin, dc_pin, sramcs_pin, rst_pin, busy_pin):
|
||||
super(Adafruit_SSD1681, self).__init__(width, height, spi, cs_pin, dc_pin,
|
||||
sramcs_pin, rst_pin, busy_pin)
|
||||
def __init__(
|
||||
self, width, height, spi, *, cs_pin, dc_pin, sramcs_pin, rst_pin, busy_pin
|
||||
):
|
||||
super(Adafruit_SSD1681, self).__init__(
|
||||
width, height, spi, cs_pin, dc_pin, sramcs_pin, rst_pin, busy_pin
|
||||
)
|
||||
|
||||
if height % 8 != 0:
|
||||
height += (8 - height % 8)
|
||||
height += 8 - height % 8
|
||||
self._height = height
|
||||
|
||||
self._buffer1_size = int(width * height / 8)
|
||||
|
|
@ -102,8 +107,9 @@ class Adafruit_SSD1681(Adafruit_EPD):
|
|||
self._buffer1 = self.sram.get_view(0)
|
||||
else:
|
||||
self._buffer1 = bytearray((width * height) // 8)
|
||||
self._framebuf1 = adafruit_framebuf.FrameBuffer(self._buffer1, width, height,
|
||||
buf_format=adafruit_framebuf.MHMSB)
|
||||
self._framebuf1 = adafruit_framebuf.FrameBuffer(
|
||||
self._buffer1, width, height, buf_format=adafruit_framebuf.MHMSB
|
||||
)
|
||||
self.set_black_buffer(0, True)
|
||||
self.set_color_buffer(0, True)
|
||||
# pylint: enable=too-many-arguments
|
||||
|
|
@ -130,15 +136,19 @@ class Adafruit_SSD1681(Adafruit_EPD):
|
|||
self.command(_SSD1681_SW_RESET)
|
||||
self.busy_wait()
|
||||
# driver output control
|
||||
self.command(_SSD1681_DRIVER_CONTROL,
|
||||
bytearray([self._width-1, (self._width-1) >> 8, 0x00]))
|
||||
self.command(
|
||||
_SSD1681_DRIVER_CONTROL,
|
||||
bytearray([self._width - 1, (self._width - 1) >> 8, 0x00]),
|
||||
)
|
||||
# data entry mode
|
||||
self.command(_SSD1681_DATA_MODE, bytearray([0x03]))
|
||||
# Set ram X start/end postion
|
||||
self.command(_SSD1681_SET_RAMXPOS, bytearray([0x00, self._height//8 - 1]))
|
||||
self.command(_SSD1681_SET_RAMXPOS, bytearray([0x00, self._height // 8 - 1]))
|
||||
# Set ram Y start/end postion
|
||||
self.command(_SSD1681_SET_RAMYPOS,
|
||||
bytearray([0, 0, self._height - 1, (self._height - 1) >> 8]))
|
||||
self.command(
|
||||
_SSD1681_SET_RAMYPOS,
|
||||
bytearray([0, 0, self._height - 1, (self._height - 1) >> 8]),
|
||||
)
|
||||
# Set border waveform
|
||||
self.command(_SSD1681_WRITE_BORDER, bytearray([0x05]))
|
||||
# Set temperature control
|
||||
|
|
@ -173,4 +183,4 @@ class Adafruit_SSD1681(Adafruit_EPD):
|
|||
# Set RAM X address counter
|
||||
self.command(_SSD1681_SET_RAMXCOUNT, bytearray([x]))
|
||||
# Set RAM Y address counter
|
||||
self.command(_SSD1681_SET_RAMYCOUNT, bytearray([y>>8, y]))
|
||||
self.command(_SSD1681_SET_RAMYCOUNT, bytearray([y >> 8, y]))
|
||||
|
|
|
|||
96
docs/conf.py
96
docs/conf.py
|
|
@ -2,7 +2,8 @@
|
|||
|
||||
import os
|
||||
import sys
|
||||
sys.path.insert(0, os.path.abspath('..'))
|
||||
|
||||
sys.path.insert(0, os.path.abspath(".."))
|
||||
|
||||
# -- General configuration ------------------------------------------------
|
||||
|
||||
|
|
@ -10,10 +11,10 @@ sys.path.insert(0, os.path.abspath('..'))
|
|||
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
|
||||
# ones.
|
||||
extensions = [
|
||||
'sphinx.ext.autodoc',
|
||||
'sphinx.ext.intersphinx',
|
||||
'sphinx.ext.napoleon',
|
||||
'sphinx.ext.todo',
|
||||
"sphinx.ext.autodoc",
|
||||
"sphinx.ext.intersphinx",
|
||||
"sphinx.ext.napoleon",
|
||||
"sphinx.ext.todo",
|
||||
]
|
||||
|
||||
# Uncomment the below if you use native CircuitPython modules such as
|
||||
|
|
@ -22,29 +23,40 @@ extensions = [
|
|||
# autodoc_mock_imports = ["digitalio", "busio", "micropython"]
|
||||
|
||||
|
||||
intersphinx_mapping = {'python': ('https://docs.python.org/3.4', None),'BusDevice': ('https://circuitpython.readthedocs.io/projects/busdevice/en/latest/', None),'Register': ('https://circuitpython.readthedocs.io/projects/register/en/latest/', None),'CircuitPython': ('https://circuitpython.readthedocs.io/en/latest/', None)}
|
||||
intersphinx_mapping = {
|
||||
"python": ("https://docs.python.org/3.4", None),
|
||||
"BusDevice": (
|
||||
"https://circuitpython.readthedocs.io/projects/busdevice/en/latest/",
|
||||
None,
|
||||
),
|
||||
"Register": (
|
||||
"https://circuitpython.readthedocs.io/projects/register/en/latest/",
|
||||
None,
|
||||
),
|
||||
"CircuitPython": ("https://circuitpython.readthedocs.io/en/latest/", None),
|
||||
}
|
||||
|
||||
# Add any paths that contain templates here, relative to this directory.
|
||||
templates_path = ['_templates']
|
||||
templates_path = ["_templates"]
|
||||
|
||||
source_suffix = '.rst'
|
||||
source_suffix = ".rst"
|
||||
|
||||
# The master toctree document.
|
||||
master_doc = 'index'
|
||||
master_doc = "index"
|
||||
|
||||
# General information about the project.
|
||||
project = u'Adafruit EPD Library'
|
||||
copyright = u'2018 Dean Miller'
|
||||
author = u'Dean Miller'
|
||||
project = u"Adafruit EPD Library"
|
||||
copyright = u"2018 Dean Miller"
|
||||
author = u"Dean Miller"
|
||||
|
||||
# The version info for the project you're documenting, acts as replacement for
|
||||
# |version| and |release|, also used in various other places throughout the
|
||||
# built documents.
|
||||
#
|
||||
# The short X.Y version.
|
||||
version = u'1.0'
|
||||
version = u"1.0"
|
||||
# The full version, including alpha/beta/rc tags.
|
||||
release = u'1.0'
|
||||
release = u"1.0"
|
||||
|
||||
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||
# for a list of supported languages.
|
||||
|
|
@ -56,7 +68,7 @@ language = None
|
|||
# List of patterns, relative to source directory, that match files and
|
||||
# directories to ignore when looking for source files.
|
||||
# This patterns also effect to html_static_path and html_extra_path
|
||||
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store', '.env', 'CODE_OF_CONDUCT.md']
|
||||
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store", ".env", "CODE_OF_CONDUCT.md"]
|
||||
|
||||
# The reST default role (used for this markup: `text`) to use for all
|
||||
# documents.
|
||||
|
|
@ -68,7 +80,7 @@ default_role = "any"
|
|||
add_function_parentheses = True
|
||||
|
||||
# The name of the Pygments (syntax highlighting) style to use.
|
||||
pygments_style = 'sphinx'
|
||||
pygments_style = "sphinx"
|
||||
|
||||
# If true, `todo` and `todoList` produce output, else they produce nothing.
|
||||
todo_include_todos = False
|
||||
|
|
@ -83,32 +95,33 @@ napoleon_numpy_docstring = False
|
|||
# The theme to use for HTML and HTML Help pages. See the documentation for
|
||||
# a list of builtin themes.
|
||||
#
|
||||
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
|
||||
on_rtd = os.environ.get("READTHEDOCS", None) == "True"
|
||||
|
||||
if not on_rtd: # only import and set the theme if we're building docs locally
|
||||
try:
|
||||
import sphinx_rtd_theme
|
||||
html_theme = 'sphinx_rtd_theme'
|
||||
html_theme_path = [sphinx_rtd_theme.get_html_theme_path(), '.']
|
||||
|
||||
html_theme = "sphinx_rtd_theme"
|
||||
html_theme_path = [sphinx_rtd_theme.get_html_theme_path(), "."]
|
||||
except:
|
||||
html_theme = 'default'
|
||||
html_theme_path = ['.']
|
||||
html_theme = "default"
|
||||
html_theme_path = ["."]
|
||||
else:
|
||||
html_theme_path = ['.']
|
||||
html_theme_path = ["."]
|
||||
|
||||
# Add any paths that contain custom static files (such as style sheets) here,
|
||||
# relative to this directory. They are copied after the builtin static files,
|
||||
# so a file named "default.css" will overwrite the builtin "default.css".
|
||||
html_static_path = ['_static']
|
||||
html_static_path = ["_static"]
|
||||
|
||||
# The name of an image file (relative to this directory) to use as a favicon of
|
||||
# the docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
|
||||
# pixels large.
|
||||
#
|
||||
html_favicon = '_static/favicon.ico'
|
||||
html_favicon = "_static/favicon.ico"
|
||||
|
||||
# Output file base name for HTML help builder.
|
||||
htmlhelp_basename = 'AdafruitEpdLibrarydoc'
|
||||
htmlhelp_basename = "AdafruitEpdLibrarydoc"
|
||||
|
||||
# -- Options for LaTeX output ---------------------------------------------
|
||||
|
||||
|
|
@ -116,15 +129,12 @@ latex_elements = {
|
|||
# The paper size ('letterpaper' or 'a4paper').
|
||||
#
|
||||
# 'papersize': 'letterpaper',
|
||||
|
||||
# The font size ('10pt', '11pt' or '12pt').
|
||||
#
|
||||
# 'pointsize': '10pt',
|
||||
|
||||
# Additional stuff for the LaTeX preamble.
|
||||
#
|
||||
# 'preamble': '',
|
||||
|
||||
# Latex figure (float) alignment
|
||||
#
|
||||
# 'figure_align': 'htbp',
|
||||
|
|
@ -134,8 +144,13 @@ latex_elements = {
|
|||
# (source start file, target name, title,
|
||||
# author, documentclass [howto, manual, or own class]).
|
||||
latex_documents = [
|
||||
(master_doc, 'AdafruitEPDLibrary.tex', u'AdafruitEPD Library Documentation',
|
||||
author, 'manual'),
|
||||
(
|
||||
master_doc,
|
||||
"AdafruitEPDLibrary.tex",
|
||||
u"AdafruitEPD Library Documentation",
|
||||
author,
|
||||
"manual",
|
||||
),
|
||||
]
|
||||
|
||||
# -- Options for manual page output ---------------------------------------
|
||||
|
|
@ -143,8 +158,13 @@ latex_documents = [
|
|||
# One entry per manual page. List of tuples
|
||||
# (source start file, name, description, authors, manual section).
|
||||
man_pages = [
|
||||
(master_doc, 'AdafruitEPDlibrary', u'Adafruit EPD Library Documentation',
|
||||
[author], 1)
|
||||
(
|
||||
master_doc,
|
||||
"AdafruitEPDlibrary",
|
||||
u"Adafruit EPD Library Documentation",
|
||||
[author],
|
||||
1,
|
||||
)
|
||||
]
|
||||
|
||||
# -- Options for Texinfo output -------------------------------------------
|
||||
|
|
@ -153,7 +173,13 @@ man_pages = [
|
|||
# (source start file, target name, title, author,
|
||||
# dir menu entry, description, category)
|
||||
texinfo_documents = [
|
||||
(master_doc, 'AdafruitEPDLibrary', u'Adafruit EPD Library Documentation',
|
||||
author, 'AdafruitEPDLibrary', 'One line description of project.',
|
||||
'Miscellaneous'),
|
||||
(
|
||||
master_doc,
|
||||
"AdafruitEPDLibrary",
|
||||
u"Adafruit EPD Library Documentation",
|
||||
author,
|
||||
"AdafruitEPDLibrary",
|
||||
"One line description of project.",
|
||||
"Miscellaneous",
|
||||
),
|
||||
]
|
||||
|
|
|
|||
|
|
@ -19,24 +19,32 @@ busy = digitalio.DigitalInOut(board.D12) # can be None to not use this pin
|
|||
|
||||
# give them all to our driver
|
||||
print("Creating display")
|
||||
#display = Adafruit_SSD1608(200, 200, spi, # 1.54" HD mono display
|
||||
#display = Adafruit_SSD1675(122, 250, spi, # 2.13" HD mono display
|
||||
#display = Adafruit_IL91874(176, 264, spi, # 2.7" Tri-color display
|
||||
#display = Adafruit_IL0373(152, 152, spi, # 1.54" Tri-color display
|
||||
#display = Adafruit_IL0373(128, 296, spi, # 2.9" Tri-color display
|
||||
#display = Adafruit_IL0398(400, 300, spi, # 4.2" Tri-color display
|
||||
display = Adafruit_IL0373(104, 212, spi, # 2.13" Tri-color display
|
||||
cs_pin=ecs, dc_pin=dc, sramcs_pin=srcs,
|
||||
rst_pin=rst, busy_pin=busy)
|
||||
# display = Adafruit_SSD1608(200, 200, spi, # 1.54" HD mono display
|
||||
# display = Adafruit_SSD1675(122, 250, spi, # 2.13" HD mono display
|
||||
# display = Adafruit_IL91874(176, 264, spi, # 2.7" Tri-color display
|
||||
# display = Adafruit_IL0373(152, 152, spi, # 1.54" Tri-color display
|
||||
# display = Adafruit_IL0373(128, 296, spi, # 2.9" Tri-color display
|
||||
# display = Adafruit_IL0398(400, 300, spi, # 4.2" Tri-color display
|
||||
display = Adafruit_IL0373(
|
||||
104,
|
||||
212,
|
||||
spi, # 2.13" Tri-color display
|
||||
cs_pin=ecs,
|
||||
dc_pin=dc,
|
||||
sramcs_pin=srcs,
|
||||
rst_pin=rst,
|
||||
busy_pin=busy,
|
||||
)
|
||||
|
||||
# IF YOU HAVE A FLEXIBLE DISPLAY (2.13" or 2.9") uncomment these lines!
|
||||
#display.set_black_buffer(1, False)
|
||||
#display.set_color_buffer(1, False)
|
||||
# display.set_black_buffer(1, False)
|
||||
# display.set_color_buffer(1, False)
|
||||
|
||||
display.rotation = 0
|
||||
|
||||
FILENAME = "blinka154mono.bmp"
|
||||
|
||||
|
||||
def read_le(s):
|
||||
# as of this writting, int.from_bytes does not have LE support, DIY!
|
||||
result = 0
|
||||
|
|
@ -46,9 +54,11 @@ def read_le(s):
|
|||
shift += 8
|
||||
return result
|
||||
|
||||
|
||||
class BMPError(Exception):
|
||||
pass
|
||||
|
||||
|
||||
def display_bitmap(epd, filename): # pylint: disable=too-many-locals, too-many-branches
|
||||
try:
|
||||
f = open("/" + filename, "rb")
|
||||
|
|
@ -58,7 +68,7 @@ def display_bitmap(epd, filename): # pylint: disable=too-many-locals, too-many-b
|
|||
|
||||
print("File opened")
|
||||
try:
|
||||
if f.read(2) != b'BM': # check signature
|
||||
if f.read(2) != b"BM": # check signature
|
||||
raise BMPError("Not BitMap file")
|
||||
|
||||
bmpFileSize = read_le(f.read(4))
|
||||
|
|
@ -70,8 +80,10 @@ def display_bitmap(epd, filename): # pylint: disable=too-many-locals, too-many-b
|
|||
bmpHeight = read_le(f.read(4))
|
||||
flip = True
|
||||
|
||||
print("Size: %d\nImage offset: %d\nHeader size: %d" %
|
||||
(bmpFileSize, bmpImageoffset, headerSize))
|
||||
print(
|
||||
"Size: %d\nImage offset: %d\nHeader size: %d"
|
||||
% (bmpFileSize, bmpImageoffset, headerSize)
|
||||
)
|
||||
print("Width: %d\nHeight: %d" % (bmpWidth, bmpHeight))
|
||||
|
||||
if read_le(f.read(2)) != 1:
|
||||
|
|
@ -95,13 +107,13 @@ def display_bitmap(epd, filename): # pylint: disable=too-many-locals, too-many-b
|
|||
|
||||
# print ("seek to %d" % pos)
|
||||
f.seek(pos)
|
||||
rowdata = f.read(3*bmpWidth)
|
||||
rowdata = f.read(3 * bmpWidth)
|
||||
for col in range(bmpWidth):
|
||||
b, g, r = rowdata[3*col:3*col+3] # BMP files store RGB in BGR
|
||||
b, g, r = rowdata[3 * col : 3 * col + 3] # BMP files store RGB in BGR
|
||||
if r < 0x80 and g < 0x80 and b < 0x80:
|
||||
epd.pixel(col, row, Adafruit_EPD.BLACK)
|
||||
elif r >= 0x80 and g >= 0x80 and b >= 0x80:
|
||||
pass #epd.pixel(row, col, Adafruit_EPD.WHITE)
|
||||
pass # epd.pixel(row, col, Adafruit_EPD.WHITE)
|
||||
elif r >= 0x80:
|
||||
epd.pixel(col, row, Adafruit_EPD.RED)
|
||||
except OSError:
|
||||
|
|
@ -112,6 +124,7 @@ def display_bitmap(epd, filename): # pylint: disable=too-many-locals, too-many-b
|
|||
f.close()
|
||||
print("Finished drawing")
|
||||
|
||||
|
||||
# clear the buffer
|
||||
display.fill(Adafruit_EPD.WHITE)
|
||||
display_bitmap(display, FILENAME)
|
||||
|
|
|
|||
|
|
@ -26,27 +26,33 @@ rst = digitalio.DigitalInOut(board.D6) # can be None to not use this pin
|
|||
busy = digitalio.DigitalInOut(board.D7) # can be None to not use this pin
|
||||
|
||||
|
||||
|
||||
# give them all to our driver
|
||||
print("Creating display")
|
||||
#display = Adafruit_SSD1608(200, 200, spi, # 1.54" HD mono display
|
||||
#display = Adafruit_SSD1681(200, 200, spi, # 1.54" HD mono display (alt)
|
||||
#display = Adafruit_SSD1675(122, 250, spi, # 2.13" HD mono display
|
||||
#display = Adafruit_IL91874(176, 264, spi, # 2.7" Tri-color display
|
||||
#display = Adafruit_IL0373(152, 152, spi, # 1.54" Tri-color display
|
||||
#display = Adafruit_IL0373(128, 296, spi, # 2.9" Tri-color display
|
||||
#display = Adafruit_IL0398(400, 300, spi, # 4.2" Tri-color display
|
||||
#display = Adafruit_IL0373(104, 212, spi, # 2.13" Tri-color display
|
||||
display = Adafruit_SSD1675B(122, 250, spi, # 2.13" HD mono display (rev B)
|
||||
cs_pin=ecs, dc_pin=dc, sramcs_pin=srcs,
|
||||
rst_pin=rst, busy_pin=busy)
|
||||
# display = Adafruit_SSD1608(200, 200, spi, # 1.54" HD mono display
|
||||
# display = Adafruit_SSD1681(200, 200, spi, # 1.54" HD mono display (alt)
|
||||
# display = Adafruit_SSD1675(122, 250, spi, # 2.13" HD mono display
|
||||
# display = Adafruit_IL91874(176, 264, spi, # 2.7" Tri-color display
|
||||
# display = Adafruit_IL0373(152, 152, spi, # 1.54" Tri-color display
|
||||
# display = Adafruit_IL0373(128, 296, spi, # 2.9" Tri-color display
|
||||
# display = Adafruit_IL0398(400, 300, spi, # 4.2" Tri-color display
|
||||
# display = Adafruit_IL0373(104, 212, spi, # 2.13" Tri-color display
|
||||
display = Adafruit_SSD1675B(
|
||||
122,
|
||||
250,
|
||||
spi, # 2.13" HD mono display (rev B)
|
||||
cs_pin=ecs,
|
||||
dc_pin=dc,
|
||||
sramcs_pin=srcs,
|
||||
rst_pin=rst,
|
||||
busy_pin=busy,
|
||||
)
|
||||
|
||||
display.rotation = 3
|
||||
# Create blank image for drawing.
|
||||
# Make sure to create image with mode '1' for 1-bit color.
|
||||
width = display.width
|
||||
height = display.height
|
||||
image = Image.new('RGB', (width, height))
|
||||
image = Image.new("RGB", (width, height))
|
||||
|
||||
WHITE = (0xFF, 0xFF, 0xFF)
|
||||
RED = (0xFF, 0x00, 0x00)
|
||||
|
|
@ -61,42 +67,45 @@ draw = ImageDraw.Draw(image)
|
|||
draw.rectangle((0, 0, width, height), fill=WHITE)
|
||||
|
||||
# Draw an outline box
|
||||
draw.rectangle((1, 1, width-2, height-2), outline=BLACK, fill=WHITE)
|
||||
draw.rectangle((1, 1, width - 2, height - 2), outline=BLACK, fill=WHITE)
|
||||
|
||||
# Draw some shapes.
|
||||
# First define some constants to allow easy resizing of shapes.
|
||||
padding = 5
|
||||
shape_width = 30
|
||||
top = padding
|
||||
bottom = height-padding
|
||||
bottom = height - padding
|
||||
# Move left to right keeping track of the current x position for drawing shapes.
|
||||
x = padding
|
||||
# Draw an ellipse.
|
||||
draw.ellipse((x, top , x+shape_width, bottom), outline=RED, fill=WHITE)
|
||||
x += shape_width+padding
|
||||
draw.ellipse((x, top, x + shape_width, bottom), outline=RED, fill=WHITE)
|
||||
x += shape_width + padding
|
||||
# Draw a rectangle.
|
||||
draw.rectangle((x, top, x+shape_width, bottom), outline=RED, fill=BLACK)
|
||||
x += shape_width+padding
|
||||
draw.rectangle((x, top, x + shape_width, bottom), outline=RED, fill=BLACK)
|
||||
x += shape_width + padding
|
||||
# Draw a triangle.
|
||||
draw.polygon([(x, bottom), (x+shape_width/2, top), (x+shape_width, bottom)],
|
||||
outline=BLACK, fill=RED)
|
||||
x += shape_width+padding
|
||||
draw.polygon(
|
||||
[(x, bottom), (x + shape_width / 2, top), (x + shape_width, bottom)],
|
||||
outline=BLACK,
|
||||
fill=RED,
|
||||
)
|
||||
x += shape_width + padding
|
||||
# Draw an X.
|
||||
draw.line((x, bottom, x+shape_width, top), fill=RED)
|
||||
draw.line((x, top, x+shape_width, bottom), fill=RED)
|
||||
x += shape_width+padding
|
||||
draw.line((x, bottom, x + shape_width, top), fill=RED)
|
||||
draw.line((x, top, x + shape_width, bottom), fill=RED)
|
||||
x += shape_width + padding
|
||||
|
||||
# Load default font.
|
||||
font = ImageFont.truetype('/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf', 20)
|
||||
font = ImageFont.truetype("/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf", 20)
|
||||
|
||||
# Alternatively load a TTF font. Make sure the .ttf font
|
||||
# file is in the same directory as the python script!
|
||||
# Some other nice fonts to try: http://www.dafont.com/bitmap.php
|
||||
#font = ImageFont.truetype('Minecraftia.ttf', 8)
|
||||
# font = ImageFont.truetype('Minecraftia.ttf', 8)
|
||||
|
||||
# Write two lines of text.
|
||||
draw.text((x, top), 'Hello', font=font, fill=RED)
|
||||
draw.text((x, top+20), 'World!', font=font, fill=RED)
|
||||
draw.text((x, top), "Hello", font=font, fill=RED)
|
||||
draw.text((x, top + 20), "World!", font=font, fill=RED)
|
||||
|
||||
# Display image.
|
||||
display.image(image)
|
||||
|
|
|
|||
|
|
@ -23,16 +23,23 @@ rst = DigitalInOut(board.D27)
|
|||
busy = DigitalInOut(board.D17)
|
||||
|
||||
# give them all to our driver
|
||||
display = Adafruit_SSD1675B(122, 250, spi, # 2.13" HD mono display (rev B)
|
||||
cs_pin=ecs, dc_pin=dc, sramcs_pin=None,
|
||||
rst_pin=rst, busy_pin=busy)
|
||||
display = Adafruit_SSD1675B(
|
||||
122,
|
||||
250,
|
||||
spi, # 2.13" HD mono display (rev B)
|
||||
cs_pin=ecs,
|
||||
dc_pin=dc,
|
||||
sramcs_pin=None,
|
||||
rst_pin=rst,
|
||||
busy_pin=busy,
|
||||
)
|
||||
display.rotation = 1
|
||||
|
||||
# Create blank image for drawing.
|
||||
# Make sure to create image with mode '1' for 1-bit color.
|
||||
width = display.width
|
||||
height = display.height
|
||||
image = Image.new('RGB', (width, height))
|
||||
image = Image.new("RGB", (width, height))
|
||||
|
||||
WHITE = (0xFF, 0xFF, 0xFF)
|
||||
BLACK = (0x00, 0x00, 0x00)
|
||||
|
|
@ -48,41 +55,44 @@ draw = ImageDraw.Draw(image)
|
|||
draw.rectangle((0, 0, width, height), fill=WHITE)
|
||||
|
||||
# Draw an outline box
|
||||
draw.rectangle((1, 1, width-2, height-2), outline=BLACK, fill=WHITE)
|
||||
draw.rectangle((1, 1, width - 2, height - 2), outline=BLACK, fill=WHITE)
|
||||
# Draw some shapes.
|
||||
# First define some constants to allow easy resizing of shapes.
|
||||
padding = 5
|
||||
shape_width = 30
|
||||
top = padding
|
||||
bottom = height-padding
|
||||
bottom = height - padding
|
||||
# Move left to right keeping track of the current x position for drawing shapes.
|
||||
x = padding
|
||||
# Draw an ellipse.
|
||||
draw.ellipse((x, top , x+shape_width, bottom), outline=BLACK, fill=WHITE)
|
||||
x += shape_width+padding
|
||||
draw.ellipse((x, top, x + shape_width, bottom), outline=BLACK, fill=WHITE)
|
||||
x += shape_width + padding
|
||||
# Draw a rectangle.
|
||||
draw.rectangle((x, top, x+shape_width, bottom), outline=WHITE, fill=BLACK)
|
||||
x += shape_width+padding
|
||||
draw.rectangle((x, top, x + shape_width, bottom), outline=WHITE, fill=BLACK)
|
||||
x += shape_width + padding
|
||||
# Draw a triangle.
|
||||
draw.polygon([(x, bottom), (x+shape_width/2, top), (x+shape_width, bottom)],
|
||||
outline=BLACK, fill=WHITE)
|
||||
x += shape_width+padding
|
||||
draw.polygon(
|
||||
[(x, bottom), (x + shape_width / 2, top), (x + shape_width, bottom)],
|
||||
outline=BLACK,
|
||||
fill=WHITE,
|
||||
)
|
||||
x += shape_width + padding
|
||||
# Draw an X.
|
||||
draw.line((x, bottom, x+shape_width, top), fill=BLACK)
|
||||
draw.line((x, top, x+shape_width, bottom), fill=BLACK)
|
||||
x += shape_width+padding
|
||||
draw.line((x, bottom, x + shape_width, top), fill=BLACK)
|
||||
draw.line((x, top, x + shape_width, bottom), fill=BLACK)
|
||||
x += shape_width + padding
|
||||
|
||||
# Load default font.
|
||||
font = ImageFont.truetype('/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf', 20)
|
||||
font = ImageFont.truetype("/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf", 20)
|
||||
|
||||
# Alternatively load a TTF font. Make sure the .ttf font
|
||||
# file is in the same directory as the python script!
|
||||
# Some other nice fonts to try: http://www.dafont.com/bitmap.php
|
||||
#font = ImageFont.truetype('Minecraftia.ttf', 8)
|
||||
# font = ImageFont.truetype('Minecraftia.ttf', 8)
|
||||
|
||||
# Write two lines of text.
|
||||
draw.text((x, top), 'Hello', font=font, fill=BLACK)
|
||||
draw.text((x, top+20), 'World!', font=font, fill=BLACK)
|
||||
draw.text((x, top), "Hello", font=font, fill=BLACK)
|
||||
draw.text((x, top + 20), "World!", font=font, fill=BLACK)
|
||||
|
||||
while True:
|
||||
if not switch1.value:
|
||||
|
|
|
|||
|
|
@ -35,23 +35,30 @@ rst = digitalio.DigitalInOut(board.D27)
|
|||
busy = digitalio.DigitalInOut(board.D17)
|
||||
|
||||
# give them all to our driver
|
||||
#display = Adafruit_SSD1608(200, 200, spi, # 1.54" HD mono display
|
||||
#display = Adafruit_SSD1675(122, 250, spi, # 2.13" HD mono display
|
||||
#display = Adafruit_IL91874(176, 264, spi, # 2.7" Tri-color display
|
||||
#display = Adafruit_IL0373(152, 152, spi, # 1.54" Tri-color display
|
||||
#display = Adafruit_IL0373(128, 296, spi, # 2.9" Tri-color display
|
||||
#display = Adafruit_IL0398(400, 300, spi, # 4.2" Tri-color display
|
||||
display = Adafruit_IL0373(104, 212, spi, # 2.13" Tri-color display
|
||||
cs_pin=ecs, dc_pin=dc, sramcs_pin=srcs,
|
||||
rst_pin=rst, busy_pin=busy)
|
||||
# display = Adafruit_SSD1608(200, 200, spi, # 1.54" HD mono display
|
||||
# display = Adafruit_SSD1675(122, 250, spi, # 2.13" HD mono display
|
||||
# display = Adafruit_IL91874(176, 264, spi, # 2.7" Tri-color display
|
||||
# display = Adafruit_IL0373(152, 152, spi, # 1.54" Tri-color display
|
||||
# display = Adafruit_IL0373(128, 296, spi, # 2.9" Tri-color display
|
||||
# display = Adafruit_IL0398(400, 300, spi, # 4.2" Tri-color display
|
||||
display = Adafruit_IL0373(
|
||||
104,
|
||||
212,
|
||||
spi, # 2.13" Tri-color display
|
||||
cs_pin=ecs,
|
||||
dc_pin=dc,
|
||||
sramcs_pin=srcs,
|
||||
rst_pin=rst,
|
||||
busy_pin=busy,
|
||||
)
|
||||
|
||||
# IF YOU HAVE A FLEXIBLE DISPLAY (2.13" or 2.9") uncomment these lines!
|
||||
#display.set_black_buffer(1, False)
|
||||
#display.set_color_buffer(1, False)
|
||||
# display.set_black_buffer(1, False)
|
||||
# display.set_color_buffer(1, False)
|
||||
|
||||
display.rotation = 1
|
||||
|
||||
image = Image.new('RGB', (display.width, display.height))
|
||||
image = Image.new("RGB", (display.width, display.height))
|
||||
|
||||
# Get drawing object to draw on image.
|
||||
draw = ImageDraw.Draw(image)
|
||||
|
|
@ -60,17 +67,23 @@ draw = ImageDraw.Draw(image)
|
|||
draw.rectangle((0, 0, display.width, display.height), fill=BACKGROUND_COLOR)
|
||||
|
||||
# Draw a smaller inner foreground rectangle
|
||||
draw.rectangle((BORDER, BORDER, display.width - BORDER - 1, display.height - BORDER - 1),
|
||||
fill=FOREGROUND_COLOR)
|
||||
draw.rectangle(
|
||||
(BORDER, BORDER, display.width - BORDER - 1, display.height - BORDER - 1),
|
||||
fill=FOREGROUND_COLOR,
|
||||
)
|
||||
|
||||
# Load a TTF Font
|
||||
font = ImageFont.truetype('/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf', FONTSIZE)
|
||||
font = ImageFont.truetype("/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf", FONTSIZE)
|
||||
|
||||
# Draw Some Text
|
||||
text = "Hello World!"
|
||||
(font_width, font_height) = font.getsize(text)
|
||||
draw.text((display.width//2 - font_width//2, display.height//2 - font_height//2),
|
||||
text, font=font, fill=TEXT_COLOR)
|
||||
draw.text(
|
||||
(display.width // 2 - font_width // 2, display.height // 2 - font_height // 2),
|
||||
text,
|
||||
font=font,
|
||||
fill=TEXT_COLOR,
|
||||
)
|
||||
|
||||
# Display image.
|
||||
display.image(image)
|
||||
|
|
|
|||
|
|
@ -26,19 +26,26 @@ rst = digitalio.DigitalInOut(board.D27)
|
|||
busy = digitalio.DigitalInOut(board.D17)
|
||||
|
||||
# give them all to our driver
|
||||
#display = Adafruit_SSD1608(200, 200, spi, # 1.54" HD mono display
|
||||
#display = Adafruit_SSD1675(122, 250, spi, # 2.13" HD mono display
|
||||
#display = Adafruit_IL91874(176, 264, spi, # 2.7" Tri-color display
|
||||
#display = Adafruit_IL0373(152, 152, spi, # 1.54" Tri-color display
|
||||
#display = Adafruit_IL0373(128, 296, spi, # 2.9" Tri-color display
|
||||
#display = Adafruit_IL0398(400, 300, spi, # 4.2" Tri-color display
|
||||
display = Adafruit_IL0373(104, 212, spi, # 2.13" Tri-color display
|
||||
cs_pin=ecs, dc_pin=dc, sramcs_pin=srcs,
|
||||
rst_pin=rst, busy_pin=busy)
|
||||
# display = Adafruit_SSD1608(200, 200, spi, # 1.54" HD mono display
|
||||
# display = Adafruit_SSD1675(122, 250, spi, # 2.13" HD mono display
|
||||
# display = Adafruit_IL91874(176, 264, spi, # 2.7" Tri-color display
|
||||
# display = Adafruit_IL0373(152, 152, spi, # 1.54" Tri-color display
|
||||
# display = Adafruit_IL0373(128, 296, spi, # 2.9" Tri-color display
|
||||
# display = Adafruit_IL0398(400, 300, spi, # 4.2" Tri-color display
|
||||
display = Adafruit_IL0373(
|
||||
104,
|
||||
212,
|
||||
spi, # 2.13" Tri-color display
|
||||
cs_pin=ecs,
|
||||
dc_pin=dc,
|
||||
sramcs_pin=srcs,
|
||||
rst_pin=rst,
|
||||
busy_pin=busy,
|
||||
)
|
||||
|
||||
# IF YOU HAVE A FLEXIBLE DISPLAY (2.13" or 2.9") uncomment these lines!
|
||||
#display.set_black_buffer(1, False)
|
||||
#display.set_color_buffer(1, False)
|
||||
# display.set_black_buffer(1, False)
|
||||
# display.set_color_buffer(1, False)
|
||||
|
||||
display.rotation = 1
|
||||
|
||||
|
|
|
|||
|
|
@ -15,12 +15,20 @@ srcs = digitalio.DigitalInOut(board.D8) # can be None to use internal memory
|
|||
|
||||
# give them all to our driver
|
||||
print("Creating display")
|
||||
display = Adafruit_IL91874(176, 264, spi, # 2.7" Tri-color display
|
||||
cs_pin=ecs, dc_pin=dc, sramcs_pin=srcs,
|
||||
rst_pin=None, busy_pin=None)
|
||||
display = Adafruit_IL91874(
|
||||
176,
|
||||
264,
|
||||
spi, # 2.7" Tri-color display
|
||||
cs_pin=ecs,
|
||||
dc_pin=dc,
|
||||
sramcs_pin=srcs,
|
||||
rst_pin=None,
|
||||
busy_pin=None,
|
||||
)
|
||||
|
||||
display.rotation = 1
|
||||
|
||||
|
||||
def read_buttons():
|
||||
with AnalogIn(board.A3) as ain:
|
||||
reading = ain.value / 65535
|
||||
|
|
@ -34,6 +42,7 @@ def read_buttons():
|
|||
return 2
|
||||
return 1
|
||||
|
||||
|
||||
while True:
|
||||
button = read_buttons()
|
||||
if not button:
|
||||
|
|
@ -50,11 +59,11 @@ while True:
|
|||
display.display()
|
||||
if button == 3:
|
||||
print("Draw lines")
|
||||
display.line(0, 0, display.width-1, display.height-1, Adafruit_EPD.BLACK)
|
||||
display.line(0, display.height-1, display.width-1, 0, Adafruit_EPD.RED)
|
||||
display.line(0, 0, display.width - 1, display.height - 1, Adafruit_EPD.BLACK)
|
||||
display.line(0, display.height - 1, display.width - 1, 0, Adafruit_EPD.RED)
|
||||
display.display()
|
||||
if button == 4:
|
||||
print("Draw text")
|
||||
display.text('hello world', 25, 10, Adafruit_EPD.BLACK)
|
||||
display.text("hello world", 25, 10, Adafruit_EPD.BLACK)
|
||||
display.display()
|
||||
time.sleep(0.01)
|
||||
|
|
|
|||
|
|
@ -18,19 +18,26 @@ busy = digitalio.DigitalInOut(board.D5) # can be None to not use this pin
|
|||
|
||||
# give them all to our driver
|
||||
print("Creating display")
|
||||
#display = Adafruit_SSD1608(200, 200, spi, # 1.54" HD mono display
|
||||
#display = Adafruit_SSD1675(122, 250, spi, # 2.13" HD mono display
|
||||
#display = Adafruit_IL91874(176, 264, spi, # 2.7" Tri-color display
|
||||
#display = Adafruit_IL0373(152, 152, spi, # 1.54" Tri-color display
|
||||
#display = Adafruit_IL0373(128, 296, spi, # 2.9" Tri-color display
|
||||
#display = Adafruit_IL0398(400, 300, spi, # 4.2" Tri-color display
|
||||
display = Adafruit_IL0373(104, 212, spi, # 2.13" Tri-color display
|
||||
cs_pin=ecs, dc_pin=dc, sramcs_pin=srcs,
|
||||
rst_pin=rst, busy_pin=busy)
|
||||
# display = Adafruit_SSD1608(200, 200, spi, # 1.54" HD mono display
|
||||
# display = Adafruit_SSD1675(122, 250, spi, # 2.13" HD mono display
|
||||
# display = Adafruit_IL91874(176, 264, spi, # 2.7" Tri-color display
|
||||
# display = Adafruit_IL0373(152, 152, spi, # 1.54" Tri-color display
|
||||
# display = Adafruit_IL0373(128, 296, spi, # 2.9" Tri-color display
|
||||
# display = Adafruit_IL0398(400, 300, spi, # 4.2" Tri-color display
|
||||
display = Adafruit_IL0373(
|
||||
104,
|
||||
212,
|
||||
spi, # 2.13" Tri-color display
|
||||
cs_pin=ecs,
|
||||
dc_pin=dc,
|
||||
sramcs_pin=srcs,
|
||||
rst_pin=rst,
|
||||
busy_pin=busy,
|
||||
)
|
||||
|
||||
# IF YOU HAVE A FLEXIBLE DISPLAY (2.13" or 2.9") uncomment these lines!
|
||||
#display.set_black_buffer(1, False)
|
||||
#display.set_color_buffer(1, False)
|
||||
# display.set_black_buffer(1, False)
|
||||
# display.set_color_buffer(1, False)
|
||||
|
||||
display.rotation = 1
|
||||
|
||||
|
|
@ -44,9 +51,9 @@ display.fill_rect(5, 5, 10, 10, Adafruit_EPD.RED)
|
|||
display.rect(0, 0, 20, 30, Adafruit_EPD.BLACK)
|
||||
|
||||
print("Draw lines")
|
||||
display.line(0, 0, display.width-1, display.height-1, Adafruit_EPD.BLACK)
|
||||
display.line(0, display.height-1, display.width-1, 0, Adafruit_EPD.RED)
|
||||
display.line(0, 0, display.width - 1, display.height - 1, Adafruit_EPD.BLACK)
|
||||
display.line(0, display.height - 1, display.width - 1, 0, Adafruit_EPD.RED)
|
||||
|
||||
print("Draw text")
|
||||
display.text('hello world', 25, 10, Adafruit_EPD.BLACK)
|
||||
display.text("hello world", 25, 10, Adafruit_EPD.BLACK)
|
||||
display.display()
|
||||
|
|
|
|||
55
setup.py
55
setup.py
|
|
@ -7,6 +7,7 @@ https://github.com/pypa/sampleproject
|
|||
|
||||
# Always prefer setuptools over distutils
|
||||
from setuptools import setup, find_packages
|
||||
|
||||
# To use a consistent encoding
|
||||
from codecs import open
|
||||
from os import path
|
||||
|
|
@ -14,48 +15,42 @@ from os import path
|
|||
here = path.abspath(path.dirname(__file__))
|
||||
|
||||
# Get the long description from the README file
|
||||
with open(path.join(here, 'README.rst'), encoding='utf-8') as f:
|
||||
with open(path.join(here, "README.rst"), encoding="utf-8") as f:
|
||||
long_description = f.read()
|
||||
|
||||
setup(
|
||||
name='adafruit-circuitpython-epd',
|
||||
|
||||
name="adafruit-circuitpython-epd",
|
||||
use_scm_version=True,
|
||||
setup_requires=['setuptools_scm'],
|
||||
|
||||
description='CircuitPython library for EPD e-ink displays.',
|
||||
setup_requires=["setuptools_scm"],
|
||||
description="CircuitPython library for EPD e-ink displays.",
|
||||
long_description=long_description,
|
||||
long_description_content_type='text/x-rst',
|
||||
|
||||
long_description_content_type="text/x-rst",
|
||||
# The project's main homepage.
|
||||
url='https://github.com/adafruit/Adafruit_CircuitPython_EPD',
|
||||
|
||||
url="https://github.com/adafruit/Adafruit_CircuitPython_EPD",
|
||||
# Author details
|
||||
author='Adafruit Industries',
|
||||
author_email='circuitpython@adafruit.com',
|
||||
|
||||
install_requires=['Adafruit-Blinka', 'adafruit-circuitpython-busdevice',
|
||||
'adafruit-circuitpython-framebuf'],
|
||||
|
||||
author="Adafruit Industries",
|
||||
author_email="circuitpython@adafruit.com",
|
||||
install_requires=[
|
||||
"Adafruit-Blinka",
|
||||
"adafruit-circuitpython-busdevice",
|
||||
"adafruit-circuitpython-framebuf",
|
||||
],
|
||||
# Choose your license
|
||||
license='MIT',
|
||||
|
||||
license="MIT",
|
||||
# See https://pypi.python.org/pypi?%3Aaction=list_classifiers
|
||||
classifiers=[
|
||||
'Development Status :: 3 - Alpha',
|
||||
'Intended Audience :: Developers',
|
||||
'Topic :: Software Development :: Libraries',
|
||||
'Topic :: System :: Hardware',
|
||||
'License :: OSI Approved :: MIT License',
|
||||
'Programming Language :: Python :: 3',
|
||||
'Programming Language :: Python :: 3.4',
|
||||
'Programming Language :: Python :: 3.5',
|
||||
"Development Status :: 3 - Alpha",
|
||||
"Intended Audience :: Developers",
|
||||
"Topic :: Software Development :: Libraries",
|
||||
"Topic :: System :: Hardware",
|
||||
"License :: OSI Approved :: MIT License",
|
||||
"Programming Language :: Python :: 3",
|
||||
"Programming Language :: Python :: 3.4",
|
||||
"Programming Language :: Python :: 3.5",
|
||||
],
|
||||
|
||||
# What does your project relate to?
|
||||
keywords='adafruit eink e-ink display epd hardware micropython circuitpython',
|
||||
|
||||
keywords="adafruit eink e-ink display epd hardware micropython circuitpython",
|
||||
# You can just specify the packages manually here if your project is
|
||||
# simple. Or you can use find_packages().
|
||||
packages=['adafruit_epd'],
|
||||
packages=["adafruit_epd"],
|
||||
)
|
||||
|
|
|
|||
Loading…
Reference in a new issue