def __init__(self,
                 *,
                 default_bg=0xFFFFFF,
                 auto_refresh=True,
                 rotation=270,
                 debug=False):

        self._debug = debug
        if not hasattr(board, "DISPLAY"):
            import adafruit_il0373  # pylint: disable=import-outside-toplevel

            displayio.release_displays()
            display_bus = displayio.FourWire(
                board.SPI(),
                command=board.EPD_DC,
                chip_select=board.EPD_CS,
                reset=board.EPD_RESET,
                baudrate=1000000,
            )

            self.display = adafruit_il0373.IL0373(
                display_bus,
                width=296,
                height=128,
                rotation=rotation,
                black_bits_inverted=False,
                color_bits_inverted=False,
                grayscale=True,
                refresh_time=1,
                seconds_per_frame=1,
            )
        else:
            self.display = board.DISPLAY
            self.display.rotation = rotation

        self.auto_refresh = auto_refresh

        if self._debug:
            print("Init display")
        self.splash = displayio.Group(max_size=15)
        self._qr_group = None
        if self._debug:
            print("Init background")
        self._bg_group = displayio.Group(max_size=1)
        self._bg_file = None
        self.splash.append(self._bg_group)
        self.display.show(self.splash)

        # set the default background
        if default_bg is not None:
            self.set_background(default_bg)

        gc.collect()
Beispiel #2
0
spi = board.SPI()  # Uses SCK and MOSI
epd_cs = board.D9
epd_dc = board.D10
epd_reset = board.D5
epd_busy = board.D6

display_bus = displayio.FourWire(spi,
                                 command=epd_dc,
                                 chip_select=epd_cs,
                                 reset=epd_reset,
                                 baudrate=1000000)
time.sleep(1)

display = adafruit_il0373.IL0373(display_bus,
                                 width=296,
                                 height=128,
                                 rotation=90,
                                 busy_pin=epd_busy,
                                 swap_rams=True)

g = displayio.Group()

f = open("/display-ruler.bmp", "rb")

pic = displayio.OnDiskBitmap(f)
t = displayio.TileGrid(pic, pixel_shader=displayio.ColorConverter())
g.append(t)

display.show(g)

display.refresh()
Beispiel #3
0
epd_dc = board.D10
epd_reset = board.D5
epd_busy = board.D6

# Create the displayio connection to the display pins
display_bus = displayio.FourWire(spi,
                                 command=epd_dc,
                                 chip_select=epd_cs,
                                 reset=epd_reset,
                                 baudrate=1000000)
time.sleep(1)  # Wait a bit

# Create the display object - the third color is red (0xff0000)
display = adafruit_il0373.IL0373(display_bus,
                                 width=212,
                                 height=104,
                                 rotation=90,
                                 busy_pin=epd_busy,
                                 highlight_color=0xff0000)

# Create a display group for our screen objects
g = displayio.Group()

# Display a ruler graphic from the root directory of the CIRCUITPY drive
f = open("/display-ruler.bmp", "rb")

pic = displayio.OnDiskBitmap(f)
# Create a Tilegrid with the bitmap and put in the displayio group
t = displayio.TileGrid(pic, pixel_shader=displayio.ColorConverter())
g.append(t)

# Place the display group on the screen
Beispiel #4
0
import board
import displayio
import adafruit_il0373

displayio.release_displays()

epd_cs = board.D9
epd_dc = board.D10

display_bus = displayio.FourWire(
    board.SPI(), command=epd_dc, chip_select=epd_cs, baudrate=1000000
)
time.sleep(1)

display = adafruit_il0373.IL0373(
    display_bus, width=212, height=104, rotation=90, highlight_color=0xFF0000
)

g = displayio.Group()

f = open("/display-ruler.bmp", "rb")

pic = displayio.OnDiskBitmap(f)
t = displayio.TileGrid(pic, pixel_shader=displayio.ColorConverter())
g.append(t)

display.show(g)

display.refresh()

print("refreshed")
epd_cs = board.D9
epd_dc = board.D10
epd_reset = board.D5
epd_busy = board.D6

# Create the displayio connection to the display pins
display_bus = displayio.FourWire(
    spi, command=epd_dc, chip_select=epd_cs, reset=epd_reset, baudrate=1000000
)
time.sleep(1)  # Wait a bit

# Create the display object - the third color is red (0xff0000)
display = adafruit_il0373.IL0373(
    display_bus,
    width=296,
    height=128,
    rotation=270,
    busy_pin=epd_busy,
    highlight_color=0xFF0000,
)

# Create a display group for our screen objects
g = displayio.Group()

# Display a ruler graphic from the root directory of the CIRCUITPY drive
f = open("/display-ruler.bmp", "rb")

pic = displayio.OnDiskBitmap(f)
# Create a Tilegrid with the bitmap and put in the displayio group
t = displayio.TileGrid(pic, pixel_shader=displayio.ColorConverter())
g.append(t)
# Create the displayio connection to the display pins
display_bus = displayio.FourWire(spi,
                                 command=epd_dc,
                                 chip_select=epd_cs,
                                 reset=epd_reset,
                                 baudrate=1000000)
time.sleep(1)  # Wait a bit

# Create the display object - the third color is red (0xff0000)
DISPLAY_WIDTH = 212
DISPLAY_HEIGHT = 104

display = adafruit_il0373.IL0373(display_bus,
                                 width=DISPLAY_WIDTH,
                                 height=DISPLAY_HEIGHT,
                                 rotation=90,
                                 busy_pin=epd_busy,
                                 highlight_color=0xff0000)

# Create a display group for our screen objects
g = displayio.Group()

# Set a background
background_bitmap = displayio.Bitmap(DISPLAY_WIDTH, DISPLAY_HEIGHT, 1)
# Map colors in a palette
palette = displayio.Palette(1)
palette[0] = BACKGROUND_COLOR

# Create a Tilegrid with the background and put in the displayio group
t = displayio.TileGrid(background_bitmap, pixel_shader=palette)
g.append(t)
# This pinout works on a Feather M4 and may need to be altered for other boards.
spi = busio.SPI(board.SCK, board.MOSI)  # Uses SCK and MOSI
epd_cs = board.D9
epd_dc = board.D10

display_bus = displayio.FourWire(spi,
                                 command=epd_dc,
                                 chip_select=epd_cs,
                                 baudrate=1000000)
time.sleep(1)

display = adafruit_il0373.IL0373(
    display_bus,
    width=296,
    height=128,
    rotation=270,
    black_bits_inverted=False,
    color_bits_inverted=False,
    grayscale=True,
    refresh_time=1,
)

g = displayio.Group()

f = open("/display-ruler.bmp", "rb")

pic = displayio.OnDiskBitmap(f)
t = displayio.TileGrid(pic, pixel_shader=displayio.ColorConverter())
g.append(t)

display.show(g)
epd_cs = board.D9
epd_dc = board.D10
epd_reset = board.D5
epd_busy = board.D6

display_bus = displayio.FourWire(spi,
                                 command=epd_dc,
                                 chip_select=epd_cs,
                                 reset=epd_reset,
                                 baudrate=1000000)
time.sleep(1)

display = adafruit_il0373.IL0373(
    display_bus,
    width=152,
    height=152,
    busy_pin=epd_busy,
    highlight_color=0xFF0000,
    rotation=180,
)

g = displayio.Group()

f = open("/display-ruler.bmp", "rb")

pic = displayio.OnDiskBitmap(f)
t = displayio.TileGrid(pic, pixel_shader=displayio.ColorConverter())
g.append(t)

display.show(g)

display.refresh()
Beispiel #9
0
spi = board.SPI()  # Uses SCK and MOSI
epd_cs = board.D9
epd_dc = board.D10
epd_reset = board.D5
epd_busy = board.D6

display_bus = displayio.FourWire(spi,
                                 command=epd_dc,
                                 chip_select=epd_cs,
                                 reset=epd_reset,
                                 baudrate=1000000)
time.sleep(1)

display = adafruit_il0373.IL0373(display_bus,
                                 width=152,
                                 height=152,
                                 busy_pin=epd_busy,
                                 highlight_color=0xff0000)

g = displayio.Group()

f = open("/display-ruler.bmp", "rb")

pic = displayio.OnDiskBitmap(f)
t = displayio.TileGrid(pic, pixel_shader=displayio.ColorConverter())
g.append(t)

display.show(g)

display.refresh()