Linting files for CI
This commit is contained in:
parent
70279eddae
commit
5d9eeba8ad
4 changed files with 46 additions and 32 deletions
|
|
@ -61,29 +61,29 @@ draw.rectangle((0, 0, width, height), 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
|
||||
PADDING = 5
|
||||
SHAPE_WIDTH = 30
|
||||
TOP = PADDING
|
||||
bottom = height - PADDING
|
||||
# Move left to right keeping track of the current x position for drawing shapes.
|
||||
x = padding
|
||||
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)],
|
||||
[(x, bottom), (x + SHAPE_WIDTH / 2, TOP), (x + SHAPE_WIDTH, bottom)],
|
||||
outline=BLACK,
|
||||
fill=WHITE,
|
||||
)
|
||||
x += shape_width + padding
|
||||
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)
|
||||
|
|
@ -94,8 +94,8 @@ font = ImageFont.truetype("/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf", 20)
|
|||
# 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:
|
||||
|
|
|
|||
2
examples/epd_bonnet_blinka_250x122.bmp.license
Normal file
2
examples/epd_bonnet_blinka_250x122.bmp.license
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
|
@ -1,24 +1,31 @@
|
|||
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
import time
|
||||
import digitalio
|
||||
import busio
|
||||
import board
|
||||
from adafruit_epd.epd import Adafruit_EPD
|
||||
import time
|
||||
from adafruit_epd.ssd1680 import Adafruit_SSD1680
|
||||
|
||||
# create the spi device and pins we will need
|
||||
spi = busio.SPI(board.EPD_SCK, MOSI=board.EPD_MOSI, MISO=None)
|
||||
epd_cs = digitalio.DigitalInOut(board.EPD_CS)
|
||||
epd_dc = digitalio.DigitalInOut(board.EPD_DC)
|
||||
epd_reset = digitalio.DigitalInOut(board.EPD_RESET)
|
||||
epd_busy = digitalio.DigitalInOut(board.EPD_BUSY)
|
||||
epd_busy = digitalio.DigitalInOut(board.EPD_BUSY)
|
||||
srcs = None
|
||||
|
||||
from adafruit_epd.ssd1680 import Adafruit_SSD1680
|
||||
display = Adafruit_SSD1680(122, 250, spi, cs_pin=epd_cs, dc_pin=epd_dc,
|
||||
sramcs_pin=srcs, rst_pin=epd_reset,
|
||||
busy_pin=epd_busy)
|
||||
display = Adafruit_SSD1680(
|
||||
122,
|
||||
250,
|
||||
spi,
|
||||
cs_pin=epd_cs,
|
||||
dc_pin=epd_dc,
|
||||
sramcs_pin=srcs,
|
||||
rst_pin=epd_reset,
|
||||
busy_pin=epd_busy,
|
||||
)
|
||||
|
||||
display.rotation = 3
|
||||
display.fill(Adafruit_EPD.WHITE)
|
||||
|
|
|
|||
|
|
@ -1,28 +1,34 @@
|
|||
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
import time
|
||||
import digitalio
|
||||
import busio
|
||||
import board
|
||||
from adafruit_epd.epd import Adafruit_EPD
|
||||
import time
|
||||
|
||||
from PIL import Image
|
||||
from PIL import ImageDraw
|
||||
from PIL import ImageFont
|
||||
from adafruit_epd.epd import Adafruit_EPD
|
||||
from adafruit_epd.ssd1680 import Adafruit_SSD1680
|
||||
|
||||
# create the spi device and pins we will need
|
||||
spi = busio.SPI(board.EPD_SCK, MOSI=board.EPD_MOSI, MISO=None)
|
||||
epd_cs = digitalio.DigitalInOut(board.EPD_CS)
|
||||
epd_dc = digitalio.DigitalInOut(board.EPD_DC)
|
||||
epd_reset = digitalio.DigitalInOut(board.EPD_RESET)
|
||||
epd_busy = digitalio.DigitalInOut(board.EPD_BUSY)
|
||||
epd_busy = digitalio.DigitalInOut(board.EPD_BUSY)
|
||||
srcs = None
|
||||
|
||||
from adafruit_epd.ssd1680 import Adafruit_SSD1680
|
||||
display = Adafruit_SSD1680(122, 250, spi, cs_pin=epd_cs, dc_pin=epd_dc,
|
||||
sramcs_pin=srcs, rst_pin=epd_reset,
|
||||
busy_pin=epd_busy)
|
||||
display = Adafruit_SSD1680(
|
||||
122,
|
||||
250,
|
||||
spi,
|
||||
cs_pin=epd_cs,
|
||||
dc_pin=epd_dc,
|
||||
sramcs_pin=srcs,
|
||||
rst_pin=epd_reset,
|
||||
busy_pin=epd_busy,
|
||||
)
|
||||
|
||||
display.rotation = 3
|
||||
# Create blank image for drawing.
|
||||
|
|
@ -87,7 +93,6 @@ display.display()
|
|||
|
||||
time.sleep(10)
|
||||
|
||||
blinkaimage = Image.open('examples/epd_bonnet_blinka_250x122.bmp')
|
||||
blinkaimage = Image.open("examples/epd_bonnet_blinka_250x122.bmp")
|
||||
display.image(blinkaimage)
|
||||
display.display()
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue